Uses 911K of libraries. Click here for Pure Java version (10631L/56K).
1 | !7 |
2 | |
3 | sclass NamedList { |
4 | S name; |
5 | L<S> lines; |
6 | } |
7 | |
8 | cmodule SomeObjects > DynObjectTable<NamedList> { |
9 | S globalID = aGlobalID(); |
10 | L<NamedList> lists = synchroList(); |
11 | |
12 | transient SingleComponentPanel scp; |
13 | |
14 | start { |
15 | itemToMap = func(NamedList l) -> Map { litorderedmap("Name" := l.name, lines := l(l.lines)) }; |
16 | defaultAction = voidfunc(final NamedList l) { |
17 | final SimpleLiveValue<S> lvText = stringLiveValue(lines(l.lines)); |
18 | lvText.onChange(dm_rstWithPostDelay(module(), 1000, r { l.lines = lines(lvText!); blubberblub; })); |
19 | setSCPComponent(scp, jSection("List: " + l.name, focusOnShow(jLiveValueWordWrapTypeWriterTextArea_bothWays(lvText)))); |
20 | }; |
21 | blubberblub; |
22 | } |
23 | |
24 | void onPersisted { |
25 | saveTextFile(javaxDataDir("Some Lists/" + globalID + ".struct"), dm_persistenceStruct()); |
26 | } |
27 | |
28 | void blubberblub { setData_force(lists); } |
29 | |
30 | visualize { |
31 | JComponent c = super.visualize(); |
32 | ret jhsplit(withCenteredButtonsOnTop(c, |
33 | "Add list..." := rThread { |
34 | inputText("Name of new list", voidfunc(S name) { |
35 | NamedList l = nu(NamedList, +name); |
36 | lists.add(l); blubberblub; |
37 | doubleClickItem(l); |
38 | }); |
39 | }, |
40 | tableDependentButton(table, "Delete" := rThread { |
41 | logQuoted(javaxDataDir("Some Lists/" + globalID + ".deleted"), struct(selected())); |
42 | lists.remove(selected()); setSCPComponent(scp, emptyContent()); blubberblub; |
43 | }) |
44 | ), scp = singleComponentPanel(emptyContent())); |
45 | } |
46 | |
47 | JComponent emptyContent() { ret jSection("Content"); } |
48 | |
49 | enhanceFrame { |
50 | titlePopupMenuItems(f, "Backup in: " + f2s(javaxDataDir("Some Lists/" + globalID + ".*"))); |
51 | } |
52 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1019415 |
Snippet name: | Some Lists |
Eternal ID of this version: | #1019415/30 |
Text MD5: | 3fde2c452e8778acc85b2fe0a305f12b |
Transpilation MD5: | c346fafac3175b2a1ffbe12416195c93 |
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: | 2020-01-26 22:35:32 |
Source code size: | 1724 bytes / 52 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 444 / 2003 |
Version history: | 29 change(s) |
Referenced in: | [show references] |