Libraryless. Click here for Pure Java version (7110L/50K).
1 | // optional parameter sayAction: IVF1<S> |
2 | // optional parameter submitAction: IVF1<S> |
3 | static JComponent ele_renderSuggestions(S madeFromInput, Iterable<S> suggestions, O... _) {
|
4 | optPar IVF1<S> sayAction; |
5 | optPar IVF1<S> submitAction; |
6 | |
7 | ret scrollableStackWithSpacing(map(takeFirst(100, suggestions), s -> {
|
8 | JComponent c = jLabelWithButtonsAndSideMargin(s, |
9 | "+", rThread { ele_logItemFeedback(true, s, madeFromInput) },
|
10 | "-", rThread { ele_logItemFeedback(false, s, madeFromInput) },
|
11 | "Submit", rThread {
|
12 | ele_logItemFeedback(true, s, madeFromInput, button := "Submit"); |
13 | if (submitAction != null) submitAction.get(s); |
14 | else |
15 | dm_setAIBarTextAndFireWithInfo(s, "user-chosen in " + dm_moduleLibID()); |
16 | }, |
17 | "Say", rThread {
|
18 | ele_logItemFeedback(true, s, madeFromInput, button := "Say"); |
19 | callF(or(sayAction, lambda1 dm_say), s); |
20 | }); |
21 | setToolTip(findButton(c, "Submit"), "Submit as new input"); |
22 | ret c; |
23 | })); |
24 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1026807 |
| Snippet name: | ele_renderSuggestions [returns scrollable element] |
| Eternal ID of this version: | #1026807/8 |
| Text MD5: | 15e8cdd497673afd1bf4bbac7c636709 |
| Transpilation MD5: | bdd0e1191ffe9428ffbe5c0a464df8eb |
| Author: | stefan |
| Category: | javax / ele |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-07-11 13:12:51 |
| Source code size: | 1021 bytes / 24 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 583 / 731 |
| Version history: | 7 change(s) |
| Referenced in: | [show references] |