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

72
LINES

< > BotCompany Repo | #1034340 // G22ChallengesPanel

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

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

1  
sclass G22ChallengesPanel {
2  
  replace Challenge with G22Challenge.
3  
  
4  
  transient settable G22Utils g22utils;
5  
 
6  
  transient SimpleCRUD_v2<Challenge> challengeCRUD;
7  
  transient SingleComponentPanel scpChallengePanel;
8  
  transient SimpleCRUD_v2<G22RecognizerScript> recognizerCRUD;
9  
  transient G22ChallengePanel challengePanel;
10  
  
11  
  transient G22ChallengeIDE challengeIDE;
12  
  
13  
  simplyCached JComponent visualize() {
14  
    challengeCRUD = new SimpleCRUD_v2<>(g22utils.concepts(), Challenge);
15  
    g22utils.setupScriptCRUD(challengeCRUD);
16  
    challengeCRUD.addCountToEnclosingTab(true);
17  
    challengeCRUD.entityName = -> "Challenge";
18  
    
19  
    challengeIDE = new G22ChallengeIDE(g22utils);
20  
    challengeIDE.noScriptSelectedMsg("Please select a challenge above to start");
21  
      
22  
    challengeIDE.modifyIDE = ide -> {
23  
      // TODO ide.runScript = 
24  
    };
25  
    
26  
    recognizerCRUD = new SimpleCRUD_v2<>(g22utils.concepts(), G22RecognizerScript);
27  
    recognizerCRUD.entityName = -> "Recognizer";
28  
    g22utils.setupScriptCRUD(recognizerCRUD);
29  
    
30  
    var recognizerCRUDVis = recognizerCRUD.visualize();
31  
    
32  
    recognizerCRUD.onSelectionChanged(->
33  
      recognizerIDE().setScript(recognizerCRUD.selected()));
34  
35  
    scpChallengePanel = singleComponentPanel();
36  
37  
    challengeCRUD.onSelectionChangedAndNow(r_dm_q(l0 makeChallengePanel));
38  
39  
    ret jhsplit(
40  
      withTopRightAndBottomMargin(jCenteredRaisedSection("Challenges", 
41  
        withSideAndBottomMargin(
42  
          jvsplit(
43  
            jvsplit(
44  
              withBottomMargin(challengeCRUD.visualize()),
45  
              challengeIDE.visualize()
46  
            ),
47  
            jCenteredRaisedSection("Recognizers", recognizerCRUDVis)
48  
          )
49  
        ))),
50  
        withSideMargins(scpChallengePanel));
51  
  }
52  
  
53  
  G22LAScriptIDE<G22RecognizerScript> recognizerIDE() {
54  
    ret challengePanel.recognizerIDE;
55  
  }
56  
57  
  void makeChallengePanel {
58  
    var challenge = challengeCRUD.selected();
59  
    challengeIDE.setScript(challenge);
60  
    if (challenge == null) ret;
61  
62  
    var panel = challengePanel = G22ChallengePanel(challenge);
63  
    panel.g22utils(g22utils);
64  
    panel.init();
65  
66  
    scpChallengePanel.set(withTopAndBottomMargin(12, 6, panel.visualize()));
67  
  }
68  
  
69  
  void updateCount {
70  
    challengeCRUD.update();
71  
  }
72  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1034340
Snippet name: G22ChallengesPanel
Eternal ID of this version: #1034340/24
Text MD5: f79352ca60ae1efd1ebd8c0cfeab6580
Transpilation MD5: 120b43d7fe81de3b5844a20fd81a3462
Author: stefan
Category: javax / gazelle 22
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-03 09:55:32
Source code size: 2311 bytes / 72 lines
Pitched / IR pitched: No / No
Views / Downloads: 207 / 385
Version history: 23 change(s)
Referenced in: [show references]