Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

24
LINES

< > BotCompany Repo | #1026807 // ele_renderSuggestions [returns scrollable element]

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (7110L/50K).

// optional parameter sayAction: IVF1<S>
// optional parameter submitAction: IVF1<S>
static JComponent ele_renderSuggestions(S madeFromInput, Iterable<S> suggestions, O... _) {
  optPar IVF1<S> sayAction;
  optPar IVF1<S> submitAction;
  
  ret scrollableStackWithSpacing(map(takeFirst(100, suggestions), s -> {
    JComponent c = jLabelWithButtonsAndSideMargin(s, 
      "+", rThread { ele_logItemFeedback(true, s, madeFromInput) },
      "-", rThread { ele_logItemFeedback(false, s, madeFromInput) },
      "Submit", rThread {
        ele_logItemFeedback(true, s, madeFromInput, button := "Submit");
        if (submitAction != null) submitAction.get(s);
        else
          dm_setAIBarTextAndFireWithInfo(s, "user-chosen in " + dm_moduleLibID());
      },
      "Say", rThread {
        ele_logItemFeedback(true, s, madeFromInput, button := "Say"); 
        callF(or(sayAction, lambda1 dm_say), s);
      });
    setToolTip(findButton(c, "Submit"), "Submit as new input");
    ret c;
  }));
}

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: 186 / 290
Version history: 7 change(s)
Referenced in: [show references]