Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

24
LINES

< > BotCompany Repo | #1034433 // FieldVar - variable representing a field

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (9667L/53K).

1  
sclass FieldVar<A> extends VarWithNotify<A> {
2  
  IHasChangeListeners containingObject;
3  
  S fieldName;
4  
  IF0<A> getter;
5  
  IVF1<A> setter;
6  
7  
  *(IHasChangeListeners *containingObject,
8  
    S *fieldName, IF0<A> *getter, IVF1<A> *setter) {
9  
    containingObject.onChangeAndNow(l0 _updateFromObject);
10  
  }
11  
  
12  
  void _updateFromObject {
13  
    set(getter!);
14  
  }
15  
  
16  
  public void fireChange :: before {
17  
    setter.get(get());
18  
  }
19  
  
20  
  public selfType onChange(IVF1<A> r) {
21  
    if (r != null) onChange(-> r.get(get()));
22  
    this;
23  
  }
24  
}

Author comment

Began life as a copy of #1034091

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034433
Snippet name: FieldVar - variable representing a field
Eternal ID of this version: #1034433/8
Text MD5: 8f740bb149d5179165e2b9ed0a00bd54
Transpilation MD5: bfff7f3c728e323d4e9a4f99ca214056
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-12 23:05:37
Source code size: 542 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 219 / 322
Version history: 7 change(s)
Referenced in: [show references]