-
Notifications
You must be signed in to change notification settings - Fork 5
/
SwitchApp.java
86 lines (68 loc) · 3.17 KB
/
SwitchApp.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package org.genericsystem.quiz.app;
import org.genericsystem.common.Root;
import org.genericsystem.quiz.app.SwitchApp.SwitchAppScript;
import org.genericsystem.quiz.app.SwitchApp.SwitchDiv1;
import org.genericsystem.quiz.app.SwitchApp.SwitchDiv2;
import org.genericsystem.quiz.app.SwitchApp.SwitchDiv3;
import org.genericsystem.quiz.app.SwitchApp.SwitchDiv4;
import org.genericsystem.quiz.app.SwitchApp.SwitchDiv5;
import org.genericsystem.reactor.annotations.BindAction;
import org.genericsystem.reactor.annotations.BindText;
import org.genericsystem.reactor.annotations.Children;
import org.genericsystem.reactor.annotations.ForEach;
import org.genericsystem.reactor.annotations.RunScript;
import org.genericsystem.reactor.annotations.Step;
import org.genericsystem.reactor.annotations.Stepper;
import org.genericsystem.reactor.annotations.Switch;
import org.genericsystem.reactor.appserver.ApplicationServer;
import org.genericsystem.reactor.appserver.Script;
import org.genericsystem.reactor.context.ObservableListExtractor;
import org.genericsystem.reactor.gscomponents.Controller;
import org.genericsystem.reactor.gscomponents.HtmlTag.HtmlButton;
import org.genericsystem.reactor.gscomponents.HtmlTag.HtmlDiv;
import org.genericsystem.reactor.gscomponents.HtmlTag.HtmlLabel;
import org.genericsystem.reactor.gscomponents.RootTagImpl;
@Stepper(first = SwitchDiv1.class)
@RunScript(SwitchAppScript.class)
@Children({ SwitchDiv1.class, SwitchDiv2.class, SwitchDiv3.class, SwitchDiv4.class, SwitchDiv5.class })
public class SwitchApp extends RootTagImpl {
public static class SwitchAppScript implements Script {
@Override
public void run(Root engine) {
engine.setInstance("Car");
engine.setInstance("Color");
engine.getCurrentCache().flush();
}
}
public static void main(String[] mainArgs) {
ApplicationServer.startSimpleGenericApp(mainArgs, SwitchApp.class, "/switchapp");
}
@Children({ HtmlButton.class, HtmlLabel.class, HtmlButton.class })
@BindAction(path = HtmlButton.class, pos = { 0 }, value = Controller.PrevAction.class)
@BindAction(path = HtmlButton.class, pos = { 1 }, value = Controller.NextAction.class)
@BindText(path = HtmlButton.class, pos = { 0 }, value = Controller.PrevTextBinding.class)
@BindText(path = HtmlLabel.class, value = Controller.CountTextBinding.class)
@BindText(path = HtmlButton.class, pos = { 1 }, value = Controller.NextTextBinding.class)
@Switch(path = HtmlButton.class, pos = { 0 }, value = Controller.PrevSwitcher.class)
@Switch(path = HtmlLabel.class, value = Controller.CountTextSwitcher.class)
@Switch(path = HtmlButton.class, pos = { 1 }, value = Controller.NextSwitcher.class)
public static class StepDiv extends HtmlDiv {
}
@Step(next = SwitchDiv2.class)
public static class SwitchDiv1 extends StepDiv {
}
@Step(next = SwitchDiv3.class)
public static class SwitchDiv2 extends StepDiv {
}
@Step(next = SwitchDiv4.class)
public static class SwitchDiv3 extends StepDiv {
}
@Step(next = SwitchDiv5.class)
@ForEach(ObservableListExtractor.INSTANCES.class)
public static class SwitchDiv4 extends StepDiv {
}
@Step(next = SwitchDiv5.class)
@ForEach(ObservableListExtractor.INSTANCES.class)
public static class SwitchDiv5 extends StepDiv {
}
}