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 { addCountToName(); }
|
9 | |
10 | afterVisualize {
|
11 | tablePopupMenuItemAndDoubleClick(table, "Edit annotations...", voidfunc(int row) {
|
12 | Entry e = getRow(row); |
13 | if (e == null) ret; |
14 | JTextField tf = jTextField(e.annotations); |
15 | showFormTitled("Edit annotations",
|
16 | "Line", e.text, |
17 | "Annotations (comma-separated)", tf, r {
|
18 | e.annotations = gtt(tf); |
19 | fireDataChanged(); |
20 | }); |
21 | }); |
22 | } |
23 | |
24 | IntRange visibleRows() { ret jTable_visibleRows(table); }
|
25 | |
26 | // API |
27 | |
28 | void fillData(Collection<PairS> l) {
|
29 | setList(map(l, p -> nu Entry(text := p.a, annotations := p.b))); |
30 | } |
31 | |
32 | void fillData(SS map) {
|
33 | fillData(mapToPairs(map)); |
34 | } |
35 | |
36 | void setItems(Collection<S> l) {
|
37 | fillData(map(l, s -> pair(s, ""))); |
38 | } |
39 | |
40 | Set<S> allAnnotations() {
|
41 | Set<S> set = ciSet(); |
42 | for (Entry e : data()) |
43 | _addAll(set, e.annotations()); |
44 | ret set; |
45 | } |
46 | } |
Began life as a copy of #1024172
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: | #1024186 |
| Snippet name: | Quick Annotator with guessing prelude 1 |
| Eternal ID of this version: | #1024186/1 |
| Text MD5: | b95f16d57c5dac69dc14a9f7d26d9d7a |
| 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 19:07:47 |
| Source code size: | 1144 bytes / 46 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 414 / 448 |
| Referenced in: | [show references] |