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).

// 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<S> l) {
    setField(+madeFromInput);
    if (setField(suggestions := takeFirst(100, l)))
      setComponent(ele_renderSuggestions(madeFromInput, suggestions));
  }  
  
  // API
  
  LS suggestions() { ret suggestions; }
}

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