1 | abstract sclass DynBigNumber extends DynModule { |
2 | S description; |
3 | O value; |
4 | int fontSize = 40; |
5 | S toolTip; |
6 | |
7 | transient JLabel label; |
8 | transient SimpleLiveValue<S> lvText = new(S); |
9 | transient SimpleLiveValue<S> lvDesc = new(S); |
10 | |
11 | // PUBLIC API |
12 | |
13 | // any Number, or anything persistable with toString |
14 | bool setValue(O value) { |
15 | bool changed = setField(+value); |
16 | makeTexts(); |
17 | ret changed; |
18 | } |
19 | |
20 | void setDescription(S desc) { |
21 | setField('description, desc); |
22 | makeTexts(); |
23 | } |
24 | |
25 | O getValue() { ret value; } |
26 | S getDescription() { ret description; } |
27 | void setToolTip(S toolTip) { setField(+toolTip); } |
28 | |
29 | void doPersist() { |
30 | _persistenceInfo = mapMinusOrNull(_persistenceInfo, 'value); |
31 | } |
32 | |
33 | // END PUBLIC API |
34 | |
35 | void makeTexts() { |
36 | lvText.set(value == null ? "-" : str(value)); |
37 | lvDesc.set(description); |
38 | } |
39 | |
40 | start { |
41 | _persistenceInfo = mapPlus(_persistenceInfo, value := false); |
42 | makeTexts(); |
43 | } |
44 | |
45 | visualize { |
46 | ret bindToolTipToLiveValue(dm_fieldLiveValue('toolTip), |
47 | jLiveValueSection(lvDesc, |
48 | centerLabel(makeBold(setFontSize(fontSize, label = jLiveValueLabel(lvText)))))); |
49 | } |
50 | } |
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1015897 |
Snippet name: | DynBigNumber - does not persist the value by default |
Eternal ID of this version: | #1015897/22 |
Text MD5: | cf273ad976fc8403d2bc97bf3a7ff706 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-04-01 15:25:12 |
Source code size: | 1206 bytes / 50 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 470 / 1147 |
Version history: | 21 change(s) |
Referenced in: | [show references] |