Search in sources :

Example 46 with FieldIdEnum

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

the class SymbolTypeConfig method getFieldMap.

/**
 * Gets the field map, regardless of whether the field is
 * enabled or disabled when the option is selected.
 *
 * @return the field map
 */
public Map<Class<?>, Map<FieldIdEnum, Boolean>> getFieldMap() {
    Map<Class<?>, Map<FieldIdEnum, Boolean>> map = new HashMap<Class<?>, Map<FieldIdEnum, Boolean>>();
    Map<FieldIdEnum, Boolean> fieldList = new HashMap<FieldIdEnum, Boolean>();
    for (FieldIdEnum fieldKey : fieldMap.keySet()) {
        boolean value = fieldMap.get(fieldKey);
        fieldList.put(fieldKey, value);
    }
    map.put(panelId, fieldList);
    return map;
}
Also used : LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) HashMap(java.util.HashMap)

Example 47 with FieldIdEnum

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

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

the class ReadPanelConfig method parseGroup.

/**
 * Parses the group if fields.
 *
 * @param localisationClass the localisation class
 * @param panelId the panel id
 * @param xmlGroupObj the xml group object
 * @return the group config
 */
private GroupConfig parseGroup(Class<?> localisationClass, Class<?> panelId, XMLGroupConfig xmlGroupObj) {
    GroupConfig groupConfig = new GroupConfig();
    groupConfig.setId(xmlGroupObj.getId());
    groupConfig.setLabel(groupTitle(getLocalisedText(localisationClass, xmlGroupObj.getLabel())));
    groupConfig.setShowLabel(xmlGroupObj.getShowLabel());
    groupConfig.setOptional(xmlGroupObj.getOption());
    for (Object obj : xmlGroupObj.getFieldList()) {
        if (obj instanceof XMLFieldConfigData) {
            addField(localisationClass, panelId, groupConfig, (XMLFieldConfigData) obj);
        } else if (obj instanceof XMLGroupConfig) {
            GroupConfig subGroup = parseGroup(localisationClass, panelId, (XMLGroupConfig) obj);
            groupConfig.addGroup(subGroup);
        } else if (obj instanceof XMLMultiOptionGroup) {
            MultiOptionGroup subGroup = parseMultiOptionGroup(localisationClass, panelId, (XMLMultiOptionGroup) obj);
            groupConfig.addGroup(subGroup);
        } else if (obj instanceof XMLFieldConfigVendorOption) {
            XMLFieldConfigVendorOption vendorOption = (XMLFieldConfigVendorOption) obj;
            FieldIdEnum id = vendorOption.getId();
            String label = null;
            boolean valueOnly = true;
            FieldConfigCommonData commonData = new FieldConfigCommonData(panelId, id, label, valueOnly);
            List<VendorOptionInterface> veList = null;
            veList = vendorOptionFactory.getVendorOptionList(vendorOption.getClazz());
            if ((veList == null) || veList.isEmpty()) {
                ConsoleManager.getInstance().error(this, Localisation.getField(FieldConfigBase.class, "FieldConfigVendorOption.missingVendorOptionClass") + vendorOption.getClazz());
            }
            FieldConfigVendorOption placeHolder = new FieldConfigVendorOption(commonData, veList);
            groupConfig.addField(placeHolder);
        }
    }
    return groupConfig;
}
Also used : XMLMultiOptionGroup(com.sldeditor.common.xml.ui.XMLMultiOptionGroup) XMLFieldConfigVendorOption(com.sldeditor.common.xml.ui.XMLFieldConfigVendorOption) XMLFieldConfigString(com.sldeditor.common.xml.ui.XMLFieldConfigString) XMLGroupConfig(com.sldeditor.common.xml.ui.XMLGroupConfig) XMLFieldConfigVendorOption(com.sldeditor.common.xml.ui.XMLFieldConfigVendorOption) GroupConfig(com.sldeditor.ui.detail.config.base.GroupConfig) XMLGroupConfig(com.sldeditor.common.xml.ui.XMLGroupConfig) XMLFieldConfigData(com.sldeditor.common.xml.ui.XMLFieldConfigData) List(java.util.List) ArrayList(java.util.ArrayList) FieldList(com.sldeditor.common.xml.ui.XMLFieldConfigEnumValue.FieldList) XMLFieldConfigEnumValueList(com.sldeditor.common.xml.ui.XMLFieldConfigEnumValueList) XMLMultiOptionGroup(com.sldeditor.common.xml.ui.XMLMultiOptionGroup) MultiOptionGroup(com.sldeditor.ui.detail.config.base.MultiOptionGroup) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum)

Example 49 with FieldIdEnum

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

the class VOGeoServerLabelling method getMinimumVersion.

/*
     * (non-Javadoc)
     * 
     * @see com.sldeditor.ui.iface.PopulateDetailsInterface#getMinimumVersion(java.lang.Object, java.util.List)
     */
@Override
public void getMinimumVersion(Object parentObj, Object sldObj, List<VendorOptionPresent> vendorOptionsPresentList) {
    if (sldObj instanceof TextSymbolizer) {
        TextSymbolizer textSymbolizer = (TextSymbolizer) sldObj;
        Map<String, String> options = textSymbolizer.getOptions();
        for (FieldIdEnum key : fieldMap.keySet()) {
            String vendorOptionAttributeKey = fieldMap.get(key);
            if (options.containsKey(vendorOptionAttributeKey)) {
                VendorOptionPresent voPresent = new VendorOptionPresent(sldObj, getVendorOptionInfo());
                if (!vendorOptionsPresentList.contains(voPresent)) {
                    vendorOptionsPresentList.add(voPresent);
                }
            }
        }
    }
}
Also used : VendorOptionPresent(com.sldeditor.common.vendoroption.minversion.VendorOptionPresent) TextSymbolizer(org.geotools.styling.TextSymbolizer) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum)

Example 50 with FieldIdEnum

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

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