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).

!7

static JTable table;
static L<File> dataDirectories;
static L l;

p-substance {
  table = showTable(ll(), "Data Directories");
  final SingleThread updater = awtCalcEvery(table, 1000, 0, "update");
  tablePopupMenuItem(table, "Update", r {
    dataDirectories = null;
    updater.go("update")
  });
  hideConsole();
}

svoid update {
  L<File> dd = listDirs(javaxDataDir()); // list everything
  if (neq(dd, dataDirectories))
    render(dd);
}

svoid render(L<File> dataDirectories) {
  //print("Update.");
  titleStatus(table, "Updating...");
  main.dataDirectories = dataDirectories;
  new L l;
  for (File dir : dataDirectories) {
    S name = dir.getName();
    l.add(litmap("Program", name, "Program name", isSnippetID(name) ? getSnippetTitle_cached(name) : "", "Files", numFiles(dir), "Data Size", toK(directorySize(dir)) + " K"));
  }
  l = sortByCalculatedField(l, func(Map m) { parseSnippetIDOpt(getString(m, "Program")) });
  showTable(table, main.l = l);
  noTitleStatus(table);
}

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: 660 / 732
Version history: 15 change(s)
Referenced in: #1001728 - #1001724 - List data directories
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)