1 | static <A extends JTextComponent> A bindTextComponentToIntLiveValue(final A tc, final SimpleLiveValue<Int> lv) {
|
2 | final Var<Bool> dontRecurse = new(false); |
3 | bindLiveValueListenerToComponent(tc, lv, |
4 | r { if (!dontRecurse!) setTextKeepCaret(tc, strOrNull(lv!)) });
|
5 | onChange(tc, r {
|
6 | S s = gtt(tc); |
7 | if (isInteger(s) || empty(s)) {
|
8 | temp tempSetVar(dontRecurse, true); |
9 | lv.set(parseIntOpt(s)); |
10 | } |
11 | }); |
12 | ret tc; |
13 | } |
Began life as a copy of #1016667
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1018358 |
| Snippet name: | bindTextComponentToIntLiveValue (both ways) |
| Eternal ID of this version: | #1018358/4 |
| Text MD5: | c31ed5caab76e43151647a52aba6df63 |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-12-03 21:55:30 |
| Source code size: | 449 bytes / 13 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 577 / 623 |
| Version history: | 3 change(s) |
| Referenced in: | [show references] |