-
Notifications
You must be signed in to change notification settings - Fork 5
/
GSBuilderDefaults.java
96 lines (73 loc) · 3.1 KB
/
GSBuilderDefaults.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
package org.genericsystem.reactor.modelproperties;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.genericsystem.common.Generic;
import org.genericsystem.reactor.Context;
import javafx.beans.property.Property;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ObservableValue;
public interface GSBuilderDefaults extends ContextProperty {
public static final String COMPONENTS_MAP = "componentsMap";
public static final String HOLDERS_MAP = "holdersMap";
public static final String INVALID_LIST = "invalidList";
public static final String MULTIPLE_RELATION = "multipleRelation";
public static final String VALUE_COMPONENTS_MAP = "valueComponentsMap";
public static class GenericValueComponents {
private Property<Serializable> value = new SimpleObjectProperty<>();
private List<Property<Context>> components = new ArrayList<>();
public Property<Serializable> getGenericValue() {
return value;
}
public void setGenericValue(Property<Serializable> value) {
this.value = value;
}
public List<Property<Context>> getComponents() {
return components;
}
public void setComponents(List<Property<Context>> components) {
this.components = components;
}
}
default void createValueComponentsMapProperty() {
createNewInitializedProperty(VALUE_COMPONENTS_MAP, model -> new HashMap<Generic, GenericValueComponents>() {
private static final long serialVersionUID = -435743147955810836L;
@Override
public GenericValueComponents get(Object key) {
GenericValueComponents result = super.get(key);
if (result == null)
put((Generic) key, result = new GenericValueComponents());
return result;
};
});
}
default void createHoldersMapProperty() {
createNewInitializedProperty(HOLDERS_MAP, model -> new HashMap<Generic, Property<Serializable>>());
}
default void createComponentsMapProperty() {
createNewInitializedProperty(COMPONENTS_MAP, model -> new HashMap<Generic, List<Property<Context>>>());
};
default void createInvalidListProperty() {
createNewInitializedProperty(INVALID_LIST, model -> new ArrayList<ObservableValue<Boolean>>());
};
default void createMultipleRelationProperty() {
createNewInitializedProperty(MULTIPLE_RELATION, context -> new HashMap<Generic, Map<Generic, Property<Serializable>>>());
}
default Property<List<ObservableValue<Boolean>>> getInvalidListProperty(Context model) {
return getProperty(INVALID_LIST, model);
}
default Property<Map<Generic, GenericValueComponents>> getGenericValueComponents(Context context) {
return getProperty(VALUE_COMPONENTS_MAP, context);
}
default Property<Map<Generic, Property<Serializable>>> getHoldersMapProperty(Context model) {
return getProperty(HOLDERS_MAP, model);
}
default Property<Map<Generic, List<Property<Context>>>> getComponentsMapProperty(Context model) {
return getProperty(COMPONENTS_MAP, model);
}
default Property<Map<Generic, Map<Generic, Property<Serializable>>>> getMultipleRelationProperty(Context context) {
return getProperty(MULTIPLE_RELATION, context);
}
}