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

23
LINES

< > BotCompany Repo | #1016065 // DynTable

JavaX fragment (include)

abstract sclass DynTable extends DynModule {
  transient JTable table;
  transient L<Map> data;

  JComponent visualize() {
    table = dataToTable_uneditable(sexyTable(), data = calc());
    onDoubleClickOrEnter(table, voidfunc(int row) {
      Map line = _get(data, row);
      if (line != null) onDoubleClick(line);
    });
    ret table;
  }
  void unvisualize() { table = null; }
  
  void onDoubleClick(Map line) {}
  
  void update() {
    if (table != null) dataToTable_uneditable(table, data = calc());
  }

  // should cache results if they are expensive to make
  abstract L<Map> calc();
}

Author comment

Began life as a copy of #1015977

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1016065
Snippet name: DynTable
Eternal ID of this version: #1016065/9
Text MD5: d4cc26b4c748f45784d4c3d2b5d81f90
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-23 15:42:26
Source code size: 624 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 515 / 1051
Version history: 8 change(s)
Referenced in: [show references]