Uses 911K of libraries. Click here for Pure Java version (10826L/58K).
1 | !7 |
2 | |
3 | sclass Entry { |
4 | S item, reasoning, feedback = ""; |
5 | |
6 | sS _fieldOrder = "reasoning item feedback"; |
7 | } |
8 | |
9 | cmodule ListWithFeedback > DynObjectTable<Entry> { |
10 | S description, code, computerNotes, humanNotes, metaData, globalIDSaved; |
11 | |
12 | start { |
13 | defaultAction = voidfunc(Entry e) { |
14 | inputText("Feedback for: " + e.item, e.feedback, feedback -> { e.feedback = feedback; change(); }); |
15 | }; |
16 | } |
17 | |
18 | visual northCenterAndSouthWithMargins( |
19 | northAndCenterWithMargin( |
20 | centerAndEastWithMargin( |
21 | dm_textFieldWithLabel description(), |
22 | jThreadedButton("Save data", rEnter saveData)), |
23 | jMinHeight(70, |
24 | jhsplit(0.75, dm_textAreaWithTitle code(), dm_textAreaWithTitle computerNotes()))), |
25 | withTitle("The List", super), |
26 | withTitle("Human Notes", centerAndEastWithMargin( |
27 | jMinHeight(70, dm_textArea humanNotes()), |
28 | jNorth(jbutton("All good", r-thread { setField(humanNotes := "all good"); }))))); |
29 | |
30 | // API |
31 | |
32 | void saveData { |
33 | File dir = ai_listsWithFeedbackDir(); |
34 | setField(metaData := "Made on computer " + computerID() + " on " + localDateWithSeconds()); |
35 | S globalID = aGlobalID(); |
36 | S struct = javaTokWordWrap(dm_freshModuleStruct()); |
37 | setField(globalIDSaved := globalID); |
38 | infoBox("Saved: " + renderFileInfo(saveTextFile(newFile(dir, globalID + ".struct"), struct))); |
39 | } |
40 | |
41 | // takes a list of strings or pairs (item + reasoning) |
42 | void importItems(L l) { |
43 | setData(map(l, o -> { |
44 | o = quickImport(o); |
45 | if (o cast Pair) ret nu Entry(item := o.a, reasoning := o.b); |
46 | if (o cast WithReasoning) ret nu Entry(item := str(o!), reasoning := o.reasoning); |
47 | ret nu Entry(item := str(o)); |
48 | })); |
49 | } |
50 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1026559 |
Snippet name: | List With Feedback |
Eternal ID of this version: | #1026559/30 |
Text MD5: | d0d5d64ade8f680a25baf2da473db3d2 |
Transpilation MD5: | c26a95c78a36594646fbd657605798eb |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-02-20 14:25:34 |
Source code size: | 1741 bytes / 50 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 441 / 1273 |
Version history: | 29 change(s) |
Referenced in: | [show references] |