Libraryless. Click here for Pure Java version (8623L/60K/204K).
1 | !7 |
2 | |
3 | concept Cat { // -egory |
4 | S a, b; |
5 | S globalID = aGlobalID(); |
6 | } |
7 | |
8 | static JTable table; |
9 | |
10 | p-substance { |
11 | conceptsAndBot(); |
12 | table = showConceptsTable(Cat, func(Cat c) { |
13 | litorderedmap("A" := c.a, "B" := c.b, "Global ID" := c.globalID) |
14 | }); |
15 | addToWindow(table, jRightAlignedLine( |
16 | jbutton("Add...", f newCat))); |
17 | } |
18 | |
19 | // f takes a concept and makes a map for display |
20 | static <A extends Concept> JTable showConceptsTable(final Class<A> cClass, final O f) { |
21 | final JTable table = showTable(); |
22 | awtOnConceptChanges(table, 1000, r { |
23 | new L<Map> data; |
24 | for (A c : list(cClass)) |
25 | addIfNotNull(data, (Map) pcallF(f, c)); |
26 | dataToTable_uneditable(data, table); |
27 | }); |
28 | ret table; |
29 | } |
30 | |
31 | svoid newCat { |
32 | final new JTextField a; |
33 | final JTextField b = jTextField("Something else"); |
34 | Runnable r = r { |
35 | cnew(Cat, a := getTextTrim(a), b := getTextTrim(b)) |
36 | }; |
37 | showFormTitled("New recognition category", |
38 | "A", a, |
39 | "B", b, r); |
40 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1006454 |
Snippet name: | Recognition Categories [dev.] |
Eternal ID of this version: | #1006454/1 |
Text MD5: | 437f72b15911cb24ad91a7dc4adecd04 |
Transpilation MD5: | db4b7f48d3cf8bfb5ea2a76df7ab98f2 |
Author: | stefan |
Category: | javax / ocr |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-01-17 15:34:00 |
Source code size: | 983 bytes / 40 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 584 / 725 |
Referenced in: | [show references] |