use of com.sldeditor.ui.detail.config.base.GroupConfig in project sldeditor by robward-scisys.
the class ReadPanelConfig method parseMultiOptionGroup.
/**
* Parses the multi option group.
*
* @param localisationClass the localisation class
* @param panelId the panel id
* @param xmlMultiGroupObj the xml multi group obj
* @return the multi option group
*/
private MultiOptionGroup parseMultiOptionGroup(Class<?> localisationClass, Class<?> panelId, XMLMultiOptionGroup xmlMultiGroupObj) {
MultiOptionGroup multiOptionGroupConfig = new MultiOptionGroup();
multiOptionGroupConfig.setId(xmlMultiGroupObj.getId());
multiOptionGroupConfig.setLabel(getLocalisedText(localisationClass, xmlMultiGroupObj.getLabel()));
multiOptionGroupConfig.setShowLabel(xmlMultiGroupObj.getShowLabel());
multiOptionGroupConfig.setOptional(xmlMultiGroupObj.getOption());
List<XMLOptionGroup> optionGroupList = xmlMultiGroupObj.getOptionGroup();
for (XMLOptionGroup xmlOptionGroup : optionGroupList) {
OptionGroup optionGroup = new OptionGroup();
optionGroup.setId(xmlOptionGroup.getId());
optionGroup.setLabel(getLocalisedText(localisationClass, xmlOptionGroup.getLabel()));
optionGroup.setShowLabel(xmlOptionGroup.getShowLabel());
List<XMLGroupConfig> xmlGroupConfigList = xmlOptionGroup.getGroup();
if (xmlGroupConfigList != null) {
for (XMLGroupConfig xmlGroupConfig : xmlGroupConfigList) {
GroupConfig groupConfig = parseGroup(localisationClass, panelId, xmlGroupConfig);
optionGroup.addGroup(groupConfig);
}
}
multiOptionGroupConfig.addGroup(optionGroup);
}
return multiOptionGroupConfig;
}
use of com.sldeditor.ui.detail.config.base.GroupConfig in project sldeditor by robward-scisys.
the class BasePanel method populateOptionGroup.
/**
* Populate option group.
*
* @param parent the parent
* @param optionGroupConfig the option group config
*/
private void populateOptionGroup(UpdateSymbolInterface parent, GroupConfig optionGroupConfig) {
List<FieldConfigBase> fieldList = optionGroupConfig.getFieldConfigList();
fieldConfigManager.addGroup(optionGroupConfig);
// Create field user interface
for (FieldConfigBase field : fieldList) {
addFieldConfig(field);
fieldConfigManager.addField(field);
}
// Register for notifications when data has changed
registerForSymbolUpdates(fieldList, parent);
for (GroupConfigInterface subOptionGroupConfig : optionGroupConfig.getSubGroupList()) {
if (subOptionGroupConfig instanceof GroupConfig) {
populateOptionGroup(parent, (GroupConfig) subOptionGroupConfig);
} else if (subOptionGroupConfig instanceof MultiOptionGroup) {
MultiOptionGroup multiOption = (MultiOptionGroup) subOptionGroupConfig;
fieldConfigManager.addMultiOptionGroup(multiOption);
for (OptionGroup optionGroup : multiOption.getGroupList()) {
for (GroupConfigInterface subMultiOptionGroupConfig : optionGroup.getGroupList()) {
if (subMultiOptionGroupConfig instanceof GroupConfig) {
populateOptionGroup(parent, (GroupConfig) subMultiOptionGroupConfig);
}
}
}
}
}
}
use of com.sldeditor.ui.detail.config.base.GroupConfig in project sldeditor by robward-scisys.
the class FilterManagerTest method testConvertParameters.
/**
* Test method for
* {@link com.sldeditor.filter.v2.function.FilterManager#convertParameters(java.lang.Class, com.sldeditor.ui.detail.config.FieldId, org.opengis.filter.capability.FunctionName)}.
*/
@Test
public void testConvertParameters() {
DefaultFunctionFactory functionFactory = new DefaultFunctionFactory();
List<FunctionName> functionNameList = functionFactory.getFunctionNames();
// Try with empty parameters
Class<?> panelId = null;
List<GroupConfigInterface> list = FilterManager.getInstance().convertParameters(panelId, null);
assertTrue(list.isEmpty());
// Find a known function
for (FunctionName functionName : functionNameList) {
list = FilterManager.getInstance().convertParameters(panelId, functionName);
System.out.println(functionName.getName());
assertEquals(1, list.size());
GroupConfig groupConfig = (GroupConfig) list.get(0);
List<FieldConfigBase> fieldList = groupConfig.getFieldConfigList();
assertEquals(functionName.getName(), fieldList.size(), Math.abs(functionName.getArgumentCount()));
List<String> argList = new ArrayList<String>();
for (int fieldIndex = 0; fieldIndex < fieldList.size(); fieldIndex++) {
checkFieldType(fieldIndex, fieldList, functionName, argList);
}
StringBuilder sb = new StringBuilder();
sb.append(functionName.getName());
sb.append("(");
for (int index = 0; index < argList.size(); index++) {
if (index > 0) {
sb.append(", ");
}
sb.append(argList.get(index));
}
sb.append(")");
String prototype = groupConfig.getLabel();
assertNotNull(functionName.getName(), prototype);
assertNotNull(functionName.getName(), sb.toString());
assertTrue(prototype.compareTo(sb.toString()) == 0);
}
}
Aggregations