Uses 2164K of libraries. Click here for Pure Java version (67635L/360K).
1 | srecord noeq G22VariablesPanel is Swingable { |
2 | settable G22Utils g22utils; |
3 | settable bool compactView; |
4 | settable double updateInterval = 1.0; |
5 | |
6 | transient SimpleCRUD_v2<G22Variable> crud; |
7 | transient SingleComponentPanel scpDetail; |
8 | transient ReliableSingleThread rstUpdateDetail = rst(l0 _updateDetail); |
9 | |
10 | SimpleCRUD_v2<G22Variable> crud() { |
11 | if (crud == null) { |
12 | crud = new SimpleCRUD_v2<>(g22utils.concepts(), G22Variable); |
13 | crud.updateInterval(updateInterval); |
14 | } |
15 | ret crud; |
16 | } |
17 | |
18 | cachedVisualize { |
19 | crud().iconButtons(true); |
20 | crud.entityName = -> "Variable"; |
21 | crud.renderValue = l1 strOrNull; // no huge images (e.g. live feed) in variables table - too slow! |
22 | //if (compactView) crud.hideField("persistent"); |
23 | |
24 | crud.itemToMap_inner2 = var -> { |
25 | var map = crud.itemToMap_inner2_base(var); |
26 | if (var.big()) |
27 | map.put("Size on disk" := str_toKB(var.bigFile())); |
28 | ret map; |
29 | }; |
30 | |
31 | var vis = jCenteredSection("Project Variables", crud.visualize()); |
32 | |
33 | var cbPauseUpdates = jCheckBox("Pause updates"); |
34 | onChange(cbPauseUpdates, -> crud.pauseUpdates(isChecked(cbPauseUpdates))); |
35 | crud.addButton(cbPauseUpdates); |
36 | |
37 | IVF1<G22Variable> rUpdate = v -> crud.update(); |
38 | bindToComponent(vis, |
39 | -> g22utils.onBigVariableLoaded(rUpdate), |
40 | -> g22utils.removeBigVariableLoadedListener(rUpdate)); |
41 | |
42 | if (compactView) ret vis; |
43 | |
44 | crud.onSingleSelectionChanged(rstUpdateDetail); |
45 | |
46 | scpDetail = scp(); |
47 | ret jvsplit(vis, scpDetail); |
48 | } |
49 | |
50 | void updateCount { crud().update(); } |
51 | void setSelected(G22Variable var) { crud().setSelected(var); } |
52 | |
53 | void _updateDetail { |
54 | var var = crud.selected(); |
55 | if (var == null) ret with scpDetail.clear(); |
56 | |
57 | O value = var.value(); |
58 | var vis = new G22JavaObjectVisualizer(g22utils, value).visualize(); |
59 | bindChangeListenerToComponent(vis, var.varValue(), -> { |
60 | if (!eq(var.value(), value)) |
61 | rstUpdateDetail!; |
62 | }); |
63 | |
64 | scpDetail.set(jCenteredSection("Variable " + var.name, vis)); |
65 | } |
66 | } |
Began life as a copy of #1034599
download show line numbers debug dex old transpilations
Travelled to 5 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj, wnsclhtenguj
No comments. add comment
Snippet ID: | #1034712 |
Snippet name: | G22VariablesPanel |
Eternal ID of this version: | #1034712/26 |
Text MD5: | 6b39b07a6ed53fdcfc19dfe40b396928 |
Transpilation MD5: | 5bd06789949246f350f6c309eb2af307 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2023-01-17 18:43:31 |
Source code size: | 2134 bytes / 66 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 248 / 459 |
Version history: | 25 change(s) |
Referenced in: | [show references] |