-
Notifications
You must be signed in to change notification settings - Fork 5
/
CarColorApp2.java
89 lines (79 loc) · 3.83 KB
/
CarColorApp2.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
87
88
89
package org.genericsystem.carcolor;
import org.genericsystem.reactor.htmltag.HtmlButton;
import org.genericsystem.reactor.htmltag.HtmlH1;
import org.genericsystem.reactor.htmltag.HtmlImg;
import org.genericsystem.reactor.gscomponents.FlexDirection;
import org.genericsystem.reactor.gscomponents.GSApp;
import org.genericsystem.reactor.gscomponents.GSDiv;
import org.genericsystem.reactor.gscomponents3.DivWithTitle.TitledInstancesTable;
import org.genericsystem.reactor.gscomponents3.Modal.ModalEditor;
import org.genericsystem.reactor.gscomponents3.Monitor;
import org.genericsystem.reactor.gscomponents3.Responsive;
import org.genericsystem.carcolor.CarColorApp.CarColorScript;
import org.genericsystem.carcolor.CarColorApp2.PageHeader;
import org.genericsystem.carcolor.model.Car;
import org.genericsystem.carcolor.model.CarColor;
import org.genericsystem.carcolor.model.Color;
import org.genericsystem.carcolor.model.Power;
import org.genericsystem.reactor.annotations.Attribute;
import org.genericsystem.reactor.annotations.Children;
import org.genericsystem.reactor.annotations.DependsOnModel;
import org.genericsystem.reactor.annotations.DirectSelect;
import org.genericsystem.reactor.annotations.RunScript;
import org.genericsystem.reactor.annotations.SetText;
import org.genericsystem.reactor.annotations.Style;
import org.genericsystem.reactor.annotations.Style.FlexDirectionStyle;
import org.genericsystem.reactor.appserver.ApplicationServer;
@RunScript(CarColorScript.class)
@DependsOnModel({ Car.class, Power.class, Color.class, CarColor.class })
@Style(name = "background-color", value = "#00afeb")
@Children({ ModalEditor.class, PageHeader.class, Responsive.class, Monitor.class })
@Children(path = Responsive.class, value = { TitledInstancesTable.class, TitledInstancesTable.class })
@DirectSelect(path = { Responsive.class, TitledInstancesTable.class }, pos = { 0, 0 }, value = Car.class)
@DirectSelect(path = { Responsive.class, TitledInstancesTable.class }, pos = { 0, 1 }, value = Color.class)
public class CarColorApp2 extends GSApp {
public static void main(String[] mainArgs) {
ApplicationServer.startSimpleGenericApp(mainArgs, CarColorApp2.class, "/cars");
}
@Style(name = "justify-content", value = "space-around")
@Style(name = "padding", value = "10px")
@FlexDirectionStyle(FlexDirection.ROW)
@Children({ Logo.class, TitleDiv.class, UserGuideButtonDiv.class })
public static class PageHeader extends GSDiv {
}
@FlexDirectionStyle(FlexDirection.ROW)
@Style(name = "flex", value = "0 1 auto")
@Style(name = "align-items", value = "center")
@Children(HtmlImg.class)
@Attribute(path = HtmlImg.class, name = "src", value = "logoTransp.png")
@Attribute(path = HtmlImg.class, name = "alt", value = "logo")
@Style(path = HtmlImg.class, name = "height", value = "auto")
@Style(path = HtmlImg.class, name = "width", value = "150px")
public static class Logo extends GSDiv {
}
@FlexDirectionStyle(FlexDirection.ROW)
@Style(name = "justify-content", value = "center")
@Style(name = "flex", value = "3")
@Style(name = "align-items", value = "center")
@Style(name = "color", value = "White")
@Style(name = "text-shadow", value = "1px 1px 2px black, 0 0 25px blue, 0 0 5px darkblue")
@Children(HtmlH1.class)
@SetText(path = HtmlH1.class, value = "Reactor Live Demo")
public static class TitleDiv extends GSDiv {
}
@Style(name = "justify-content", value = "center")
@Style(name = "align-items", value = "center")
@Style(name = "flex", value = "1")
@Children({ UserGuide2.class, GuideButton.class })
public static class UserGuideButtonDiv extends GSDiv {
}
@SetText("User Guide")
@Style(name = "flex", value = "0 1 auto")
public static class GuideButton extends HtmlButton {
@Override
public void init() {
inheritStyle("background-color");
bindAction(model -> getParent().find(UserGuide2.class).getDisplayProperty(model).setValue("flex"));
}
}
}