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

!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);
      setComponent(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);
      }))));
    }
  }
}

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: 375 / 629
Version history: 15 change(s)
Referenced in: [show references]