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

1  
!7
2  
3  
sS progID = "#1005522";
4  
static int maxLineLength = 500;
5  
static int maxConceptsPerTab = /*100*/10000;
6  
7  
concepts.
8  
9  
static JFrame frame;
10  
static JTabbedPane tabs;
11  
12  
p {
13  
  if (nempty(args)) progID = fsI(args[0]);
14  
  //substance();
15  
  update();
16  
}
17  
18  
svoid update {
19  
  //setOptAllDyn_debug = true;
20  
  loadConceptsFrom(progID);
21  
  print("Have " + n(l(allConcepts()), "concepts"));
22  
  final Map<S, S> map = litorderedmap();
23  
  for (S name : allConceptNames()) {
24  
    //print("Searching " + name);
25  
    L<Concept> concepts = conceptsOfType(name);
26  
    int n = l(concepts);
27  
    bool more = n > maxConceptsPerTab;
28  
    concepts = shortenList(concepts, maxConceptsPerTab);
29  
    print("Rendering " + name + " (" + l(concepts) + ")");
30  
    if (nempty(concepts)) {
31  
      Concept c = first(concepts);
32  
      //printStruct(conceptFields(c));
33  
      //printStruct(keys(c.fieldValues));
34  
    }
35  
    S text = fromLines(map(concepts, func(Concept c) { shorten(renderConcept(c), maxLineLength) }));
36  
    if (more) text += "\n...";
37  
    map.put(name + " (" + l(concepts) + (more ? "/" + n : "") + ")", text);
38  
  }
39  
  awt {
40  
    new L l;
41  
    if (tabs != null) l.add(tabs.getSelectedIndex());
42  
    for (S name : keys(map))
43  
      l.addAll(ll(name, new JTextArea(map.get(name))));
44  
    frame = showFrame("Concepts of " + snippetWithTitle(progID), tabs = jtabs(l), frame);
45  
    addToWindow(frame, jbutton("update", "update"));
46  
  }
47  
}

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