sclass SavedSessions extends Module {
transient SS sessions;
transient JTable table;
transient new Var<Bool> changed;
void start {
sessions = new FileBasedStringMap(javaxSavedSessionsDir());
}
void triggerUpdate {
changed.set(true); super.triggerUpdate();
}
JComponent visualize() {
table = sexyTable();
VF1<Int> restore = voidfunc(int row) {
S name = (S) getTableCell(table, row, 0);
S text = sessions.get(name);
if (text != null)
restoreModulesSession(text);
};
tablePopupMenuItemsThreaded(table, "Restore", restore);
onDoubleClickThreaded(table, restore);
triggerUpdate();
ret centerAndSouthWithMargins(table, jbutton("Save session...", r {
inputText("Save session as", voidfunc(S name) {
fS text = modulesSessionGrab();
sessions.put(or2(trim(name), "Unnamed Session") + " [" + localDateWithSeconds() + ", " + computerID() + ", OS: " + programID() + "]", text);
triggerUpdate();
});
}));
}
void unvisualize2() { table = null; }
void update() {
if (atomicFlipVarToFalse(changed))
dataToTable_uneditable(table, listToMapsWithSingleKey("Session Name", sortedKeys(sessions)));
}
}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: | 1072 / 3776 |
| Version history: | 22 change(s) |
| Referenced in: | [show references] |