Search in sources :

Example 6 with GroupIdEnum

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

the class SymbolTypeConfig method updateFieldState.

/**
 * Gets the optimised field map, contains only the fields that
 * should be enabled when the option is selected.
 *
 * @param fieldEnableState the field enable state
 * @param panelName the panel name
 */
public void updateFieldState(FieldEnableState fieldEnableState, String panelName) {
    for (String menuOption : keyOrderList) {
        Map<FieldIdEnum, Boolean> fieldList = new HashMap<FieldIdEnum, Boolean>();
        for (FieldIdEnum fieldKey : fieldMap.keySet()) {
            boolean value = fieldMap.get(fieldKey);
            fieldList.put(fieldKey, value);
        }
        Map<GroupIdEnum, Boolean> groupList = new HashMap<GroupIdEnum, Boolean>();
        for (GroupIdEnum groupKey : groupMap.keySet()) {
            boolean value = groupMap.get(groupKey);
            groupList.put(groupKey, value);
        }
        if (fieldEnableState != null) {
            fieldEnableState.add(panelName, menuOption, fieldList, groupList);
        }
    }
}
Also used : LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) GroupIdEnum(com.sldeditor.common.xml.ui.GroupIdEnum)

Example 7 with GroupIdEnum

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

the class VOGeoServerTextSymbolizer2 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(getPanelId(), 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)

Example 8 with GroupIdEnum

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

the class PolygonFillDetails 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)

Example 9 with GroupIdEnum

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

the class RasterSymbolizerDetails method populateContrastMethod.

/**
 * Populate contrast method.
 *
 * @param contrastEnhancement the contrast enhancement
 * @param contrastMethodGroup the contrast method group
 */
private void populateContrastMethod(ContrastEnhancement contrastEnhancement, GroupIdEnum contrastMethodGroup) {
    GroupConfigInterface group = getGroup(contrastMethodGroup);
    if (group != null) {
        GroupIdEnum selectedNormalizeMethod = GroupIdEnum.UNKNOWN;
        MultiOptionGroup contrastNormalizeMethodGroup = (MultiOptionGroup) group;
        if (contrastEnhancement != null) {
            ContrastMethod contrastMethod = contrastEnhancement.getMethod();
            if (contrastMethod != null) {
                String contrastMethodString = contrastMethod.name();
                for (OptionGroup option : contrastNormalizeMethodGroup.getGroupList()) {
                    if (option.getLabel().compareToIgnoreCase(contrastMethodString) == 0) {
                        selectedNormalizeMethod = option.getId();
                    }
                }
            }
        }
        contrastNormalizeMethodGroup.setOption(selectedNormalizeMethod);
    }
}
Also used : OptionGroup(com.sldeditor.ui.detail.config.base.OptionGroup) MultiOptionGroup(com.sldeditor.ui.detail.config.base.MultiOptionGroup) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) ContrastMethod(org.opengis.style.ContrastMethod) MultiOptionGroup(com.sldeditor.ui.detail.config.base.MultiOptionGroup) GroupIdEnum(com.sldeditor.common.xml.ui.GroupIdEnum)

Example 10 with GroupIdEnum

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

the class ColourFieldConfigTest method testColourFieldConfig.

/**
 * Test method for {@link com.sldeditor.ui.detail.ColourFieldConfig#ColourFieldConfig(com.sldeditor.common.xml.ui.FieldIdEnum, com.sldeditor.common.xml.ui.FieldIdEnum, com.sldeditor.common.xml.ui.FieldIdEnum)}.
 * Test method for {@link com.sldeditor.ui.detail.ColourFieldConfig#getColour()}.
 * Test method for {@link com.sldeditor.ui.detail.ColourFieldConfig#getOpacity()}.
 * Test method for {@link com.sldeditor.ui.detail.ColourFieldConfig#getWidth()}.
 */
@Test
public void testColourFieldConfig() {
    GroupIdEnum groupId = GroupIdEnum.FILLCOLOUR;
    FieldIdEnum strokeFillColour = FieldIdEnum.STROKE_FILL_COLOUR;
    FieldIdEnum strokeFillOpacity = FieldIdEnum.OVERALL_OPACITY;
    FieldIdEnum strokeFillWidth = FieldIdEnum.STROKE_FILL_WIDTH;
    ColourFieldConfig config = new ColourFieldConfig(groupId, strokeFillColour, strokeFillOpacity, strokeFillWidth);
    assertEquals(groupId, config.getGroup());
    assertEquals(strokeFillColour, config.getColour());
    assertEquals(strokeFillOpacity, config.getOpacity());
    assertEquals(strokeFillWidth, config.getWidth());
}
Also used : ColourFieldConfig(com.sldeditor.ui.detail.ColourFieldConfig) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) GroupIdEnum(com.sldeditor.common.xml.ui.GroupIdEnum) Test(org.junit.Test)

Aggregations

GroupIdEnum (com.sldeditor.common.xml.ui.GroupIdEnum)11 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)10 GroupConfigInterface (com.sldeditor.ui.detail.config.base.GroupConfigInterface)8 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)6 CurrentFieldState (com.sldeditor.ui.detail.config.base.CurrentFieldState)4 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)3 MultiOptionGroup (com.sldeditor.ui.detail.config.base.MultiOptionGroup)3 Test (org.junit.Test)3 StrokeDetails (com.sldeditor.ui.detail.StrokeDetails)2 FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)2 FieldConfigString (com.sldeditor.ui.detail.config.FieldConfigString)2 OptionGroup (com.sldeditor.ui.detail.config.base.OptionGroup)2 TreeSelectionData (com.sldeditor.TreeSelectionData)1 VersionData (com.sldeditor.common.vendoroption.VersionData)1 SldEditorTest (com.sldeditor.common.xml.ui.SldEditorTest)1 XMLColourMapEntries (com.sldeditor.common.xml.ui.XMLColourMapEntries)1 XMLFieldAttribute (com.sldeditor.common.xml.ui.XMLFieldAttribute)1 XMLFieldBase (com.sldeditor.common.xml.ui.XMLFieldBase)1 XMLFieldDisabled (com.sldeditor.common.xml.ui.XMLFieldDisabled)1 XMLFieldExpression (com.sldeditor.common.xml.ui.XMLFieldExpression)1