-
Notifications
You must be signed in to change notification settings - Fork 5
/
InstancesTable.java
135 lines (123 loc) · 6.77 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
package org.genericsystem.reactor.az3;
import org.genericsystem.reactor.Context;
import org.genericsystem.reactor.annotations.BindSelection;
import org.genericsystem.reactor.annotations.ForEach;
import org.genericsystem.reactor.annotations.ReactorDependencies;
import org.genericsystem.reactor.annotations.Select;
import org.genericsystem.reactor.annotations.Styles;
import org.genericsystem.reactor.annotations.Styles.AlignItems;
import org.genericsystem.reactor.annotations.Styles.BackgroundColor;
import org.genericsystem.reactor.annotations.Styles.Flex;
import org.genericsystem.reactor.annotations.Styles.FlexDirectionStyle;
import org.genericsystem.reactor.annotations.Styles.GenericValueBackgroundColor;
import org.genericsystem.reactor.annotations.Styles.Height;
import org.genericsystem.reactor.annotations.Styles.JustifyContent;
import org.genericsystem.reactor.annotations.Styles.KeepFlexDirection;
import org.genericsystem.reactor.annotations.Styles.MarginBottom;
import org.genericsystem.reactor.annotations.Styles.MarginRight;
import org.genericsystem.reactor.annotations.Styles.Width;
import org.genericsystem.reactor.az.FlexDirection;
import org.genericsystem.reactor.az.GSCheckBoxWithValue.GSCheckBoxDisplayer;
import org.genericsystem.reactor.az.GSCheckBoxWithValue.GSCheckBoxEditor;
import org.genericsystem.reactor.az.GSDiv;
import org.genericsystem.reactor.az3.GSComposite.Content;
import org.genericsystem.reactor.az3.GSComposite.Header;
import org.genericsystem.reactor.az3.GSComposite.Header.HeaderLabel;
import org.genericsystem.reactor.az3.InstancesTable.ButtonDiv;
import org.genericsystem.reactor.az3.InstancesTable.GSHolders;
import org.genericsystem.reactor.az3.InstancesTable.GSValueComponents;
import org.genericsystem.reactor.az3.InstancesTable.InstanceNameLink;
import org.genericsystem.reactor.az3.InstancesTable.RemoveButton;
import org.genericsystem.reactor.az3.Table.ContentRow;
import org.genericsystem.reactor.az3.Table.HeaderRow;
import org.genericsystem.reactor.gstag.HtmlButton;
import org.genericsystem.reactor.gstag.HtmlHyperLink;
import org.genericsystem.reactor.model.ObservableListExtractor;
import org.genericsystem.reactor.model.ObservableValueSelector;
import org.genericsystem.reactor.modelproperties.SelectionDefaults;
@BindSelection(ContentRow.class)
@Styles.Color(path = HeaderRow.class, value = "white")
@BackgroundColor(path = { HeaderRow.class, GSValueComponents.class, Content.class }, value = "#ea0084")
@BackgroundColor(path = { HeaderRow.class, GSValueComponents.class, Header.class }, value = "#ea0084")
@BackgroundColor(path = { HeaderRow.class, Content.class, GSValueComponents.class, Content.class }, value = "#ea0084")
@BackgroundColor(path = { HeaderRow.class, Content.class, GSValueComponents.class, Header.class }, value = "#ea0084")
@Styles.Color(path = { ContentRow.class, GSValueComponents.class, Header.class, InstanceNameLink.class }, value = "white")
@GenericValueBackgroundColor(path = { ContentRow.class, GSValueComponents.class, Header.class }, value = "#3393ff")
@AlignItems(path = { ContentRow.class, GSValueComponents.class, Header.class }, value = "flex-start")
@ReactorDependencies({ HeaderRow.class, ContentRow.class })
@ReactorDependencies(path = HeaderRow.class, value = { GSValueComponents.class, Content.class, ButtonDiv.class })
@ReactorDependencies(path = { HeaderRow.class, Content.class }, value = GSValueComponents.class)
@ReactorDependencies(path = ContentRow.class, value = { GSValueComponents.class, GSHolders.class, ButtonDiv.class })
@ReactorDependencies(path = { ContentRow.class, GSValueComponents.class, Header.class }, value = InstanceNameLink.class)
@ReactorDependencies(path = { ContentRow.class, ButtonDiv.class }, value = RemoveButton.class)
@ForEach(path = { HeaderRow.class, Content.class }, 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 {
@GenericValueBackgroundColor(path = { GSValueComponents.class, Content.class }, value = "#e5ed00")
@ReactorDependencies(value = GSValueComponents.class)
@ReactorDependencies(path = { GSValueComponents.class, Header.class }, value = { HeaderLabel.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, HeaderLabel.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 {
}
@BackgroundColor(path = Content.class, value = "#e5ed00")
@BackgroundColor(path = Header.class, value = "#e5ed00")
@JustifyContent(path = Header.class, value = "center")
@AlignItems(path = Header.class, value = "center")
@JustifyContent(path = Content.class, value = "center")
@AlignItems(path = Content.class, value = "center")
@FlexDirectionStyle(FlexDirection.ROW)
@ForEach(path = Content.class, value = ObservableListExtractor.OTHER_COMPONENTS_1.class)
@Select(path = Header.class, value = ObservableValueSelector.STRICT_ATTRIBUTE_SELECTOR.class)
@ReactorDependencies({ Header.class, Content.class })
@MarginRight(path = Header.class, value = "1px")
@MarginBottom(path = Header.class, value = "1px")
@MarginRight(path = Content.class, value = "1px")
@MarginBottom(path = Content.class, value = "1px")
public static class GSValueComponents extends GSComposite {
}
public static class InstanceNameLink extends HtmlHyperLink {
@Override
public void init() {
bindText();
bindAction(model -> getSelectionProperty(model).setValue(model));
}
}
@KeepFlexDirection
@BackgroundColor("#ea0084")
@MarginRight("1px")
@MarginBottom("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");
}
});
}
}
@Flex("1")
@Height("100%")
@Width("100%")
public static class RemoveButton extends HtmlButton {
@Override
public void init() {
setText("Remove");
bindAction(Context::remove);
}
}
}