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

56
LINES

< > BotCompany Repo | #1034599 // G22ScriptsPanel

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

Transpiled version (68139L) is out of date.

1  
concept G22ScriptsPanel extends G22CRUDAndDetailPanel<G22LeftArrowScript> {
2  
  transient volatile settable G22LAScriptIDE scriptIDE;
3  
  
4  
  SimpleCRUD_v2<G22LeftArrowScript> makeCRUD() {
5  
    var crud = new SimpleCRUD_v2<>(g22utils.concepts(), G22LeftArrowScript);
6  
    crud.noSubclasses(true);
7  
    crud.entityName = -> "Script";
8  
    g22utils.setupScriptCRUD(crud, true);
9  
    
10  
    // Full-text search baby!!
11  
    var ts = crud.tableSearcher();
12  
    var basicRowTester = ts.rowTester;
13  
    ts.rowTester = if2ToF2((pat, map) -> {
14  
      if (basicRowTester.get(pat, map)) true;
15  
      
16  
      long id = toLong(map.get(crud.hID));
17  
      G22LeftArrowScript script = g22utils.getScript(id);
18  
      if (anyContainsIgnoreCase(script.allTexts(), pat)) true;
19  
      
20  
      false;
21  
    });
22  
    
23  
    crud.addButton(new JPopDownButton().content(
24  
      "Show all scripts as one long text", rThread showHugeText));
25  
    ret crud;
26  
  }
27  
  
28  
  JComponent makeDetailView(G22LeftArrowScript script) {
29  
    scriptIDE(new G22LAScriptIDE(g22utils));
30  
    scriptIDE.setScript(script);
31  
    ret scriptIDE.visualize();
32  
  }
33  
  
34  
  SimpleCRUD_v2<G22LeftArrowScript> scriptCRUD() { ret crud(); }
35  
  
36  
  selfType g22utils(G22Utils g22utils) { super.g22utils(g22utils); this; }
37  
  
38  
  void showHugeText {
39  
    S text = new G22ScriptUtil(g22utils).makeHugeText(g22utils.list(G22LeftArrowScript));
40  
    showFrame("Scripts in project", g22utils.newSyntaxTextArea(text));
41  
  }
42  
  
43  
  void edit(G22LeftArrowScript script, LineAndColumn lineAndCol) {
44  
    edit(script);
45  
    print(+scriptIDE);
46  
    print("Waiting for script IDE to appear for " + script);
47  
    var ide = pollWaitUntilNotNull(100, 5.0, -> {
48  
      if (scriptIDE == null) null;
49  
      if (scriptIDE.script() != script) null;
50  
      ret scriptIDE;
51  
    });
52  
 
53  
    print("Going to position " + lineAndCol + " in " + ide);
54  
    ide?.goToPositionInAllModes(lineAndCol);
55  
  }
56  
}

Author comment

Began life as a copy of #1034473

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034599
Snippet name: G22ScriptsPanel
Eternal ID of this version: #1034599/39
Text MD5: c0206cb5c390ffd3f76cb99f55e25888
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-12-17 17:47:11
Source code size: 1913 bytes / 56 lines
Pitched / IR pitched: No / No
Views / Downloads: 280 / 538
Version history: 38 change(s)
Referenced in: [show references]