use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class FieldConfigVendorOptionTest method testCreateCopy.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigVendorOption#createCopy(com.sldeditor.ui.detail.config.FieldConfigBase)}.
*/
@Test
public void testCreateCopy() {
boolean valueOnly = true;
class TestFieldConfigVendorOption extends FieldConfigVendorOption {
public TestFieldConfigVendorOption(FieldConfigCommonData commonData, List<VendorOptionInterface> veList) {
super(commonData, veList);
}
public FieldConfigPopulate callCreateCopy(FieldConfigBase fieldConfigBase) {
return createCopy(fieldConfigBase);
}
}
TestFieldConfigVendorOption field = new TestFieldConfigVendorOption(new FieldConfigCommonData(Double.class, FieldIdEnum.NAME, "label", valueOnly), null);
FieldConfigVendorOption copy = (FieldConfigVendorOption) field.callCreateCopy(null);
assertNull(copy);
copy = (FieldConfigVendorOption) field.callCreateCopy(field);
assertEquals(field.getFieldId(), copy.getFieldId());
assertTrue(field.getLabel().compareTo(copy.getLabel()) == 0);
assertEquals(field.isValueOnly(), copy.isValueOnly());
}
use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class FieldConfigColourMapTest method testCreateCopy.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#createCopy(com.sldeditor.ui.detail.config.FieldConfigBase)}.
*/
@Test
public void testCreateCopy() {
class TestFieldConfigColourMap extends FieldConfigColourMap {
public TestFieldConfigColourMap(FieldConfigCommonData commonData) {
super(commonData);
}
public FieldConfigPopulate callCreateCopy(FieldConfigBase fieldConfigBase) {
return createCopy(fieldConfigBase);
}
}
TestFieldConfigColourMap field = new TestFieldConfigColourMap(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
FieldConfigColourMap copy = (FieldConfigColourMap) field.callCreateCopy(null);
assertNull(copy);
copy = (FieldConfigColourMap) field.callCreateCopy(field);
assertEquals(field.getFieldId(), copy.getFieldId());
assertTrue(field.getLabel().compareTo(copy.getLabel()) == 0);
assertEquals(field.isValueOnly(), copy.isValueOnly());
}
use of com.sldeditor.ui.detail.config.FieldConfigBase 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());
}
}
}
use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class PolygonFillDetails method optionSelected.
/**
* Option selected.
*
* @param fieldPanelId the field panel id
* @param selectedItem the selected item
*/
@Override
public void optionSelected(Class<?> fieldPanelId, String selectedItem) {
setSymbolTypeVisibility(fieldPanelId, selectedItem);
selectedFillPanelId = fieldPanelId;
FieldConfigBase fieldConfig = fieldConfigManager.get(FieldIdEnum.SIZE);
if (fieldConfig.isEnabled()) {
Expression expression = fieldConfig.getExpression();
if (expression instanceof LiteralExpressionImpl) {
LiteralExpressionImpl l = (LiteralExpressionImpl) expression;
Double d = (Double) l.getValue();
if (d <= 0.0) {
fieldConfigVisitor.populateField(FieldIdEnum.SIZE, getFilterFactory().literal(1));
}
}
}
dataHasChanged();
}
use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class StandardPanel method populateStandardData.
/**
* Populate standard data.
*
* @param standardData the standard data
*/
private void populateStandardData(StandardData standardData) {
Description description = standardData.description;
String titleString = "";
String descriptionString = "";
if (description != null) {
InternationalString title = description.getTitle();
if (title != null) {
titleString = title.toString();
}
InternationalString abstractDesc = description.getAbstract();
if (abstractDesc != null) {
descriptionString = abstractDesc.toString();
}
}
if (fieldConfigVisitor.getFieldConfig(FieldIdEnum.NAME) != null) {
fieldConfigVisitor.populateTextField(FieldIdEnum.NAME, standardData.name);
}
if (fieldConfigVisitor.getFieldConfig(FieldIdEnum.TITLE) != null) {
fieldConfigVisitor.populateTextField(FieldIdEnum.TITLE, titleString);
}
if (fieldConfigVisitor.getFieldConfig(FieldIdEnum.DESCRIPTION) != null) {
fieldConfigVisitor.populateTextField(FieldIdEnum.DESCRIPTION, descriptionString);
}
FieldConfigBase uomFieldConfig = fieldConfigManager.get(FieldIdEnum.UOM);
if (uomFieldConfig != null) {
uomFieldConfig.updateAttributeSelection(SelectedSymbol.getInstance().isRasterSymbol());
String uomString = UnitsOfMeasure.getInstance().convert(standardData.unit);
fieldConfigVisitor.populateField(FieldIdEnum.UOM, getFilterFactory().literal(uomString));
}
}
Aggregations