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

35
LINES

< > BotCompany Repo | #1001724 // List data directories (Swing)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Uses 3874K of libraries. Click here for Pure Java version (3831L/27K/103K).

1  
!7
2  
3  
static JTable table;
4  
static L<File> dataDirectories;
5  
static L l;
6  
7  
p-substance {
8  
  table = showTable(ll(), "Data Directories");
9  
  final SingleThread updater = awtCalcEvery(table, 1000, 0, "update");
10  
  tablePopupMenuItem(table, "Update", r {
11  
    dataDirectories = null;
12  
    updater.go("update")
13  
  });
14  
  hideConsole();
15  
}
16  
17  
svoid update {
18  
  L<File> dd = listDirs(javaxDataDir()); // list everything
19  
  if (neq(dd, dataDirectories))
20  
    render(dd);
21  
}
22  
23  
svoid render(L<File> dataDirectories) {
24  
  //print("Update.");
25  
  titleStatus(table, "Updating...");
26  
  main.dataDirectories = dataDirectories;
27  
  new L l;
28  
  for (File dir : dataDirectories) {
29  
    S name = dir.getName();
30  
    l.add(litmap("Program", name, "Program name", isSnippetID(name) ? getSnippetTitle_cached(name) : "", "Files", numFiles(dir), "Data Size", toK(directorySize(dir)) + " K"));
31  
  }
32  
  l = sortByCalculatedField(l, func(Map m) { parseSnippetIDOpt(getString(m, "Program")) });
33  
  showTable(table, main.l = l);
34  
  noTitleStatus(table);
35  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001724
Snippet name: List data directories (Swing)
Eternal ID of this version: #1001724/16
Text MD5: cba231ae7d9c46c73e6a82fc23bdb176
Transpilation MD5: f93a38a77445e775d22cbcb67299e774
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-02-02 21:55:40
Source code size: 1029 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 607 / 659
Version history: 15 change(s)
Referenced in: [show references]