use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class BasePanel method handleFieldState.
/**
* Handle field state for a specific combo box field.
*
* @param fieldId the field id
*/
protected void handleFieldState(FieldIdEnum fieldId) {
FieldConfigBase fieldConfig = fieldConfigManager.get(fieldId);
if (fieldConfig != null) {
if (fieldConfig instanceof FieldConfigEnum) {
FieldConfigEnum fieldEnum = (FieldConfigEnum) fieldConfig;
Map<FieldIdEnum, Boolean> stateMap = fieldEnum.getFieldEnableState();
if (stateMap != null) {
for (FieldIdEnum fieldKey : stateMap.keySet()) {
enableField(fieldKey, stateMap.get(fieldKey));
}
}
}
} else {
ConsoleManager.getInstance().error(this, String.format("handleFieldState - %s : %s", Localisation.getString(StandardPanel.class, "StandardPanel.unknownField"), fieldId));
}
}
use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class BasePanel method populateGroup.
/**
* Populate group.
*
* @param parent the parent
* @param parentBox the parent box
* @param groupConfig the group config
* @param parentField the parent field
*/
private void populateGroup(UpdateSymbolInterface parent, Box parentBox, GroupConfigInterface groupConfig, FieldConfigBase parentField) {
groupConfig.createTitle(parentBox, parent);
if (groupConfig instanceof GroupConfig) {
GroupConfig group = (GroupConfig) groupConfig;
List<FieldConfigBase> fieldList = group.getFieldConfigList();
fieldConfigManager.addGroup(group);
// Register for notifications when data has changed
registerForSymbolUpdates(fieldList, parent);
// Create field user interface
for (FieldConfigBase field : fieldList) {
field.setParent(parentField);
addField(parentBox, parentField, field);
}
for (GroupConfigInterface subGroup : group.getSubGroupList()) {
populateGroup(parent, parentBox, subGroup, parentField);
}
} else if (groupConfig instanceof MultiOptionGroup) {
MultiOptionGroup multiOption = (MultiOptionGroup) groupConfig;
fieldConfigManager.addMultiOptionGroup(multiOption);
multiOption.createUI(fieldConfigManager, parentBox, parent, parent.getClass());
for (OptionGroup optionGroup : multiOption.getGroupList()) {
for (GroupConfigInterface optionGroupConfig : optionGroup.getGroupList()) {
if (optionGroupConfig instanceof GroupConfig) {
populateOptionGroup(parent, (GroupConfig) optionGroupConfig);
}
}
}
}
}
use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class BasePanel method handleFieldState.
/**
* Handle field state for all combo box fields.
*/
protected void handleFieldState() {
List<FieldConfigBase> fieldList = fieldConfigManager.getFields(FieldConfigEnum.class);
for (FieldConfigBase field : fieldList) {
FieldConfigEnum fieldEnum = (FieldConfigEnum) field;
Map<FieldIdEnum, Boolean> stateMap = fieldEnum.getFieldEnableState();
if (stateMap != null) {
for (FieldIdEnum fieldKey : stateMap.keySet()) {
enableField(fieldKey, stateMap.get(fieldKey));
}
}
}
}
use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class GraphicPanelFieldManager method add.
/**
* Adds an existing GraphicPanelFieldManager to this one.
*
* @param fieldConfigManager the field config manager
*/
public void add(GraphicPanelFieldManager fieldConfigManager) {
if (fieldConfigManager != null) {
Map<FieldIdEnum, FieldConfigBase> componentMapToAdd = fieldConfigManager.fieldConfigMap.get(fieldConfigManager.panelId);
Map<FieldIdEnum, FieldConfigBase> componentMap = this.fieldConfigMap.get(fieldConfigManager.panelId);
if (componentMap == null) {
Map<FieldIdEnum, FieldConfigBase> value = fieldConfigManager.fieldConfigMap.get(fieldConfigManager.panelId);
this.fieldConfigMap.put(fieldConfigManager.panelId, value);
} else {
for (FieldIdEnum fieldId : componentMapToAdd.keySet()) {
FieldConfigBase dataToAdd = componentMapToAdd.get(fieldId);
componentMap.put(fieldId, dataToAdd);
}
}
// Add groups
Map<GroupIdEnum, GroupConfigInterface> groupMapToAdd = fieldConfigManager.groupMap.get(fieldConfigManager.panelId);
Map<GroupIdEnum, GroupConfigInterface> thisGroupMap = this.groupMap.get(fieldConfigManager.panelId);
if (thisGroupMap == null) {
Map<GroupIdEnum, GroupConfigInterface> value = fieldConfigManager.groupMap.get(fieldConfigManager.panelId);
this.groupMap.put(fieldConfigManager.panelId, value);
} else {
for (GroupIdEnum groupId : groupMapToAdd.keySet()) {
GroupConfigInterface dataToAdd = groupMapToAdd.get(groupId);
thisGroupMap.put(groupId, dataToAdd);
}
}
}
}
use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class GraphicPanelFieldManager method getFields.
/**
* Gets the fields for the given class type, if class type is null then all are returned.
*
* @param fieldType the field type
* @return the fields
*/
public List<FieldConfigBase> getFields(Class<?> fieldType) {
List<FieldConfigBase> fieldList = new ArrayList<FieldConfigBase>();
Map<FieldIdEnum, FieldConfigBase> panelMap = fieldConfigMap.get(panelId);
if (panelMap != null) {
for (FieldConfigBase field : panelMap.values()) {
if ((fieldType == null) || field.getClass() == fieldType) {
fieldList.add(field);
}
}
}
return fieldList;
}
Aggregations