// TODO: what if module is hidden & shown again abstract sclass ELESuggester > DynSCP { transient LS suggestions; transient S madeFromInput; transient bool processInitialInput; start-thread { init(); if (processInitialInput) ele_onInputAndNow(lambda1 process); else ele_onInput(lambda1 process); dm_registerAs eleSuggester(); } void init {} Pt minimumSize() { ret pt(300, 300); } // override me void process_impl(S input) {} void process(S input) q { temp enter(); // TODO: Why is module not set by q? process_impl(input); } void showSuggestions(S madeFromInput, Iterable l) { setField(+madeFromInput); if (setField(suggestions := takeFirst(100, l))) setComponent(jscroll_trackWidth(vstackWithSpacing(map(suggestions, s -> { JComponent c = withSideMargin(jLabelWithButtons(s, "+", rThread { ele_logItemFeedback(true, s, madeFromInput) }, "-", rThread { ele_logItemFeedback(false, s, madeFromInput) }, "Say", rThread { ele_logItemFeedback(true, s, madeFromInput, button := "Say"); dm_say(s) }, "Submit", rThread { ele_logItemFeedback(true, s, madeFromInput, button := "Submit"); dm_setAIBarTextAndFireWithInfo(s, "user-chosen in " + dm_moduleLibID()); })); setToolTip(findButton(c, "Submit"), "Submit as new input"); ret c; })))); } // API LS suggestions() { ret suggestions; } }