-
Notifications
You must be signed in to change notification settings - Fork 5
/
InstancesTable.java
137 lines (128 loc) · 8.31 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package org.genericsystem.reactor.gscomponents;
import org.genericsystem.reactor.annotations.Attribute;
import org.genericsystem.reactor.annotations.BindAction;
import org.genericsystem.reactor.annotations.BindSelection;
import org.genericsystem.reactor.annotations.Children;
import org.genericsystem.reactor.annotations.ForEach;
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.ReverseFlexDirection;
import org.genericsystem.reactor.context.ObservableListExtractor;
import org.genericsystem.reactor.context.ObservableValueSelector;
import org.genericsystem.reactor.context.TagSwitcher;
import org.genericsystem.reactor.context.ContextAction.REMOVE;
import org.genericsystem.reactor.context.ContextAction.SET_SELECTION;
import org.genericsystem.reactor.context.ObservableValueSelector.STRICT_ATTRIBUTE_SELECTOR_OR_CHECK_BOX_DISPLAYER_ATTRIBUTE;
import org.genericsystem.reactor.contextproperties.SelectionDefaults;
import org.genericsystem.reactor.annotations.StyleClass;
import org.genericsystem.reactor.annotations.Switch;
import org.genericsystem.reactor.gscomponents.CheckBoxWithValue.CheckBoxDisplayer;
import org.genericsystem.reactor.gscomponents.CheckBoxWithValue.CheckBoxEditor;
import org.genericsystem.reactor.gscomponents.Composite.Content;
import org.genericsystem.reactor.gscomponents.Composite.Header;
import org.genericsystem.reactor.gscomponents.HtmlTag.HtmlHyperLink;
import org.genericsystem.reactor.gscomponents.HtmlTag.HtmlImg;
import org.genericsystem.reactor.gscomponents.HtmlTag.HtmlLabel;
import org.genericsystem.reactor.gscomponents.HtmlTag.HtmlLabel.GSLabelDisplayer;
import org.genericsystem.reactor.gscomponents.InstancesTable.ButtonDiv;
import org.genericsystem.reactor.gscomponents.InstancesTable.ContentRow;
import org.genericsystem.reactor.gscomponents.InstancesTable.HeaderRow;
import org.genericsystem.reactor.gscomponents.InstancesTable.Holders;
import org.genericsystem.reactor.gscomponents.InstancesTable.LinksDiv;
import org.genericsystem.reactor.gscomponents.InstancesTable.ValueComponents;
@Switch(path = { FlexDiv.class, ButtonDiv.class }, pos = { -1, 0 }, value = TagSwitcher.ADMIN_MODE_ONLY.class)
@Style(name = "overflow", value = "hidden")
@ReverseFlexDirection(path = Composite.class)
@BindSelection(value = Composite.class, valuePos = 2)
@GenericValueBackgroundColor(path = { ContentRow.class, ValueComponents.class, Header.class }, value = "#3393ff")
@Style(path = Composite.class, name = "flex", value = "0 1 auto")
@Style(path = { ContentRow.class, ValueComponents.class, Header.class, GSLabelDisplayer.class }, name = "color", value = "white")
@Style(path = { ContentRow.class, ValueComponents.class, Header.class }, name = "padding-left", value = "2px")
@Style(path = { ContentRow.class, ValueComponents.class, Header.class }, name = "align-items", value = "flex-start")
@Style(path = { HeaderRow.class, ButtonDiv.class }, name = "background-color", value = "#ea0084")
@Style(name = "background-color", value = "lightgrey")
@Children({ HeaderRow.class, InstanceBuilder.class, ContentRow.class })
@Children(path = HeaderRow.class, value = { ValueComponents.class, ValueComponents.class, ButtonDiv.class })
@Children(path = ContentRow.class, value = { ValueComponents.class, Holders.class, LinksDiv.class })
@Children(path = { ContentRow.class, ValueComponents.class, Header.class }, value = GSLabelDisplayer.class)
@ForEach(path = { HeaderRow.class, ValueComponents.class }, pos = { 0, 1 }, value = ObservableListExtractor.ATTRIBUTES_OF_TYPE.class)
@ForEach(path = ContentRow.class, value = ObservableListExtractor.SUBINSTANCES.class)
@ForEach(path = { ContentRow.class, Holders.class }, value = ObservableListExtractor.ATTRIBUTES_OF_INSTANCES.class)
@ForEach(path = { ContentRow.class, ValueComponents.class, Content.class }, value = ObservableListExtractor.OTHER_COMPONENTS_2.class)
@Select(path = { ContentRow.class, ValueComponents.class, Header.class, CheckBoxDisplayer.class }, value = ObservableValueSelector.CHECK_BOX_DISPLAYER.class)
public class InstancesTable extends FlexDiv implements SelectionDefaults {
@GenericValueBackgroundColor(path = { ValueComponents.class, FlexDiv.class }, value = "#ea0084")
@Style(name = "color", value = "white")
@Children(path = { ValueComponents.class, Header.class }, value = GSLabelDisplayer.class)
@Select(path = { ValueComponents.class, Header.class }, value = STRICT_ATTRIBUTE_SELECTOR_OR_CHECK_BOX_DISPLAYER_ATTRIBUTE.class)
public static class HeaderRow extends Composite {
}
public static class ContentRow extends Composite {
}
@FlexDirectionStyle(FlexDirection.ROW)
public static class HorizontalInstancesTable extends InstancesTable {
}
@GenericValueBackgroundColor(path = { ValueComponents.class, Content.class }, value = "#e5ed00")
@Children(value = ValueComponents.class)
@ForEach(path = ValueComponents.class, value = ObservableListExtractor.HOLDERS.class)
@ForEach(path = { ValueComponents.class, Content.class }, value = ObservableListExtractor.OTHER_COMPONENTS_2.class)
@Select(path = { ValueComponents.class, Header.class, CheckBoxEditor.class }, value = ObservableValueSelector.CHECK_BOX_DISPLAYER.class)
public static class Holders extends Composite {
}
@FlexDirectionStyle(FlexDirection.ROW)
@Style(path = FlexDiv.class, name = "background-color", value = "#e5ed00")
@Style(path = FlexDiv.class, name = "justify-content", value = "center")
@Style(path = FlexDiv.class, name = "align-items", value = "center")
@Style(path = FlexDiv.class, name = "margin-right", value = "1px")
@Style(path = FlexDiv.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_OR_CHECK_BOX_DISPLAYER.class)
@Select(path = { Header.class, FlexDiv.class, HtmlLabel.class }, pos = { -1, 0, 0 }, value = ObservableValueSelector.NON_PASSWORD_INSTANCE_SELECTOR.class)
@Select(path = { Header.class, FlexDiv.class, HtmlLabel.class }, pos = { -1, 0, 1 }, value = ObservableValueSelector.PASSWORD_INSTANCE_SELECTOR.class)
@Select(path = { Header.class, CheckBoxDisplayer.class }, value = ObservableValueSelector.CHECK_BOX_DISPLAYER.class)
@Select(path = { Header.class, FlexDiv.class }, value = ObservableValueSelector.LABEL_DISPLAYER.class)
@Children({ Content.class, Header.class })
@Children(path = Header.class, value = { CheckBoxDisplayer.class, FlexDiv.class })
@Children(path = { Header.class, FlexDiv.class }, value = { GSLabelDisplayer.class, HtmlLabel.class })
@SetText(path = { Header.class, FlexDiv.class, HtmlLabel.class }, pos = { -1, 0, 1 }, value = "******")
public static class ValueComponents extends Composite {
}
@Style(name = "background-color", value = "white")
@Style(name = "justify-content", value = "center")
@FlexDirectionStyle(FlexDirection.ROW)
@Style(name = "margin-right", value = "1px")
@Style(name = "margin-bottom", value = "1px")
public static class ButtonDiv extends FlexDiv {
@Override
public void init() {
if (FlexDirection.ROW.equals(getDirection())) {
addStyle("flex", "0");
addStyleClass("buttonDiv");
} else {
addStyle("flex", "1");
}
getDirectionProperty().addListener((o, v, nv) -> {
if (FlexDirection.ROW.equals(nv)) {
addStyle("flex", "0");
addStyleClass("buttonDiv");
} else {
addStyle("flex", "1");
}
});
}
}
@Style(name = "background-color", value = "white")
@StyleClass(path = { HtmlHyperLink.class, HtmlImg.class }, pos = { 1, 0 }, value = "img")
@StyleClass(path = { HtmlHyperLink.class, HtmlImg.class }, pos = { 0, 0 }, value = "img")
@Children({ HtmlHyperLink.class, HtmlHyperLink.class })
@Children(path = HtmlHyperLink.class, value = HtmlImg.class)
@Attribute(path = { HtmlHyperLink.class, HtmlImg.class }, pos = { 1, 0 }, name = "src", value = "delete.png")
@Attribute(path = { HtmlHyperLink.class, HtmlImg.class }, pos = { 0, 0 }, name = "src", value = "edit.png")
@BindAction(path = HtmlHyperLink.class, pos = 1, value = REMOVE.class)
@BindAction(path = HtmlHyperLink.class, pos = 0, value = SET_SELECTION.class)
public static class LinksDiv extends ButtonDiv {
}
}