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;
}
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);
}
}
}
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;
}
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);
}
}
}
}
}
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());
}
}
}
Aggregations