use of com.sldeditor.ui.detail.GraphicPanelFieldManager in project sldeditor by robward-scisys.
the class SingleSymbolUI method getFieldDataManager.
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.SymbolPanelInterface#getFieldDataManager()
*/
@Override
public GraphicPanelFieldManager getFieldDataManager() {
GraphicPanelFieldManager mergedData = new GraphicPanelFieldManager(null);
panelSymbolizerDetails.mergeFieldDataManager(mergedData);
return mergedData;
}
use of com.sldeditor.ui.detail.GraphicPanelFieldManager 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.ui.detail.GraphicPanelFieldManager 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.ui.detail.GraphicPanelFieldManager 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));
}
use of com.sldeditor.ui.detail.GraphicPanelFieldManager in project sldeditor by robward-scisys.
the class FieldConfigMarkerTest method testSetValue.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker#setValue(com.sldeditor.ui.detail.GraphicPanelFieldManager, com.sldeditor.ui.detail.config.FieldConfigSymbolType, org.opengis.style.GraphicalSymbol)}.
*/
@Test
public void testSetValue() {
GraphicPanelFieldManager fieldConfigManager = null;
Class<?> panelId = PointFillDetails.class;
fieldConfigManager = new GraphicPanelFieldManager(panelId);
// Test it with non null values
FieldIdEnum colourFieldId = FieldIdEnum.FILL_COLOUR;
FieldConfigColour colourField = new FieldConfigColour(new FieldConfigCommonData(panelId, colourFieldId, "", false));
colourField.createUI();
String expectedColourValue = "#012345";
colourField.setTestValue(null, expectedColourValue);
double expectedOpacityValue = 0.72;
FieldConfigSlider opacityField = new FieldConfigSlider(new FieldConfigCommonData(panelId, colourFieldId, "", false));
opacityField.createUI();
opacityField.populateField(expectedOpacityValue);
FieldConfigBase symbolSelectionField = new FieldConfigSymbolType(new FieldConfigCommonData(panelId, colourFieldId, "", false));
symbolSelectionField.createUI();
fieldConfigManager.add(colourFieldId, colourField);
FieldIdEnum opacityFieldId = FieldIdEnum.OVERALL_OPACITY;
fieldConfigManager.add(opacityFieldId, opacityField);
FieldIdEnum symbolSelectionFieldId = FieldIdEnum.SYMBOL_TYPE;
fieldConfigManager.add(symbolSelectionFieldId, symbolSelectionField);
boolean valueOnly = true;
ColourFieldConfig fillConfig = new ColourFieldConfig(GroupIdEnum.FILL, FieldIdEnum.FILL_COLOUR, FieldIdEnum.OVERALL_OPACITY, FieldIdEnum.STROKE_WIDTH);
ColourFieldConfig strokeConfig = new ColourFieldConfig(GroupIdEnum.STROKE, FieldIdEnum.STROKE_STROKE_COLOUR, FieldIdEnum.OVERALL_OPACITY, FieldIdEnum.STROKE_FILL_WIDTH);
FieldConfigMarker field2 = new FieldConfigMarker(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), fillConfig, strokeConfig, null);
field2.setValue(null, null, null, null, null);
field2.setValue(null, fieldConfigManager, null, null, null);
StyleBuilder styleBuilder = new StyleBuilder();
Mark marker = styleBuilder.createMark("star");
field2.setValue(null, null, null, null, marker);
field2.setValue(null, fieldConfigManager, null, null, marker);
}
Aggregations