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

23
LINES

< > BotCompany Repo | #1016065 // DynTable

JavaX fragment (include)

1  
abstract sclass DynTable extends DynModule {
2  
  transient JTable table;
3  
  transient L<Map> data;
4  
5  
  JComponent visualize() {
6  
    table = dataToTable_uneditable(sexyTable(), data = calc());
7  
    onDoubleClickOrEnter(table, voidfunc(int row) {
8  
      Map line = _get(data, row);
9  
      if (line != null) onDoubleClick(line);
10  
    });
11  
    ret table;
12  
  }
13  
  void unvisualize() { table = null; }
14  
  
15  
  void onDoubleClick(Map line) {}
16  
  
17  
  void update() {
18  
    if (table != null) dataToTable_uneditable(table, data = calc());
19  
  }
20  
21  
  // should cache results if they are expensive to make
22  
  abstract L<Map> calc();
23  
}

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