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.

srecord noeq G22AutoStartPanel(G22Utils g22utils) is Swingable {
  G22AutoStarter autoStarter;
  JButton btnCancel, btnResume;
  JLabel lblStatus1, lblStatus2, lblCurrentScript, lblCtrl;
  JPanel stack;
  
  cachedVisualize {
    autoStarter = g22utils.autoStarter();
    btnResume = jbutton("Resume", r resume);
    
    var vis = jCenteredSection("Auto Start",
      stack = vstack2(
        centerAndEastWithMargin(
          btnCancel = jThreadedButton("CANCEL", r { autoStarter.cancel() }),
          jimageButtonScaledToWidth(16, editImageID(), "Edit auto-run scripts",
            rThread { g22utils.projectActions().editScripts() })
        ),
        lblCtrl = jCenteredLabel(autoStarter.cancelOnCtrl() ? "(Hammer Ctrl to cancel)" : ""),
        jVerticalStrut(10),
        lblStatus1 = jCenteredLabel(),
        lblCurrentScript = jCenteredLabel(),
        lblStatus2 = jCenteredLabel(),
      )
    );

    bindListenerToComponent(lblStatus1, autoStarter, r update);
    /*componentPopupMenuItems(btnCancel,
      "Resume", rThread resume);*/
    ret vis;
  }
  
  void update {
    bool done = autoStarter.waitedAndDone();
    if (done)
      setText(btnCancel, "Auto-start done");
    setEnabled(lblCtrl, autoStarter.ctrlEnabled());
    setEnabled(btnCancel, autoStarter.enabled() && !done);
    setText(lblStatus1, autoStarter.scriptsRunStats());
    setText(lblStatus2, done ? "" : autoStarter.status());
    setText(lblCurrentScript, autoStarter.currentScriptStats());
    
    addOrRemoveComponent(autoStarter.canResume(), stack, btnResume);
  }
  
  void resume { autoStarter.resume(); }
}

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: 211 / 385
Version history: 34 change(s)
Referenced in: [show references]