-
Notifications
You must be signed in to change notification settings - Fork 5
/
Table2.java
179 lines (158 loc) · 7.51 KB
/
Table2.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
package org.genericsystem.reactor.gscomponents2;
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.Select;
import org.genericsystem.reactor.annotations.SetStringExtractor;
import org.genericsystem.reactor.annotations.SetText;
import org.genericsystem.reactor.annotations.Style;
import org.genericsystem.reactor.annotations.Style.FlexDirectionStyle;
import org.genericsystem.reactor.annotations.Style.GenericValueBackgroundColor;
import org.genericsystem.reactor.annotations.Style.ReverseFlexDirection;
import org.genericsystem.reactor.context.StringExtractor;
import org.genericsystem.reactor.context.ContextAction.REMOVE;
import org.genericsystem.reactor.context.ContextAction.SET_SELECTION;
import org.genericsystem.reactor.context.ObservableListExtractor.ATTRIBUTES_OF_INSTANCES;
import org.genericsystem.reactor.context.ObservableListExtractor.ATTRIBUTES_OF_TYPE;
import org.genericsystem.reactor.context.ObservableListExtractor.HOLDERS;
import org.genericsystem.reactor.context.ObservableListExtractor.OTHER_COMPONENTS_1;
import org.genericsystem.reactor.context.ObservableListExtractor.OTHER_COMPONENTS_2;
import org.genericsystem.reactor.context.ObservableListExtractor.SUBINSTANCES;
import org.genericsystem.reactor.context.ObservableValueSelector.CHECK_BOX_DISPLAYER;
import org.genericsystem.reactor.context.ObservableValueSelector.LABEL_DISPLAYER;
import org.genericsystem.reactor.context.ObservableValueSelector.RELATION_SELECTOR;
import org.genericsystem.reactor.context.ObservableValueSelector.STRICT_ATTRIBUTE_SELECTOR;
import org.genericsystem.reactor.contextproperties.SelectionDefaults;
import org.genericsystem.reactor.gscomponents.CheckBoxWithValue.CheckBoxDisplayer;
import org.genericsystem.reactor.gscomponents.DivWithTitle.TitleDiv;
import org.genericsystem.reactor.gscomponents.FlexDirection;
import org.genericsystem.reactor.gscomponents.FlexDiv;
import org.genericsystem.reactor.gscomponents.HtmlTag.HtmlButton;
import org.genericsystem.reactor.gscomponents.HtmlTag.HtmlH2;
import org.genericsystem.reactor.gscomponents.HtmlTag.HtmlHyperLink;
import org.genericsystem.reactor.gscomponents.HtmlTag.HtmlLabel.GSLabelDisplayer;
import org.genericsystem.reactor.gscomponents.InstancesTable;
import org.genericsystem.reactor.gscomponents2.CellDiv.TitleLineCellDiv;
import org.genericsystem.reactor.gscomponents2.Table2.Row.Cell;
import org.genericsystem.reactor.gscomponents2.Table2.Row.Cell.SubCell;
import org.genericsystem.reactor.gscomponents2.Table2.Row.Cell.SubCell.BooleanValueSubCell;
import org.genericsystem.reactor.gscomponents2.Table2.Row.Cell.SubCell.ComponentSubCell;
import org.genericsystem.reactor.gscomponents2.Table2.Row.Cell.SubCell.ValueSubCell;
import org.genericsystem.reactor.gscomponents2.Table2.Row.RemoveButtonDiv;
import org.genericsystem.reactor.gscomponents2.Table2.Row.RemoveButtonDiv.RemoveButton;
import org.genericsystem.reactor.gscomponents2.Table2.Row.RowName;
import org.genericsystem.reactor.gscomponents2.Table2.Row.RowName.RowNameDisplayer;
import org.genericsystem.reactor.gscomponents2.Table2.TableContent;
import org.genericsystem.reactor.gscomponents2.Table2.TableTitle;
import org.genericsystem.reactor.gscomponents2.Table2.TableTitle.TableTitleContent;
import org.genericsystem.reactor.gscomponents2.Table2.TitleRow.EmptyCell;
import org.genericsystem.reactor.gscomponents2.Table2.TitleRow.TypeAttribute;
import org.genericsystem.reactor.gscomponents2.Table2.TitleRow.TypeAttribute.AttributeName;
import org.genericsystem.reactor.gscomponents2.Table2.TitleRow.TypeAttribute.RelationName;
import org.genericsystem.reactor.gscomponents2.Table2.TitleRow.TypeAttribute.RelationName.ComponentName;
import org.genericsystem.reactor.gscomponents2.Table2.TitleRow.TypeName;
@Children({ TableTitle.class, TableContent.class })
@Style(name = "flex", value = "1")
public class Table2 extends FlexDiv {
@FlexDirectionStyle(path = TableContent.class, value = FlexDirection.ROW)
public static class HorizontalTable extends Table2 {
}
@Children(TableTitleContent.class)
public static class TableTitle extends TitleDiv {
@SetStringExtractor(StringExtractor.MANAGEMENT.class)
@BindText
public static class TableTitleContent extends HtmlH2 {
}
}
@Children({ TitleRow.class, InstanceBuilder2.class, Row.class })
public static class TableContent extends FlexDiv implements SelectionDefaults {
@Override
public void init() {
bindSelection(find(Row.class));
}
}
@ReverseFlexDirection
@Style(name = "flex", value = "1")
@Children({ TypeName.class, TypeAttribute.class, EmptyCell.class })
public static class TitleRow extends FlexDiv {
@Children(GSLabelDisplayer.class)
public static class TypeName extends TitleLineCellDiv {
}
@ForEach(ATTRIBUTES_OF_TYPE.class)
@Style(name = "flex", value = "1")
@FlexDirectionStyle(FlexDirection.ROW)
@Children({ AttributeName.class, RelationName.class })
public static class TypeAttribute extends FlexDiv {
@Select(STRICT_ATTRIBUTE_SELECTOR.class)
@Children(GSLabelDisplayer.class)
public static class AttributeName extends TitleLineCellDiv {
}
@Select(RELATION_SELECTOR.class)
@Style(name = "flex", value = "1")
@FlexDirectionStyle(FlexDirection.ROW)
@Children(ComponentName.class)
public static class RelationName extends FlexDiv {
@ForEach(OTHER_COMPONENTS_1.class)
@Children(GSLabelDisplayer.class)
public static class ComponentName extends TitleLineCellDiv {
}
}
}
// EmptyCell corresponding to the “Remove” or “Add” button of other lines.
@Style(name = "flex", value = "1")
public static class EmptyCell extends InstancesTable.ButtonDiv {
}
}
@ForEach(SUBINSTANCES.class)
@ReverseFlexDirection
@Style(name = "flex", value = "1")
@Children({ RowName.class, Cell.class, RemoveButtonDiv.class })
public static class Row extends FlexDiv {
@Children(RowNameDisplayer.class)
public static class RowName extends CellDiv {
@Style(name = "flex", value = "1")
@Style(name = "color", value = "white")
@Style(name = "margin-right", value = "1px")
@Style(name = "margin-bottom", value = "1px")
@GenericValueBackgroundColor("#3393ff")
@BindText
@BindAction(SET_SELECTION.class)
public static class RowNameDisplayer extends HtmlHyperLink {
}
}
@ForEach(ATTRIBUTES_OF_INSTANCES.class)
@Children(SubCell.class)
public static class Cell extends CellDiv {
@ForEach(HOLDERS.class)
@Style(name = "flex", value = "1")
@FlexDirectionStyle(FlexDirection.ROW)
@Children({ ComponentSubCell.class, BooleanValueSubCell.class, ValueSubCell.class })
public static class SubCell extends FlexDiv {
@ForEach(OTHER_COMPONENTS_2.class)
@Children(GSLabelDisplayer.class)
public static class ComponentSubCell extends SubcellDiv {
}
@Select(CHECK_BOX_DISPLAYER.class)
@Children(CheckBoxDisplayer.class)
public static class BooleanValueSubCell extends SubcellDiv {
}
@Select(LABEL_DISPLAYER.class)
@Children(GSLabelDisplayer.class)
public static class ValueSubCell extends SubcellDiv {
}
}
}
// Button to delete the instance.
@Children(RemoveButton.class)
public static class RemoveButtonDiv extends InstancesTable.ButtonDiv {
@Style(name = "flex", value = "1")
@Style(name = "height", value = "100%")
@Style(name = "width", value = "100%")
@SetText("Remove")
@BindAction(REMOVE.class)
public static class RemoveButton extends HtmlButton {
}
}
}
}