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

46
LINES

< > BotCompany Repo | #1034724 // G22AutoStartPanel

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

Transpiled version (38563L) is out of date.

1  
srecord noeq G22AutoStartPanel(G22Utils g22utils) is Swingable {
2  
  G22AutoStarter autoStarter;
3  
  JButton btnCancel, btnResume;
4  
  JLabel lblStatus1, lblStatus2, lblCurrentScript, lblCtrl;
5  
  JPanel stack;
6  
  
7  
  cachedVisualize {
8  
    autoStarter = g22utils.autoStarter();
9  
    btnResume = jbutton("Resume", r resume);
10  
    
11  
    var vis = jCenteredSection("Auto Start",
12  
      stack = vstack2(
13  
        centerAndEastWithMargin(
14  
          btnCancel = jThreadedButton("CANCEL", r { autoStarter.cancel() }),
15  
          jimageButtonScaledToWidth(16, editImageID(), "Edit auto-run scripts",
16  
            rThread { g22utils.projectActions().editScripts() })
17  
        ),
18  
        lblCtrl = jCenteredLabel(autoStarter.cancelOnCtrl() ? "(Hammer Ctrl to cancel)" : ""),
19  
        jVerticalStrut(10),
20  
        lblStatus1 = jCenteredLabel(),
21  
        lblCurrentScript = jCenteredLabel(),
22  
        lblStatus2 = jCenteredLabel(),
23  
      )
24  
    );
25  
26  
    bindListenerToComponent(lblStatus1, autoStarter, r update);
27  
    /*componentPopupMenuItems(btnCancel,
28  
      "Resume", rThread resume);*/
29  
    ret vis;
30  
  }
31  
  
32  
  void update {
33  
    bool done = autoStarter.waitedAndDone();
34  
    if (done)
35  
      setText(btnCancel, "Auto-start done");
36  
    setEnabled(lblCtrl, autoStarter.ctrlEnabled());
37  
    setEnabled(btnCancel, autoStarter.enabled() && !done);
38  
    setText(lblStatus1, autoStarter.scriptsRunStats());
39  
    setText(lblStatus2, done ? "" : autoStarter.status());
40  
    setText(lblCurrentScript, autoStarter.currentScriptStats());
41  
    
42  
    addOrRemoveComponent(autoStarter.canResume(), stack, btnResume);
43  
  }
44  
  
45  
  void resume { autoStarter.resume(); }
46  
}

Author comment

Began life as a copy of #1034688

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1034724
Snippet name: G22AutoStartPanel
Eternal ID of this version: #1034724/35
Text MD5: 60095073d0a7f80c6523a461b5afbc4b
Author: stefan
Category: javax / gazelle 22
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-10-26 16:48:02
Source code size: 1652 bytes / 46 lines
Pitched / IR pitched: No / No
Views / Downloads: 213 / 389
Version history: 34 change(s)
Referenced in: [show references]