use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class FontDetails method populate.
/**
* Populate.
*
* @param fontList the font list
*/
public void populate(List<Font> fontList) {
boolean emptyList = (fontList == null) || fontList.isEmpty();
boolean showMultipleCheckbox = (fontList != null) && (fontList.size() > 1);
MultipleFont multipleFont = new MultipleFont();
multipleFont.parseList(fontList);
Font font = multipleFont.getFont();
FieldConfigBase fieldConfig = fieldConfigManager.get(FieldIdEnum.FONT_FAMILY);
if (fieldConfig != null) {
if (emptyList) {
fieldConfig.showOptionField(false);
fieldConfig.setEnabled(false);
} else {
fieldConfig.setEnabled(true);
fieldConfigVisitor.populateFontField(FieldIdEnum.FONT_FAMILY, font);
fieldConfig.showOptionField(showMultipleCheckbox);
boolean isSelected = !font.getFamily().isEmpty();
fieldConfig.setOptionFieldValue(isSelected);
}
}
populateField(emptyList, showMultipleCheckbox, FieldIdEnum.FONT_WEIGHT, font.getWeight());
populateField(emptyList, showMultipleCheckbox, FieldIdEnum.FONT_STYLE, font.getStyle());
populateField(emptyList, showMultipleCheckbox, FieldIdEnum.FONT_SIZE, font.getSize());
fieldConfigVisitor.populateFontField(FieldIdEnum.FONT_PREVIEW, font);
}
use of com.sldeditor.ui.detail.config.FieldConfigBase 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.FieldConfigBase 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