Uses 1113K of libraries. Click here for Pure Java version (8059L/39K).
1 | !7 |
2 | |
3 | cm TaskBar_dev > DynObjectTable<S> { |
4 | S showWhat = "All modules"; |
5 | transient JLabel lblCount; |
6 | |
7 | start { |
8 | dontPersist(); |
9 | defaultAction = voidfunc(S id) { dm_showModule(id) }; |
10 | itemToMap = itemToMap_calcSingleColumn("Module", func(O mod) -> S { or2(dm_moduleName(mod), "[...]") }); |
11 | ownResource(vmBus_onModulesListChange(rstUpdate())); |
12 | rstUpdate().trigger(); |
13 | if (dm_bounds() == null) placeOnRight(); |
14 | onListChanged = syncListInitAndAdd(onListChanged, r { setText(lblCount, countText()) }); |
15 | } |
16 | |
17 | void update { |
18 | data = null; // force update |
19 | LS ids = containsWord(showWhat, "visible") ? dm_visibleModuleIDs() |
20 | : containsWord(showWhat, "invisible") ? dm_invisibleModuleIDs() |
21 | : dm_moduleIDs(); |
22 | setData(sortedByCalculatedFieldIC(func(O m) -> S { or2(dm_moduleName(m), unicodeCharacterLastInSortOrder()) }, ids)); |
23 | } |
24 | |
25 | visualize { |
26 | JComponent theTable = super.visualize(); |
27 | |
28 | // TODO: filter these |
29 | for (final Pair<S, VF1<O>> p : dm_moduleMenuItems()) |
30 | tablePopupMenuItem(table, |
31 | p.a, voidfunc(final int row) { thread { callF(p.b, _get(data, row)); } }); |
32 | |
33 | tablePopupMenu(table, voidfunc(JPopupMenu menu, int row) { |
34 | O mod = _get(data, row); |
35 | Container frame = dm_frame(mod); |
36 | if (frame cast JInternalFrame) { |
37 | copyInternalFramePopupMenu(menu, frame); |
38 | var titlePane = internalFrameTitleComponent(frame); |
39 | if (titlePane != null) |
40 | vmBus_send showingPopupMenu(titlePane, menu); |
41 | } else { |
42 | // TODO: get all the items even if module is not showing |
43 | addMenuItem(menu, "ID: " + or(dm_moduleID(mod), mod) + "/" + dm_moduleLibID(mod), null); |
44 | } |
45 | }); |
46 | onCharDown(table, voidfunc(char c) { |
47 | LS names = map dm_moduleName(data); |
48 | int cur = selectedIndex(); |
49 | int i = swic(_get(names, cur+1), str(c)) |
50 | ? cur+1 // move through items with that characters |
51 | : indexOfStartingWithIC(names, str(c)); |
52 | selectRowIfNotNegative(table, i); |
53 | }); |
54 | |
55 | ret northAndCenter( |
56 | withMargin(westAndEast( |
57 | lblCount = jlabel(countText()), |
58 | dm_fieldComboBox('showWhat, ll("All modules", "Visible modules", "Invisible modules")))), |
59 | theTable); |
60 | } |
61 | |
62 | enhanceFrame { |
63 | addTitlePopupMenuItems(f, "Place on the right", rThread placeOnRight); |
64 | } |
65 | |
66 | void placeOnRight enter { dm_placeOnRight(); } |
67 | |
68 | S countText() { |
69 | ret join(" of ", litorderedset(count(), dm_moduleCount())); |
70 | } |
71 | } |
Began life as a copy of #1019172
download show line numbers debug dex old transpilations
Travelled to 11 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, hpgrupgrauku, irmadwmeruwu, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1019954 |
Snippet name: | Task Bar v3 [vertical only] |
Eternal ID of this version: | #1019954/44 |
Text MD5: | 4eab160f71216fcd364ae43fa35ec278 |
Transpilation MD5: | 126f7591433a86596cf348c7be640f2f |
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: | 2021-08-14 01:57:12 |
Source code size: | 2548 bytes / 71 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 443 / 563965 |
Version history: | 43 change(s) |
Referenced in: | [show references] |