-
Notifications
You must be signed in to change notification settings - Fork 5
/
Table.java
191 lines (149 loc) · 4.83 KB
/
Table.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
180
181
182
183
184
185
186
187
188
189
190
191
package org.genericsystem.reactor.gs3;
import org.genericsystem.reactor.Context;
import org.genericsystem.reactor.annotations.Parent;
import org.genericsystem.reactor.gs.GSCheckBoxWithValue.GSCheckBoxDisplayer;
import org.genericsystem.reactor.gs.GSDiv;
import org.genericsystem.reactor.gstag.HtmlButton;
import org.genericsystem.reactor.gstag.HtmlH2;
import org.genericsystem.reactor.gstag.HtmlHyperLink;
import org.genericsystem.reactor.gstag.HtmlLabel.GSLabelDisplayer;
import org.genericsystem.reactor.model.ObservableListExtractor;
import org.genericsystem.reactor.model.StringExtractor;
import org.genericsystem.reactor.modelproperties.SelectionDefaults;
public class Table extends GSDiv implements FlexStyle, SelectionDefaults {
public static class HorizontalTable extends Table implements RowFlexStyle {
}
public static class Title extends GSDiv implements TitleStyle {
}
@Override
public void postfix() {
bindSelection(find(Row.class));
}
@Parent(Title.class)
public static class TitleContent extends HtmlH2 {
@Override
public void init() {
setStringExtractor(StringExtractor.MANAGEMENT);
bindText();
}
}
@Parent(Table.class)
public static class TitleRow extends GSDiv implements RowStyle {
}
@Parent(TitleRow.class)
public static class TypeName extends GSDiv implements TitleLineCellStyle {
}
@Parent(TypeName.class)
public static class TypeNameDisplayer extends GSLabelDisplayer {
}
@Parent(TitleRow.class)
public static class TypeAttribute extends GSDiv implements RowFlexStyle {
@Override
public void init() {
forEach(ObservableListExtractor.ATTRIBUTES_OF_TYPE);
}
}
@Parent(TypeAttribute.class)
public static class AttributeName extends GSDiv implements TitleLineCellStyle {
@Override
public void init() {
select(gs -> gs[0].getComponents().size() < 2 ? gs[0] : null);
}
}
@Parent(AttributeName.class)
public static class AttributeNameDisplayer extends GSLabelDisplayer {
}
@Parent(TypeAttribute.class)
public static class RelationName extends GSDiv implements RowFlexStyle {
@Override
public void init() {
select(gs -> gs[0].getComponents().size() >= 2 ? gs[0] : null);
}
}
@Parent(RelationName.class)
public static class ComponentName extends GSDiv implements TitleLineCellStyle {
@Override
public void init() {
forEach((ObservableListExtractor) gs -> ObservableListExtractor.COMPONENTS.apply(gs).filtered(g -> !g.equals(gs[1])));
}
}
@Parent(ComponentName.class)
public static class ComponentNameDisplayer extends GSLabelDisplayer {
}
@Parent(TitleRow.class)
public static class EmptyCell extends GSDiv implements ButtonStyle {
}
@Parent(Table.class)
public static class Row extends GSDiv implements RowStyle {
@Override
public void init() {
forEach(ObservableListExtractor.SUBINSTANCES);
}
}
@Parent(Row.class)
public static class RowName extends GSDiv implements CellStyle {
}
@Parent(RowName.class)
public static class RowNameDisplayer extends HtmlHyperLink implements RowNameStyle {
@Override
public void init() {
bindText();
bindAction(model -> getSelectionProperty(model).setValue(model));
}
}
@Parent(Row.class)
public static class Cell extends GSDiv implements CellStyle {
@Override
public void init() {
forEach(ObservableListExtractor.ATTRIBUTES_OF_INSTANCES);
}
}
@Parent(Cell.class)
public static class SubCell extends GSDiv implements RowFlexStyle {
@Override
public void init() {
forEach(ObservableListExtractor.HOLDERS);
}
}
@Parent(SubCell.class)
public static class ComponentSubCell extends GSDiv implements SubCellStyle {
@Override
public void init() {
forEach(gs -> ObservableListExtractor.COMPONENTS.apply(gs).filtered(g -> !g.equals(gs[2])));
}
}
@Parent(ComponentSubCell.class)
public static class ComponentLabel extends GSLabelDisplayer {
}
@Parent(SubCell.class)
public static class BooleanValueSubCell extends GSDiv implements SubCellStyle {
@Override
public void init() {
select(gs -> gs[1].getComponents().size() == 1 && Boolean.class.equals(gs[0].getInstanceValueClassConstraint()) ? gs[0] : null);
}
}
@Parent(BooleanValueSubCell.class)
public static class BooleanDisplayer extends GSCheckBoxDisplayer {
}
@Parent(SubCell.class)
public static class ValueSubCell extends GSDiv implements SubCellStyle {
@Override
public void init() {
select(gs -> gs[1].getComponents().size() == 1 && !Boolean.class.equals(gs[0].getInstanceValueClassConstraint()) ? gs[0] : null);
}
}
@Parent(ValueSubCell.class)
public static class ValueDisplayer extends GSLabelDisplayer {
}
@Parent(Row.class)
public static class RemoveButtonDiv extends GSDiv implements ButtonStyle {
}
@Parent(RemoveButtonDiv.class)
public static class RemoveButton extends HtmlButton implements FullSizeStyle {
@Override
public void init() {
setText("Remove");
bindAction(Context::remove);
}
}
}