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).

sclass G22ChallengesPanel {
  replace Challenge with G22Challenge.
  
  transient settable G22Utils g22utils;
 
  transient SimpleCRUD_v2<Challenge> challengeCRUD;
  transient SingleComponentPanel scpChallengePanel;
  transient SimpleCRUD_v2<G22RecognizerScript> recognizerCRUD;
  transient G22ChallengePanel challengePanel;
  
  transient G22ChallengeIDE challengeIDE;
  
  simplyCached JComponent visualize() {
    challengeCRUD = new SimpleCRUD_v2<>(g22utils.concepts(), Challenge);
    g22utils.setupScriptCRUD(challengeCRUD);
    challengeCRUD.addCountToEnclosingTab(true);
    challengeCRUD.entityName = -> "Challenge";
    
    challengeIDE = new G22ChallengeIDE(g22utils);
    challengeIDE.noScriptSelectedMsg("Please select a challenge above to start");
      
    challengeIDE.modifyIDE = ide -> {
      // TODO ide.runScript = 
    };
    
    recognizerCRUD = new SimpleCRUD_v2<>(g22utils.concepts(), G22RecognizerScript);
    recognizerCRUD.entityName = -> "Recognizer";
    g22utils.setupScriptCRUD(recognizerCRUD);
    
    var recognizerCRUDVis = recognizerCRUD.visualize();
    
    recognizerCRUD.onSelectionChanged(->
      recognizerIDE().setScript(recognizerCRUD.selected()));

    scpChallengePanel = singleComponentPanel();

    challengeCRUD.onSelectionChangedAndNow(r_dm_q(l0 makeChallengePanel));

    ret jhsplit(
      withTopRightAndBottomMargin(jCenteredRaisedSection("Challenges", 
        withSideAndBottomMargin(
          jvsplit(
            jvsplit(
              withBottomMargin(challengeCRUD.visualize()),
              challengeIDE.visualize()
            ),
            jCenteredRaisedSection("Recognizers", recognizerCRUDVis)
          )
        ))),
        withSideMargins(scpChallengePanel));
  }
  
  G22LAScriptIDE<G22RecognizerScript> recognizerIDE() {
    ret challengePanel.recognizerIDE;
  }

  void makeChallengePanel {
    var challenge = challengeCRUD.selected();
    challengeIDE.setScript(challenge);
    if (challenge == null) ret;

    var panel = challengePanel = G22ChallengePanel(challenge);
    panel.g22utils(g22utils);
    panel.init();

    scpChallengePanel.set(withTopAndBottomMargin(12, 6, panel.visualize()));
  }
  
  void updateCount {
    challengeCRUD.update();
  }
}

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: 208 / 386
Version history: 23 change(s)
Referenced in: #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167)