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

37
LINES

< > BotCompany Repo | #1026670 // ELESuggester

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

Libraryless. Click here for Pure Java version (11766L/85K).

1  
// TODO: what if module is hidden & shown again
2  
abstract sclass ELESuggester > DynSCP {
3  
  transient LS suggestions;
4  
  transient S madeFromInput;
5  
  transient bool processInitialInput;
6  
  
7  
  start-thread {
8  
    init();
9  
    if (processInitialInput)
10  
      ele_onInputAndNow(lambda1 process);
11  
    else
12  
      ele_onInput(lambda1 process);
13  
    dm_registerAs eleSuggester();
14  
  }
15  
  
16  
  void init {}
17  
  
18  
  Pt minimumSize() { ret pt(300, 300); }
19  
  
20  
  // override me
21  
  void process_impl(S input) {}
22  
23  
  void process(S input) q { 
24  
    temp enter(); // TODO: Why is module not set by q?
25  
    process_impl(input);
26  
  }
27  
  
28  
  void showSuggestions(S madeFromInput, Iterable<S> l) {
29  
    setField(+madeFromInput);
30  
    if (setField(suggestions := takeFirst(100, l)))
31  
      setComponent(ele_renderSuggestions(madeFromInput, suggestions));
32  
  }  
33  
  
34  
  // API
35  
  
36  
  LS suggestions() { ret suggestions; }
37  
}

Author comment

Began life as a copy of #1026654

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: #1026670
Snippet name: ELESuggester
Eternal ID of this version: #1026670/24
Text MD5: d1b7f4f0e24c8295754e9dc843bc24dd
Transpilation MD5: 97be9820ffb435a2e69162cbc8c2af81
Author: stefan
Category: javax / ele
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-23 17:33:53
Source code size: 908 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 238 / 692
Version history: 23 change(s)
Referenced in: [show references]