-
Notifications
You must be signed in to change notification settings - Fork 5
/
GSCheckBoxWithValue.java
35 lines (27 loc) · 1.17 KB
/
GSCheckBoxWithValue.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package org.genericsystem.reactor.gs;
import java.io.Serializable;
import org.genericsystem.common.Generic;
import org.genericsystem.reactor.Model.TriFunction;
import org.genericsystem.reactor.ReactorStatics;
import org.genericsystem.reactor.gstag.GSCheckBox;
public class GSCheckBoxWithValue extends GSCheckBox {
public GSCheckBoxWithValue(GSTag parent) {
super(parent);
createNewProperty(ReactorStatics.VALUE);
bindOptionalBiDirectionalAttribute(ReactorStatics.VALUE, ReactorStatics.CHECKED, ReactorStatics.CHECKED);
}
public static class GSCheckBoxEditor extends GSCheckBoxWithValue {
public GSCheckBoxEditor(GSTag parent) {
super(parent);
initProperty(ReactorStatics.VALUE, model -> (Boolean) model.getGeneric().getValue());
bindActionToValueChangeListener(ReactorStatics.VALUE, (model, nva) -> model.getGeneric().updateValue(nva));
}
}
public static class GSCheckBoxCreator extends GSCheckBoxWithValue {
public GSCheckBoxCreator(GSTag parent) {
super(parent);
createNewProperty(ReactorStatics.ACTION);
this.<TriFunction<Generic[], Serializable, Generic, Generic>> initProperty(ReactorStatics.ACTION, (gs, value, g) -> g.setHolder(gs[0], value));
}
}
}