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)

1  
sclass SystemStatus extends Module {
2  
  JComponent visualize() {
3  
    ret jSection("SYSTEM STATUS", makeBold(fontSize(25, jCenteredLiveValueLabel(systemStatus))));
4  
  }
5  
}
6  
7  
// changes the icon of all error-having modules' frames to a little flash icon
8  
sclass ErrorIcon extends Module {
9  
  void update {
10  
    for (Module m : onModules()) {
11  
      O error = m.getError();
12  
      if (error != null)
13  
        internalFrameIcon(m.vis, #1101276);
14  
    }
15  
  }
16  
}
17  
18  
sclass LastErrors extends StaticModule_CalculatedList {
19  
  L<PersistableThrowable> errors = synchroList();
20  
  int errorsToKeep = 10;
21  
  
22  
  void addError(Throwable e) {
23  
    if (e == null) ret;
24  
    addToListWithMaxSize(errors, persistableThrowable(e), errorsToKeep);
25  
    change();
26  
  }
27  
  
28  
  L<S> calc() {
29  
    ret allToString(cloneList(errors));
30  
  }
31  
}
32  
33  
sclass Debug_PrintChangedModules extends Module {
34  
  IConceptIndex idx = new IConceptIndex {
35  
    public void update(Concept c) {
36  
      print("Change in concept " + c);
37  
    }
38  
    public void remove(Concept c) {}
39  
  };
40  
  
41  
  void start() {
42  
    addConceptIndex(idx);
43  
  }
44  
  
45  
  void cleanMeUp {
46  
    removeConceptIndex(idx);
47  
  }
48  
}

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: 447 / 2986
Version history: 13 change(s)
Referenced in: [show references]