1 | sclass G22DBFileBrowser { |
2 | G22Utils g22utils; |
3 | |
4 | File dir; |
5 | JObjectTable<File> table; |
6 | FileWatchService dirWatcher; |
7 | ReliableSingleThread rstUpdate = rstWithPreDelay(0.5, r _updateTable); |
8 | |
9 | *(G22Utils *g22utils) { |
10 | dir = g22utils.concepts.conceptsDir(); |
11 | } |
12 | |
13 | cachedVisualize { |
14 | table = swing(-> new JObjectTable); |
15 | table.itemToMap = file -> litorderedmap( |
16 | "Path" := nameRelativeToPhysicalSubdirectory(dirOfFile(file), dir), |
17 | "Name" := fileName(file), |
18 | "Size" := file.isDirectory() ? "Directory" : str_toK(fileSize(file)) |
19 | ); |
20 | |
21 | var tbl = table.visualize(); |
22 | bindToComponent(tbl, -> { |
23 | dirWatcher = new FileWatchService; |
24 | dirWatcher.addRecursiveListener(dir, f -> rstUpdate!); |
25 | rstUpdate!; |
26 | }, -> { dispose dirWatcher; }); |
27 | |
28 | ret withTopAndBottomMargin(jCenteredRaisedSection("Files in Project", |
29 | northAndCenterWithMargins( |
30 | withLabel("Project directory:", swing(-> new JFilePathLabel(dir).visualize())), |
31 | tbl |
32 | ) |
33 | )); |
34 | } |
35 | |
36 | void _updateTable { table.setData_force(findAllFiles(dir)); } |
37 | } |
Began life as a copy of #1034679
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034680 |
Snippet name: | G22DBFileBrowser [backup] |
Eternal ID of this version: | #1034680/1 |
Text MD5: | 508ea731ec3818400ae1c2cd9ff2bac5 |
Author: | stefan |
Category: | javax / gazelle v |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-01 21:17:52 |
Source code size: | 1118 bytes / 37 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 166 / 154 |
Referenced in: | [show references] |