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

48
LINES

< > BotCompany Repo | #1015959 // More Standard Modules [Include]

JavaX fragment (include)

sclass SystemStatus extends Module {
  JComponent visualize() {
    ret jSection("SYSTEM STATUS", makeBold(fontSize(25, jCenteredLiveValueLabel(systemStatus))));
  }
}

// changes the icon of all error-having modules' frames to a little flash icon
sclass ErrorIcon extends Module {
  void update {
    for (Module m : onModules()) {
      O error = m.getError();
      if (error != null)
        internalFrameIcon(m.vis, #1101276);
    }
  }
}

sclass LastErrors extends StaticModule_CalculatedList {
  L<PersistableThrowable> errors = synchroList();
  int errorsToKeep = 10;
  
  void addError(Throwable e) {
    if (e == null) ret;
    addToListWithMaxSize(errors, persistableThrowable(e), errorsToKeep);
    change();
  }
  
  L<S> calc() {
    ret allToString(cloneList(errors));
  }
}

sclass Debug_PrintChangedModules extends Module {
  IConceptIndex idx = new IConceptIndex {
    public void update(Concept c) {
      print("Change in concept " + c);
    }
    public void remove(Concept c) {}
  };
  
  void start() {
    addConceptIndex(idx);
  }
  
  void cleanMeUp {
    removeConceptIndex(idx);
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 20 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, jcllbfdqhrgy, lpdgvwnxivlt, mqqgnosmbjvj, omdjrrnzbjjv, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, snaazhdonpnp, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv

No comments. add comment

Snippet ID: #1015959
Snippet name: More Standard Modules [Include]
Eternal ID of this version: #1015959/14
Text MD5: 1546a3b51d595ff97095093420ab5941
Author: stefan
Category: javax / stefan's os
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-11 15:15:48
Source code size: 1161 bytes / 48 lines
Pitched / IR pitched: No / No
Views / Downloads: 350 / 2880
Version history: 13 change(s)
Referenced in: #1015871 - Stefan's OS v2 [OK, with new dyn modules]
#1016478 - Stefan's OS v6
#1022729 - Stefan's OS v6 - copy for transpiler test
#1024932 - Stefan's OS v7 [LIVE]
#1031320 - Stefan's OS v7 [backup before allowing dynamic main classes]