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).

!7

module ModuleInspector > DynSCP {
  S moduleIDAndName;
  
  visualize {
    JComponent c = northAndCenterWithMargins(
      withCenteredTitle("Module to inspect:",
        dm_moduleSelectorComboBox(dm_fieldLiveValue('moduleIDAndName))),
      super.visualize());
    update();
    ret c;
  }
  
  L<AbstractAction> menuItems() {
    ret ll(abstractAction("Update", r update));
  }
  
  void update {
    fO module = dm_getModule(firstIntAsString(moduleIDAndName));
    if (module == null)
      setComponent(jCenteredGoogledImage("Jester"));
    else {
      L<Field> fields = allFieldObjects(module);
      JComponent form1 = makeForm(pairsToParams(map(fields, func(Field f) -> Pair<O> {
        O value = f.get(module);
        S s = "";
        if (value != null) pcall {
          LS info = quickValueInformation_list(value);
          if (value cast S) {
            info.remove("lines=1");
            s = "[" + joinWithComma(info) + "] " + quote(shorten(value, 80));
          } else if (value instanceof Bool || value instanceof Number)
            s = str(value);
          else
            s = joinWithComma(itemPlusList(className(value), info));
        }
        ret (Pair) pair(jLabel(f.getName()), s);
      })));
      setComponent(jtabs(Properties := form1, Methods := jpanel()));
    }
  }
}

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: 419 / 1622
Version history: 6 change(s)
Referenced in: [show references]