Libraryless. Click here for Pure Java version (17662L/125K).
1 | !7 |
2 | |
3 | srecord Entry(S text, S annotations, S guess) { |
4 | LS annotations() { ret tok_splitAtComma_emptyOnEmpty(annotations); } |
5 | } |
6 | |
7 | /*c*/module QuickAnnotator > DynObjectTable<Entry> { |
8 | start { |
9 | //set withSearcher; // TODO: edits the wrong line on double click |
10 | addCountToName(); |
11 | } |
12 | |
13 | afterVisualize { |
14 | tablePopupMenuItemAndDoubleClick(table, "Edit annotations...", voidfunc(int row) { |
15 | Entry e = getRow(row); |
16 | if (e == null) ret; |
17 | JTextField tf = jTextField(e.annotations); |
18 | showFormTitled("Edit annotations", |
19 | "Line", e.text, |
20 | "Annotations (comma-separated)", tf, r { |
21 | e.annotations = gtt(tf); |
22 | fireDataChanged(); |
23 | }); |
24 | }); |
25 | } |
26 | |
27 | IntRange visibleRows() { ret jTable_visibleRows(table); } |
28 | |
29 | // API |
30 | |
31 | void fillData(Collection<PairS> l) { |
32 | setList(map(l, p -> nu Entry(text := p.a, annotations := p.b))); |
33 | } |
34 | |
35 | void fillData(SS map) { |
36 | fillData(mapToPairs(map)); |
37 | } |
38 | |
39 | void setItems(Collection<S> l) { |
40 | fillData(map(l, s -> pair(s, ""))); |
41 | } |
42 | |
43 | Set<S> allAnnotations() { |
44 | Set<S> set = ciSet(); |
45 | for (Entry e : data()) |
46 | _addAll(set, e.annotations()); |
47 | ret set; |
48 | } |
49 | } |
Began life as a copy of #1024168
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024172 |
Snippet name: | Quick Annotator with guess field |
Eternal ID of this version: | #1024172/20 |
Text MD5: | e89afded245684a442476afdd7e65fae |
Transpilation MD5: | a16b4617b1338175afdb96d8e5f723cf |
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: | 2019-07-24 23:32:18 |
Source code size: | 1223 bytes / 49 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 288 / 767 |
Version history: | 19 change(s) |
Referenced in: | [show references] |