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.

concept G22ScriptsPanel extends G22CRUDAndDetailPanel<G22LeftArrowScript> {
  transient volatile settable G22LAScriptIDE scriptIDE;
  
  SimpleCRUD_v2<G22LeftArrowScript> makeCRUD() {
    var crud = new SimpleCRUD_v2<>(g22utils.concepts(), G22LeftArrowScript);
    crud.noSubclasses(true);
    crud.entityName = -> "Script";
    g22utils.setupScriptCRUD(crud, true);
    
    // Full-text search baby!!
    var ts = crud.tableSearcher();
    var basicRowTester = ts.rowTester;
    ts.rowTester = if2ToF2((pat, map) -> {
      if (basicRowTester.get(pat, map)) true;
      
      long id = toLong(map.get(crud.hID));
      G22LeftArrowScript script = g22utils.getScript(id);
      if (anyContainsIgnoreCase(script.allTexts(), pat)) true;
      
      false;
    });
    
    crud.addButton(new JPopDownButton().content(
      "Show all scripts as one long text", rThread showHugeText));
    ret crud;
  }
  
  JComponent makeDetailView(G22LeftArrowScript script) {
    scriptIDE(new G22LAScriptIDE(g22utils));
    scriptIDE.setScript(script);
    ret scriptIDE.visualize();
  }
  
  SimpleCRUD_v2<G22LeftArrowScript> scriptCRUD() { ret crud(); }
  
  selfType g22utils(G22Utils g22utils) { super.g22utils(g22utils); this; }
  
  void showHugeText {
    S text = new G22ScriptUtil(g22utils).makeHugeText(g22utils.list(G22LeftArrowScript));
    showFrame("Scripts in project", g22utils.newSyntaxTextArea(text));
  }
  
  void edit(G22LeftArrowScript script, LineAndColumn lineAndCol) {
    edit(script);
    print(+scriptIDE);
    print("Waiting for script IDE to appear for " + script);
    var ide = pollWaitUntilNotNull(100, 5.0, -> {
      if (scriptIDE == null) null;
      if (scriptIDE.script() != script) null;
      ret scriptIDE;
    });
 
    print("Going to position " + lineAndCol + " in " + ide);
    ide?.goToPositionInAllModes(lineAndCol);
  }
}

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: 278 / 534
Version history: 38 change(s)
Referenced in: [show references]