use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.
the class VOGeoServerRandomFill method updateSymbol.
/**
* Update symbol.
*
* @param polygonSymbolizer the polygon symbolizer
*/
@Override
public void updateSymbol(PolygonSymbolizer polygonSymbolizer) {
Map<String, String> options = polygonSymbolizer.getOptions();
options.clear();
for (FieldIdEnum key : fieldMap.keySet()) {
internalUpdateSymbol(options, key, fieldMap.get(key));
}
}
use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.
the class FieldConfigPopulationTest method testColour.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#populateColourField(com.sldeditor.ui.detail.config.FieldId, org.opengis.filter.expression.Expression, org.opengis.filter.expression.Expression)}.
*/
@Test
public void testColour() {
FieldIdEnum fieldId = FieldIdEnum.DESCRIPTION;
GraphicPanelFieldManager fieldConfigManager = new GraphicPanelFieldManager(String.class);
FieldConfigColour colourField = new FieldConfigColour(new FieldConfigCommonData(Geometry.class, fieldId, "label", true));
colourField.createUI();
colourField.createUI();
fieldConfigManager.add(fieldId, colourField);
FieldConfigPopulation obj = new FieldConfigPopulation(fieldConfigManager);
StyleBuilder styleBuilder = new StyleBuilder();
Expression colour = styleBuilder.colorExpression(Color.red);
obj.populateColourField(fieldId, colour);
FieldIdEnum wrongFieldEnum = FieldIdEnum.ELSE_FILTER;
obj.populateColourField(wrongFieldEnum, colour);
}
use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.
the class FieldConfigPopulationTest method testDouble.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#populateDoubleField(com.sldeditor.ui.detail.config.FieldId, java.lang.Double)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#getDouble(com.sldeditor.ui.detail.config.FieldId)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#getDouble(com.sldeditor.common.xml.ui.FieldIdEnum)}.
*/
@Test
public void testDouble() {
FieldIdEnum fieldId = FieldIdEnum.DESCRIPTION;
GraphicPanelFieldManager fieldConfigManager = new GraphicPanelFieldManager(String.class);
FieldConfigDouble doubleField = new FieldConfigDouble(new FieldConfigCommonData(Geometry.class, fieldId, "label", true));
doubleField.createUI();
fieldConfigManager.add(fieldId, doubleField);
FieldConfigPopulation obj = new FieldConfigPopulation(fieldConfigManager);
double expectedValue = 1.256;
obj.populateDoubleField(fieldId, expectedValue);
assertTrue(Math.abs(expectedValue - obj.getDouble(fieldId)) < 0.001);
// This shouldn't work as it does not know about the field
FieldIdEnum wrongFieldEnum = FieldIdEnum.ELSE_FILTER;
assertTrue(Math.abs(obj.getDouble(wrongFieldEnum) - 0.0) < 0.001);
// Try with null - should revert to default value (0.0)
obj.populateDoubleField(fieldId, null);
assertTrue(Math.abs(obj.getDouble(fieldId) - 0.0) < 0.001);
}
use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.
the class FieldConfigPopulationTest method testFieldConfigPopulation.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#FieldConfigPopulation(com.sldeditor.ui.detail.GraphicPanelFieldManager)}.
*/
@Test
public void testFieldConfigPopulation() {
FieldIdEnum fieldId = FieldIdEnum.UNKNOWN;
FieldConfigPopulation obj = new FieldConfigPopulation(null);
obj.populateBooleanField(fieldId, Boolean.TRUE);
obj.populateComboBoxField(fieldId, "");
obj.populateColourField(fieldId, null);
obj.populateColourMapField(FieldIdEnum.ANCHOR_POINT_V, (ColorMap) null);
obj.populateFontField(FieldIdEnum.ANCHOR_POINT_V, (Font) null);
obj.populateTextField(fieldId, (String) null);
obj.populateDoubleField(fieldId, (Double) null);
obj.populateIntegerField(fieldId, (Integer) null);
obj.populateField(fieldId, (Expression) null);
obj.populateUserLayer(fieldId, (UserLayer) null);
obj.populateFieldTypeConstraint(fieldId, (List<FeatureTypeConstraint>) null);
assertNull(obj.getExpression(fieldId));
assertFalse(obj.getBoolean(fieldId));
assertEquals(0, obj.getInteger(fieldId));
assertTrue(Math.abs(obj.getDouble(fieldId) - 0.0) < 0.001);
assertTrue(obj.getText(fieldId).compareTo("") == 0);
assertNull(obj.getComboBox(fieldId));
assertNull(obj.getColourMap(fieldId));
assertNull(obj.getFieldConfig(fieldId));
assertNull(obj.getFeatureTypeConstraint(fieldId));
}
use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.
the class FieldConfigPopulationTest method testInteger.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#populateIntegerField(com.sldeditor.ui.detail.config.FieldId, java.lang.Integer)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#getInteger(com.sldeditor.ui.detail.config.FieldId)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#getInteger(com.sldeditor.common.xml.ui.FieldIdEnum)}.
*/
@Test
public void testInteger() {
FieldIdEnum fieldId = FieldIdEnum.DESCRIPTION;
GraphicPanelFieldManager fieldConfigManager = new GraphicPanelFieldManager(String.class);
FieldConfigInteger intField = new FieldConfigInteger(new FieldConfigCommonData(Geometry.class, fieldId, "label", true));
intField.createUI();
fieldConfigManager.add(fieldId, intField);
FieldConfigPopulation obj = new FieldConfigPopulation(fieldConfigManager);
int expectedValue = 1256;
obj.populateIntegerField(fieldId, expectedValue);
assertEquals(expectedValue, obj.getInteger(fieldId));
// This shouldn't work as it does not know about the field
FieldIdEnum wrongFieldEnum = FieldIdEnum.ELSE_FILTER;
assertEquals(0, obj.getInteger(wrongFieldEnum));
// Try with null - should revert to default value (0.0)
obj.populateIntegerField(fieldId, null);
assertEquals(0, obj.getInteger(fieldId));
}
Aggregations