Search in sources :

Example 26 with FieldIdEnum

use of com.sldeditor.common.xml.ui.FieldIdEnum 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 27 with FieldIdEnum

use of com.sldeditor.common.xml.ui.FieldIdEnum 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 28 with FieldIdEnum

use of com.sldeditor.common.xml.ui.FieldIdEnum 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)

Example 29 with FieldIdEnum

use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.

the class GraphicPanelFieldManager method getData.

/**
 * Gets the data.
 *
 * @param requestedPanelId the requested panel id
 * @param requestedField the requested field
 * @return the data
 */
public FieldConfigBase getData(Class<?> requestedPanelId, FieldIdEnum requestedField) {
    FieldConfigBase retVal = null;
    Map<FieldIdEnum, FieldConfigBase> panelMap = fieldConfigMap.get(requestedPanelId);
    if (panelMap != null) {
        retVal = panelMap.get(requestedField);
    }
    return retVal;
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum)

Example 30 with FieldIdEnum

use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.

the class PointFillDetails method setSymbolTypeVisibility.

/**
 * Sets the symbol type visibility.
 *
 * @param panelId the panel id
 * @param selectedItem the selected item
 */
private void setSymbolTypeVisibility(Class<?> panelId, String selectedItem) {
    Map<GroupIdEnum, Boolean> groupList = fieldEnableState.getGroupIdList(panelId.getName(), selectedItem);
    for (GroupIdEnum groupId : groupList.keySet()) {
        boolean groupEnabled = groupList.get(groupId);
        GroupConfigInterface groupConfig = fieldConfigManager.getGroup(this.getClass(), groupId);
        if (groupConfig != null) {
            groupConfig.setGroupStateOverride(groupEnabled);
        } else {
            ConsoleManager.getInstance().error(this, "Failed to find group : " + groupId.toString());
        }
    }
    Map<FieldIdEnum, Boolean> fieldList = fieldEnableState.getFieldIdList(panelId.getName(), selectedItem);
    for (FieldIdEnum fieldId : fieldList.keySet()) {
        boolean fieldEnabled = fieldList.get(fieldId);
        FieldConfigBase fieldConfig = fieldConfigManager.get(fieldId);
        if (fieldConfig != null) {
            CurrentFieldState fieldState = fieldConfig.getFieldState();
            fieldState.setFieldEnabled(fieldEnabled);
            fieldConfig.setFieldState(fieldState);
        } else {
            ConsoleManager.getInstance().error(this, "Failed to find field : " + fieldId.toString());
        }
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) CurrentFieldState(com.sldeditor.ui.detail.config.base.CurrentFieldState) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) GroupIdEnum(com.sldeditor.common.xml.ui.GroupIdEnum)

Aggregations

FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)83 Test (org.junit.Test)55 FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)54 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)33 FieldConfigString (com.sldeditor.ui.detail.config.FieldConfigString)28 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)27 FieldConfigColour (com.sldeditor.ui.detail.config.FieldConfigColour)17 PointFillDetails (com.sldeditor.ui.detail.PointFillDetails)16 StyleBuilder (org.geotools.styling.StyleBuilder)14 ColourFieldConfig (com.sldeditor.ui.detail.ColourFieldConfig)13 FieldConfigPopulation (com.sldeditor.ui.detail.config.FieldConfigPopulation)13 Geometry (com.vividsolutions.jts.geom.Geometry)13 Expression (org.opengis.filter.expression.Expression)13 FieldConfigSlider (com.sldeditor.ui.detail.config.FieldConfigSlider)12 FieldConfigSymbolType (com.sldeditor.ui.detail.config.FieldConfigSymbolType)12 GroupIdEnum (com.sldeditor.common.xml.ui.GroupIdEnum)10 GroupConfigInterface (com.sldeditor.ui.detail.config.base.GroupConfigInterface)8 ArrayList (java.util.ArrayList)8 Mark (org.geotools.styling.Mark)7 StrokeDetails (com.sldeditor.ui.detail.StrokeDetails)6