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

47
LINES

< > BotCompany Repo | #1005265 // Show concepts of a program in tabs [works]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (24936L/155K).

!7

sS progID = "#1005522";
static int maxLineLength = 500;
static int maxConceptsPerTab = /*100*/10000;

concepts.

static JFrame frame;
static JTabbedPane tabs;

p {
  if (nempty(args)) progID = fsI(args[0]);
  //substance();
  update();
}

svoid update {
  //setOptAllDyn_debug = true;
  loadConceptsFrom(progID);
  print("Have " + n(l(allConcepts()), "concepts"));
  final Map<S, S> map = litorderedmap();
  for (S name : allConceptNames()) {
    //print("Searching " + name);
    L<Concept> concepts = conceptsOfType(name);
    int n = l(concepts);
    bool more = n > maxConceptsPerTab;
    concepts = shortenList(concepts, maxConceptsPerTab);
    print("Rendering " + name + " (" + l(concepts) + ")");
    if (nempty(concepts)) {
      Concept c = first(concepts);
      //printStruct(conceptFields(c));
      //printStruct(keys(c.fieldValues));
    }
    S text = fromLines(map(concepts, func(Concept c) { shorten(renderConcept(c), maxLineLength) }));
    if (more) text += "\n...";
    map.put(name + " (" + l(concepts) + (more ? "/" + n : "") + ")", text);
  }
  awt {
    new L l;
    if (tabs != null) l.add(tabs.getSelectedIndex());
    for (S name : keys(map))
      l.addAll(ll(name, new JTextArea(map.get(name))));
    frame = showFrame("Concepts of " + snippetWithTitle(progID), tabs = jtabs(l), frame);
    addToWindow(frame, jbutton("update", "update"));
  }
}

Author comment

Began life as a copy of #1005262

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005265
Snippet name: Show concepts of a program in tabs [works]
Eternal ID of this version: #1005265/7
Text MD5: 3191d789bec84f92bcda412b285c8294
Transpilation MD5: a06069194c5089a22a389cb998b6df40
Author: stefan
Category: javax / concepts / gui
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-01-12 17:38:12
Source code size: 1425 bytes / 47 lines
Pitched / IR pitched: No / No
Views / Downloads: 623 / 1618
Version history: 6 change(s)
Referenced in: [show references]