-
Notifications
You must be signed in to change notification settings - Fork 5
/
FormEvent.java
56 lines (48 loc) · 1.69 KB
/
FormEvent.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package org.gs.events.components;
import org.genericsystem.common.Generic;
import org.genericsystem.geography.components.InputSelectInstance;
import org.genericsystem.geography.model.City;
import org.genericsystem.reactor.annotations.Children;
import org.genericsystem.reactor.annotations.DirectSelect;
import org.genericsystem.reactor.annotations.SetText;
import org.genericsystem.reactor.annotations.Style;
import org.genericsystem.reactor.context.StringExtractor;
import org.genericsystem.reactor.gscomponents.HtmlTag.HtmlDiv;
import org.genericsystem.reactor.gscomponents.HtmlTag.HtmlLabel;
import org.gs.events.TestEvent.CityInput;
import org.gs.events.TestEvent.CityLabel;
import org.gs.events.TestEvent.Div;
import org.gs.events.TestEvent.InputDate1;
import org.gs.events.model.Date;
@Children({ CityLabel.class, CityInput.class, Div.class })
public class FormEvent extends HtmlDiv {
@SetText(value = "City")
@Style(name = "display", value = "inline")
public static class CityLabel extends HtmlLabel {
}
@DirectSelect(City.class)
@Style(name = "display", value = "inline")
public static class CityInput extends InputSelectInstance {
@Override
public String displayInstance(Generic g) {
String str = StringExtractor.SIMPLE_CLASS_EXTRACTOR.apply(g);
while (g.getBaseComponent() != null) {
g = g.getBaseComponent();
str += ", " + g.getValue();
}
return str;
}
// preselected city
@Override
public void init() {
super.init();
addPrefixBinding(context -> {
getContextProperty("selected", context).setValue(context.getGeneric().getInstance("Nantes"));
});
}
}
@DirectSelect(Date.class)
@Children(InputDate1.class)
public static class Div extends HtmlDiv {
}
}