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

23
LINES

< > BotCompany Repo | #1004416 // showFileAsTable (and update when file changes)

JavaX fragment (include)

1  
// updateFrequency = check file every x seconds
2  
static JTable showFileAsTable(File file, double updateFrequency, O dataMakingFunction) {
3  
  ret showFileAsTable(null, file, updateFrequency, dataMakingFunction);
4  
}
5  
6  
static JTable showFileAsTable(final JTable _table, File file, double updateFrequency, O dataMakingFunction) {
7  
  class X {
8  
    JTable table = _table;
9  
    *() {
10  
      Runnable load = r {
11  
        O data = map(func(S s) { joinLines(" / ", s) }, loadLogicList());
12  
        if (table != null)
13  
          dataToTable_uneditable(table, data);
14  
        else
15  
          table = showTable(tableWithToolTips(), data);
16  
      };
17  
      long lastMod = logicListFile().lastModified();
18  
      call(load);
19  
      awt_onFileChange(5, table, logicListFile(), lastMod, load);
20  
    }
21  
  }
22  
  ret new X().table;
23  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004416
Snippet name: showFileAsTable (and update when file changes)
Eternal ID of this version: #1004416/1
Text MD5: 2c4f3bcb93f505f2514bc2a9c343f8da
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-17 20:46:34
Source code size: 816 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 675 / 656
Referenced in: [show references]