1 | sclass SavedSessions extends Module { |
2 | transient SS sessions; |
3 | transient JTable table; |
4 | transient new Var<Bool> changed; |
5 | |
6 | void start { |
7 | sessions = new FileBasedStringMap(javaxSavedSessionsDir()); |
8 | } |
9 | |
10 | void triggerUpdate { |
11 | changed.set(true); super.triggerUpdate(); |
12 | } |
13 | |
14 | JComponent visualize() { |
15 | table = sexyTable(); |
16 | VF1<Int> restore = voidfunc(int row) { |
17 | S name = (S) getTableCell(table, row, 0); |
18 | S text = sessions.get(name); |
19 | if (text != null) |
20 | restoreModulesSession(text); |
21 | }; |
22 | tablePopupMenuItemsThreaded(table, "Restore", restore); |
23 | onDoubleClickThreaded(table, restore); |
24 | triggerUpdate(); |
25 | |
26 | ret centerAndSouthWithMargins(table, jbutton("Save session...", r { |
27 | inputText("Save session as", voidfunc(S name) { |
28 | fS text = modulesSessionGrab(); |
29 | sessions.put(or2(trim(name), "Unnamed Session") + " [" + localDateWithSeconds() + ", " + computerID() + ", OS: " + programID() + "]", text); |
30 | triggerUpdate(); |
31 | }); |
32 | })); |
33 | } |
34 | void unvisualize2() { table = null; } |
35 | |
36 | void update() { |
37 | if (atomicFlipVarToFalse(changed)) |
38 | dataToTable_uneditable(table, listToMapsWithSingleKey("Session Name", sortedKeys(sessions))); |
39 | } |
40 | } |
download show line numbers debug dex old transpilations
Travelled to 19 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jcllbfdqhrgy, lpdgvwnxivlt, mqqgnosmbjvj, omdjrrnzbjjv, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, snaazhdonpnp, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1015842 |
Snippet name: | SavedSessions (Static module) |
Eternal ID of this version: | #1015842/23 |
Text MD5: | ca2cfb85dd091b49f8d7f445f19c2d18 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-09-05 09:35:13 |
Source code size: | 1271 bytes / 40 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 517 / 3245 |
Version history: | 22 change(s) |
Referenced in: | [show references] |