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

56
LINES

< > BotCompany Repo | #1036609 // G22TextsPanel (dev.)

JavaX fragment (include)

1  
concept G22TextsPanel extends G22CRUDAndDetailPanel<G22Text> {
2  
  transient volatile settable G22LAScriptIDE scriptIDE;
3  
  
4  
  SimpleCRUD_v2<G22Text> makeCRUD() {
5  
    var crud = new SimpleCRUD_v2<>(g22utils.concepts(), G22Text);
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  
      G22Text 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(G22Text script) {
29  
    scriptIDE(new G22LAScriptIDE(g22utils));
30  
    scriptIDE.setScript(script);
31  
    ret scriptIDE.visualize();
32  
  }
33  
  
34  
  SimpleCRUD_v2<G22Text> 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(G22Text));
40  
    showFrame("Scripts in project", g22utils.newSyntaxTextArea(text));
41  
  }
42  
  
43  
  void edit(G22Text 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 #1034599

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1036609
Snippet name: G22TextsPanel (dev.)
Eternal ID of this version: #1036609/1
Text MD5: aeb1202270fcb5e1ce9769beb4fa2f83
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-04-27 18:40:19
Source code size: 1823 bytes / 56 lines
Pitched / IR pitched: No / No
Views / Downloads: 138 / 149
Referenced in: [show references]