-
Notifications
You must be signed in to change notification settings - Fork 5
/
InstancesTable.java
117 lines (107 loc) · 6.18 KB
/
InstancesTable.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
package org.genericsystem.reactor.gscomponents3;
import org.genericsystem.reactor.modelproperties.SelectionDefaults;
import org.genericsystem.reactor.htmltag.HtmlButton;
import org.genericsystem.reactor.htmltag.HtmlHyperLink;
import org.genericsystem.reactor.htmltag.HtmlLabel.GSLabelDisplayer;
import org.genericsystem.reactor.annotations.BindAction;
import org.genericsystem.reactor.annotations.BindSelection;
import org.genericsystem.reactor.annotations.BindText;
import org.genericsystem.reactor.annotations.ForEach;
import org.genericsystem.reactor.annotations.Children;
import org.genericsystem.reactor.annotations.Select;
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.KeepFlexDirection;
import org.genericsystem.reactor.gscomponents.FlexDirection;
import org.genericsystem.reactor.gscomponents.GSCheckBoxWithValue.GSCheckBoxDisplayer;
import org.genericsystem.reactor.gscomponents.GSCheckBoxWithValue.GSCheckBoxEditor;
import org.genericsystem.reactor.gscomponents.GSDiv;
import org.genericsystem.reactor.gscomponents3.GSComposite.Content;
import org.genericsystem.reactor.gscomponents3.GSComposite.Header;
import org.genericsystem.reactor.gscomponents3.InstancesTable.ButtonDiv;
import org.genericsystem.reactor.gscomponents3.InstancesTable.GSHolders;
import org.genericsystem.reactor.gscomponents3.InstancesTable.GSValueComponents;
import org.genericsystem.reactor.gscomponents3.InstancesTable.InstanceNameLink;
import org.genericsystem.reactor.gscomponents3.InstancesTable.RemoveButton;
import org.genericsystem.reactor.gscomponents3.Table.ContentRow;
import org.genericsystem.reactor.gscomponents3.Table.HeaderRow;
import org.genericsystem.reactor.model.ContextAction.REMOVE;
import org.genericsystem.reactor.model.ContextAction.SET_SELECTION;
import org.genericsystem.reactor.model.ObservableListExtractor;
import org.genericsystem.reactor.model.ObservableValueSelector;
@BindSelection(ContentRow.class)
@GenericValueBackgroundColor(path = { HeaderRow.class, GSValueComponents.class, GSDiv.class }, value = "#ea0084")
@GenericValueBackgroundColor(path = { ContentRow.class, GSValueComponents.class, Header.class }, value = "#3393ff")
@Style(path = HeaderRow.class, name = "color", value = "white")
@Style(path = { ContentRow.class, GSValueComponents.class, Header.class, InstanceNameLink.class }, name = "color", value = "white")
@Style(path = { ContentRow.class, GSValueComponents.class, Header.class }, name = "align-items", value = "flex-start")
@Children({ HeaderRow.class, InstanceBuilder.class, ContentRow.class })
@Children(path = HeaderRow.class, value = { GSValueComponents.class, GSValueComponents.class, ButtonDiv.class })
@Children(path = ContentRow.class, value = { GSValueComponents.class, GSHolders.class, ButtonDiv.class })
@Children(path = { ContentRow.class, GSValueComponents.class, Header.class }, value = InstanceNameLink.class)
@Children(path = { ContentRow.class, ButtonDiv.class }, value = RemoveButton.class)
@ForEach(path = { HeaderRow.class, GSValueComponents.class }, pos = { 0, 1 }, value = ObservableListExtractor.ATTRIBUTES_OF_TYPE.class)
@ForEach(path = ContentRow.class, value = ObservableListExtractor.SUBINSTANCES.class)
@ForEach(path = { ContentRow.class, GSHolders.class }, value = ObservableListExtractor.ATTRIBUTES_OF_INSTANCES.class)
@ForEach(path = { ContentRow.class, GSValueComponents.class, Content.class }, value = ObservableListExtractor.OTHER_COMPONENTS_2.class)
public class InstancesTable extends Table implements SelectionDefaults {
@FlexDirectionStyle(FlexDirection.ROW)
public static class HorizontalInstancesTable extends InstancesTable {
}
@GenericValueBackgroundColor(path = { GSValueComponents.class, Content.class }, value = "#e5ed00")
@Children(value = GSValueComponents.class)
@Children(path = { GSValueComponents.class, Header.class }, value = { GSLabelDisplayer.class, GSCheckBoxDisplayer.class })
@ForEach(path = GSValueComponents.class, value = ObservableListExtractor.HOLDERS.class)
@ForEach(path = { GSValueComponents.class, Content.class }, value = ObservableListExtractor.OTHER_COMPONENTS_2.class)
@Select(path = { GSValueComponents.class, Header.class, GSLabelDisplayer.class }, value = ObservableValueSelector.LABEL_DISPLAYER.class)
@Select(path = { GSValueComponents.class, Header.class, GSCheckBoxEditor.class }, value = ObservableValueSelector.CHECK_BOX_DISPLAYER.class)
public static class GSHolders extends GSComposite {
}
@FlexDirectionStyle(FlexDirection.ROW)
@Style(path = GSDiv.class, name = "background-color", value = "#e5ed00")
@Style(path = GSDiv.class, name = "justify-content", value = "center")
@Style(path = GSDiv.class, name = "align-items", value = "center")
@Style(path = GSDiv.class, name = "margin-right", value = "1px")
@Style(path = GSDiv.class, name = "margin-bottom", value = "1px")
@ForEach(path = Content.class, value = ObservableListExtractor.OTHER_COMPONENTS_1.class)
@Select(path = Header.class, value = ObservableValueSelector.STRICT_ATTRIBUTE_SELECTOR.class)
@Children({ Header.class, Content.class })
public static class GSValueComponents extends GSComposite {
}
@BindAction(SET_SELECTION.class)
@BindText
public static class InstanceNameLink extends HtmlHyperLink {
}
@KeepFlexDirection
@Style(name = "background-color", value = "#ea0084")
@Style(name = "margin-right", value = "1px")
@Style(name = "margin-bottom", value = "1px")
public static class ButtonDiv extends GSDiv {
@Override
public void init() {
if (FlexDirection.ROW.equals(getDirection())) {
addStyle("flex", "0");
addStyle("min-width", "100px");
} else {
addStyle("flex", "1");
}
getDirectionProperty().addListener((o, v, nv) -> {
if (FlexDirection.ROW.equals(nv)) {
addStyle("flex", "0");
addStyle("min-width", "100px");
} else {
addStyle("flex", "1");
}
});
}
}
@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 {
}
}