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

23
LINES

< > BotCompany Repo | #1015977 // DynCalculatedList

JavaX fragment (include)

abstract sclass DynCalculatedList extends DynModule {
  transient JList list;
  transient L<S> results;
  transient bool calculateWhenHidden;

  visualize { ret list = jlist(calc()); }
  void unvisualize() { list = null; }  
  void update() {
    temp enter();
    if (list != null || calculateWhenHidden)
      fillListWithStrings(list, results = calc());
  }

  // Note: This is called on every update, so you should cache
  // results IN the calc function if they are expensive to make
  abstract L<S> calc();
  
  void scrollDown {
    scrollAllTheWayDown(list);
  }
  
  S selected() { ret selectedItem(list); }
}

Author comment

Began life as a copy of #1015929

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1015977
Snippet name: DynCalculatedList
Eternal ID of this version: #1015977/16
Text MD5: b555af5aa62cdef533a1df7628de0b1e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-01-02 17:08:17
Source code size: 642 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 495 / 3215
Version history: 15 change(s)
Referenced in: #1016065 - DynTable
#1019849 - Loadable Utils
#1029927 - Loadable Utils v2 (old)
#1030952 - Loadable Utils for Gazelle BEA [LIVE, see #1030953, edited by #1030951]
#1031186 - Loadable Utils v5
#1032272 - Loadable Utils for Gazelle BEA [backup]
#1032708 - Secret BEA Utils [purposely different from regular utils]
#1033505 - Loadable Utils for Gazelle V [stable version]
#1033861 - Loadable Utils for Gazelle 22 [dev version]
#1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)