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

42
LINES

< > BotCompany Repo | #1019121 // Module Inspector [basically OK, but doesn't notice new modules without reload]

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

Libraryless. Click here for Pure Java version (15087L/108K).

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  
      setComponent(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  
    }
41  
  }
42  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1019121
Snippet name: Module Inspector [basically OK, but doesn't notice new modules without reload]
Eternal ID of this version: #1019121/16
Text MD5: dedafd1faebbeb171cd7aab2a44df156
Transpilation MD5: 0fc7bf4eb7ff189b4279d526c6643b09
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-10-25 13:20:32
Source code size: 1279 bytes / 42 lines
Pitched / IR pitched: No / No
Views / Downloads: 308 / 542
Version history: 15 change(s)
Referenced in: [show references]