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

52
LINES

< > BotCompany Repo | #1035920 // G22ShowCasePanel

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

Uses 2164K of libraries. Click here for Pure Java version (70026L/371K).

1  
srecord noeq G22ShowCasePanel(G22Utils g22utils) is Swingable {
2  
  transient SingleComponentPanel scpShowCase;
3  
  transient ReliableSingleThread rstUpdateShowCase = rst(l0 updateShowCase);
4  
  
5  
  void updateShowCase() {
6  
    if (!isShowing(scpShowCase)) ret;
7  
    var autoStarter = g22utils.autoStarter();
8  
    if (autoStarter.cancelled())
9  
      ret with scpShowCase.set(jcenteredlabel("Auto-start cancelled"));
10  
    if (!autoStarter.waitedAndDone()) ret;
11  
    var script = varShowCasedScript()!;
12  
    
13  
    if (script == null)
14  
      ret with scpShowCase.set(g22utils.jGazelleLogo());
15  
      
16  
    scpShowCase.set(g22utils.visualizeAutoRunnableScript(script));
17  
  }
18  
  
19  
  IVarWithNotify<G22LeftArrowScript> varShowCasedScript() {
20  
    ret g22utils.projectActions().varShowCasedScript();
21  
  }
22  
  
23  
  cachedVisualize {
24  
    g22utils.autoStarter().onDone(rstUpdateShowCase);
25  
    scpShowCase = singleComponentPanel(
26  
      varShowCasedScript()! == null ? null : jcenteredlabel("Waiting for auto-start to finish..."));
27  
    onChange(varShowCasedScript(), rstUpdateShowCase);
28  
    bindToComponent(scpShowCase, rstUpdateShowCase);
29  
      
30  
    // LAYOUT
31  
    
32  
    ret
33  
      northAndCenterWithMargin(
34  
        centerAndEastWithMargin(
35  
          // combo box (script selector)
36  
          
37  
          withSideMargins(withLabel("Script:", bindComboBoxToVar(varShowCasedScript(),
38  
            swing(-> centerComboBoxAndItems(new ConceptsComboBox<>(g22utils.concepts(), G22LeftArrowScript)
39  
              .allowNull(true)
40  
              .itemFilter(script -> classIs(G22LeftArrowScript, script) && script.isClearForAutoRun())
41  
              .sorter(l -> sortedByFieldAlphanumIC description(l))
42  
          ))))),
43  
          jline(
44  
            jimageButton(#1101440, "Re-run script", rstUpdateShowCase),
45  
            g22utils.editButton("Edit script",
46  
              -> g22utils.projectActions().editScript(varShowCasedScript()!))
47  
          )
48  
        ),
49  
        scpShowCase
50  
      );
51  
  }
52  
}

Author comment

Began life as a copy of #1034718

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035920
Snippet name: G22ShowCasePanel
Eternal ID of this version: #1035920/13
Text MD5: 8071b42faa061d3bac3bc70e705b2f20
Transpilation MD5: 780f243f892ad001fc106e68d0fc7be9
Author: stefan
Category: javax / gazelle 22
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-08-08 13:15:48
Source code size: 1987 bytes / 52 lines
Pitched / IR pitched: No / No
Views / Downloads: 130 / 207
Version history: 12 change(s)
Referenced in: [show references]