!7 concept Definition { S word, definition; } module Definitions > DynCRUD { *() { super(Definition); } afterVisualize { replaceComponent(crud.tableSearcher.tfInput, func(JComponent c) -> JComponent { centerAndEastWithMargin(c, jbutton("Define...", rThread { define(searchTerm()) })) }); onEnter(crud.tableSearcher.tfInput, rThread { define(searchTerm()) }); } void define(fS term) enter { final JTextField tfWord = jtextfield(or2(term, dm_topInput())), tfDefinition = jtextfield(); showFormTitled("Add Definition", "Word/Phrase:", tfWord, "Definition:", tfDefinition, rThread { S word = gtt(tfWord), definition = gtt(tfDefinition); uniq_sync(Definition, +word, +definition); }); focus(nempty(term) ? tfDefinition : tfWord); } // API LS getDefinitions(S word) { ret collect('definition, conceptsWhereIC(Definition, +word)); } void importText(S text) { for (S s : tlft(text)) { LS l = tok_splitAtFirstSpacedDash(s); if (l(l) == 5) uniq_sync(Definition, word := l.get(1), definition := l.get(3)); } } }