Search in sources :

Example 21 with FieldConfigBase

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));
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) FieldConfigEnum(com.sldeditor.ui.detail.config.FieldConfigEnum) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum)

Example 22 with FieldConfigBase

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);
                }
            }
        }
    }
}
Also used : OptionGroup(com.sldeditor.ui.detail.config.base.OptionGroup) MultiOptionGroup(com.sldeditor.ui.detail.config.base.MultiOptionGroup) GroupConfig(com.sldeditor.ui.detail.config.base.GroupConfig) FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) MultiOptionGroup(com.sldeditor.ui.detail.config.base.MultiOptionGroup)

Example 23 with FieldConfigBase

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));
            }
        }
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) FieldConfigEnum(com.sldeditor.ui.detail.config.FieldConfigEnum) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum)

Example 24 with FieldConfigBase

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);
            }
        }
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) GroupIdEnum(com.sldeditor.common.xml.ui.GroupIdEnum)

Example 25 with FieldConfigBase

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;
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) ArrayList(java.util.ArrayList) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum)

Aggregations

FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)93 FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)43 Test (org.junit.Test)42 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)27 FieldConfigColour (com.sldeditor.ui.detail.config.FieldConfigColour)22 Expression (org.opengis.filter.expression.Expression)19 Mark (org.geotools.styling.Mark)14 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)13 FieldConfigSlider (com.sldeditor.ui.detail.config.FieldConfigSlider)13 FieldConfigSymbolType (com.sldeditor.ui.detail.config.FieldConfigSymbolType)13 GroupConfigInterface (com.sldeditor.ui.detail.config.base.GroupConfigInterface)13 PointFillDetails (com.sldeditor.ui.detail.PointFillDetails)12 ColourFieldConfig (com.sldeditor.ui.detail.ColourFieldConfig)10 ArrayList (java.util.ArrayList)10 Fill (org.geotools.styling.Fill)10 GraphicFill (org.opengis.style.GraphicFill)10 GraphicalSymbol (org.opengis.style.GraphicalSymbol)10 Geometry (com.vividsolutions.jts.geom.Geometry)9 StyleBuilder (org.geotools.styling.StyleBuilder)8 FieldConfigMarker (com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker)7