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

43
LINES

< > BotCompany Repo | #1019153 // Module Inspector v2 [the Jester, dev., shows properties]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (15149L/109K).

1  
!7
2  
3  
module ModuleInspector > DynSCP {
4  
  S moduleIDAndName;
5  
  
6  
  visualize {
7  
    JComponent c = northAndCenterWithMargins(
8  
      withCenteredTitle("Module to inspect:",
9  
        dm_moduleSelectorComboBox(dm_fieldLiveValue('moduleIDAndName))),
10  
      super.visualize());
11  
    update();
12  
    ret c;
13  
  }
14  
  
15  
  L<AbstractAction> menuItems() {
16  
    ret ll(abstractAction("Update", r update));
17  
  }
18  
  
19  
  void update {
20  
    fO module = dm_getModule(firstIntAsString(moduleIDAndName));
21  
    if (module == null)
22  
      setComponent(jCenteredGoogledImage("Jester"));
23  
    else {
24  
      L<Field> fields = allFieldObjects(module);
25  
      JComponent form1 = makeForm(pairsToParams(map(fields, func(Field f) -> Pair<O> {
26  
        O value = f.get(module);
27  
        S s = "";
28  
        if (value != null) pcall {
29  
          LS info = quickValueInformation_list(value);
30  
          if (value cast S) {
31  
            info.remove("lines=1");
32  
            s = "[" + joinWithComma(info) + "] " + quote(shorten(value, 80));
33  
          } else if (value instanceof Bool || value instanceof Number)
34  
            s = str(value);
35  
          else
36  
            s = joinWithComma(itemPlusList(className(value), info));
37  
        }
38  
        ret (Pair) pair(jLabel(f.getName()), s);
39  
      })));
40  
      setComponent(jtabs(Properties := form1, Methods := jpanel()));
41  
    }
42  
  }
43  
}

Author comment

Began life as a copy of #1019121

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019153
Snippet name: Module Inspector v2 [the Jester, dev., shows properties]
Eternal ID of this version: #1019153/7
Text MD5: 301a9b7cd54e16a66b5f9744013a7d30
Transpilation MD5: 50999c0271c14096e40f9353a66e6091
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-06 18:24:26
Source code size: 1354 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 420 / 1623
Version history: 6 change(s)
Referenced in: [show references]