Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

39
LINES

< > BotCompany Repo | #1034706 // G22ProjectStoryEditor backup 2

JavaX fragment (include) [tags: use-pretranspiled]

Uses 1485K of libraries. Click here for Pure Java version (35189L/229K).

1  
srecord noeq G22ProjectStoryEditor(G22Utils g22utils) {
2  
  JSyntaxTextFileEditor editor;
3  
4  
  File textFile() { ret g22utils.projectStoryTextFile(); }
5  
  
6  
  IVarWithNotify<S> varText() { ret textFileAsVarWithNotify(textFile()); }
7  
  
8  
  cachedVisualize {
9  
    editor = new JSyntaxTextFileEditor(textFile()).autoSave(true);
10  
    
11  
    // debug modelToToken
12  
    editor.makeSyntaxTextAreaWithSearch = ->
13  
      new RSyntaxTextAreaWithSearch(new RSyntaxTextArea(1, 10) {
14  
        public org.fife.ui.rsyntaxtextarea.Token modelToToken(int ofs) {
15  
          var token = super.modelToToken(ofs);
16  
          printVars("modelToToken", +ofs, +token);
17  
          ret token;
18  
        }
19  
      });
20  
    
21  
    // react to HyperlinkEvent
22  
    // problems:
23  
    // -RSyntaxTextArea only fires these events when ctrl is pressed
24  
    // -RSyntaxTextArea expects the token to be a url with protocol
25  
    // So we'll have to make our own hyperlink mechanism...
26  
    editor.adaptSyntaxTextArea = textArea -> {
27  
      ((RSyntaxDocument) textArea.getDocument()).setSyntaxStyle(new HashRefTokenMaker);
28  
      textArea.addHyperlinkListener(evt -> {
29  
        print("Hyperlink event");
30  
        if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
31  
          infoBox("Link URL: " + evt.getURL());
32  
        }
33  
      });
34  
    };
35  
    ret withTopAndBottomMargin(jRaisedCenteredSection("Project Story",
36  
      editor.visualize()
37  
    ));
38  
  }
39  
}

Author comment

Began life as a copy of #1034688

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034706
Snippet name: G22ProjectStoryEditor backup 2
Eternal ID of this version: #1034706/1
Text MD5: a416017a837d49075e55696424d14f2f
Transpilation MD5: 31f4cd5ca447efa6feccb58ab45652e5
Author: stefan
Category: javax / gazelle 22
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-06 00:00:11
Source code size: 1427 bytes / 39 lines
Pitched / IR pitched: No / No
Views / Downloads: 134 / 194
Referenced in: [show references]