use of com.sldeditor.ui.detail.config.FieldConfigSymbolType 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 = PointSymbolizer.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, false));
colourField.createUI();
String expectedColourValue = "#012345";
colourField.setTestValue(null, expectedColourValue);
double expectedOpacityValue = 0.72;
FieldConfigSlider opacityField = new FieldConfigSlider(new FieldConfigCommonData(panelId, colourFieldId, "", false, false));
opacityField.createUI();
opacityField.populateField(expectedOpacityValue);
FieldConfigBase symbolSelectionField = new FieldConfigSymbolType(new FieldConfigCommonData(panelId, colourFieldId, "", false, 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(PointSymbolizer.class, FieldIdEnum.NAME, "test label", valueOnly, false), 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("shape://plus");
field2.setValue(null, null, null, null, marker);
field2.setValue(PointSymbolizer.class, fieldConfigManager, null, null, marker);
GroupConfig strokeGroup = new GroupConfig();
strokeGroup.setId(strokeConfig.getGroup());
fieldConfigManager.addGroup(strokeGroup);
GroupConfig fillGroup = new GroupConfig();
fillGroup.setId(fillConfig.getGroup());
fieldConfigManager.addGroup(fillGroup);
field2.setValue(PointSymbolizer.class, fieldConfigManager, null, null, marker);
}
use of com.sldeditor.ui.detail.config.FieldConfigSymbolType in project sldeditor by robward-scisys.
the class FieldConfigMarkerTest method testGetFieldList.
/**
* Test method for {@link
* com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker#getFieldList(com.sldeditor.ui.detail.GraphicPanelFieldManager)}.
*/
@Test
public void testGetFieldList() {
Class<?> panelId = PointFillDetails.class;
// Test it with non null values
FieldIdEnum colourFieldId = FieldIdEnum.FILL_COLOUR;
FieldConfigColour colourField = new FieldConfigColour(new FieldConfigCommonData(panelId, colourFieldId, "", false, false));
colourField.createUI();
String expectedColourValue = "#012345";
colourField.setTestValue(null, expectedColourValue);
double expectedOpacityValue = 0.72;
FieldConfigSlider opacityField = new FieldConfigSlider(new FieldConfigCommonData(panelId, colourFieldId, "", false, false));
opacityField.createUI();
opacityField.populateField(expectedOpacityValue);
FieldConfigBase symbolSelectionField = new FieldConfigSymbolType(new FieldConfigCommonData(panelId, colourFieldId, "", false, false));
symbolSelectionField.createUI();
GraphicPanelFieldManager fieldConfigManager = new GraphicPanelFieldManager(panelId);
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 field = new FieldConfigMarker(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly, false), fillConfig, strokeConfig, null);
assertTrue(field.getFieldList(null).isEmpty());
Map<FieldIdEnum, FieldConfigBase> actualFieldList = field.getFieldList(fieldConfigManager);
assertFalse(actualFieldList.isEmpty());
assertEquals(5, actualFieldList.size());
}
use of com.sldeditor.ui.detail.config.FieldConfigSymbolType in project sldeditor by robward-scisys.
the class FieldConfigMarkerTest method testGetFill.
/**
* Test method for {@link
* com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker#getFill(org.opengis.style.GraphicFill,
* com.sldeditor.ui.detail.GraphicPanelFieldManager)}.
*/
@Test
public void testGetFill() {
// Test it with null values
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 field = new FieldConfigMarker(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly, false), fillConfig, strokeConfig, null);
assertNull(field.getStringValue());
GraphicFill graphicFill = null;
GraphicPanelFieldManager fieldConfigManager = null;
Fill actualValue = field.getFill(graphicFill, fieldConfigManager);
assertNull(actualValue);
Class<?> panelId = PointFillDetails.class;
fieldConfigManager = new GraphicPanelFieldManager(panelId);
actualValue = field.getFill(graphicFill, fieldConfigManager);
assertNotNull(actualValue);
assertNull(actualValue.getColor());
assertNull(actualValue.getGraphicFill());
assertNull(actualValue.getOpacity());
// Test it with non null values
FieldIdEnum colourFieldId = FieldIdEnum.FILL_COLOUR;
FieldConfigColour colourField = new FieldConfigColour(new FieldConfigCommonData(panelId, colourFieldId, "", false, false));
colourField.createUI();
String expectedColourValue = "#012345";
colourField.setTestValue(null, expectedColourValue);
double expectedOpacityValue = 0.72;
FieldConfigSlider opacityField = new FieldConfigSlider(new FieldConfigCommonData(panelId, colourFieldId, "", false, false));
opacityField.createUI();
opacityField.populateField(expectedOpacityValue);
FieldConfigBase symbolSelectionField = new FieldConfigSymbolType(new FieldConfigCommonData(panelId, colourFieldId, "", false, 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);
FieldConfigMarker field2 = new FieldConfigMarker(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly, false), fillConfig, strokeConfig, symbolSelectionFieldId);
actualValue = field2.getFill(graphicFill, fieldConfigManager);
assertNotNull(actualValue);
LiteralExpressionImpl literalExpressionImpl = (LiteralExpressionImpl) actualValue.getColor();
String actualColourString = literalExpressionImpl.toString();
assertTrue(actualColourString.compareTo(expectedColourValue) == 0);
StyleBuilder styleBuilder = new StyleBuilder();
graphicFill = styleBuilder.createGraphic();
actualValue = field2.getFill(graphicFill, fieldConfigManager);
assertNull(actualValue.getColor());
assertNull(actualValue.getOpacity());
}
use of com.sldeditor.ui.detail.config.FieldConfigSymbolType in project sldeditor by robward-scisys.
the class FieldConfigSymbolTypeTest method testSetVisible.
/**
* Test method for {@link
* com.sldeditor.ui.detail.config.FieldConfigSymbolType#setVisible(boolean)}.
*/
@Test
public void testSetVisible() {
boolean valueOnly = true;
FieldConfigSymbolType field = new FieldConfigSymbolType(new FieldConfigCommonData(Integer.class, FieldIdEnum.NAME, "label", valueOnly, false));
boolean expectedValue = true;
field.setVisible(expectedValue);
field.createUI();
field.setVisible(expectedValue);
expectedValue = false;
field.setVisible(expectedValue);
}
use of com.sldeditor.ui.detail.config.FieldConfigSymbolType in project sldeditor by robward-scisys.
the class FieldConfigSymbolTypeTest method testAttributeSelection.
/**
* Test method for {@link
* com.sldeditor.ui.detail.config.FieldConfigSymbolType#attributeSelection(java.lang.String)}.
*/
@Test
public void testAttributeSelection() {
boolean valueOnly = true;
FieldConfigSymbolType field = new FieldConfigSymbolType(new FieldConfigCommonData(Integer.class, FieldIdEnum.NAME, "label", valueOnly, false));
field.attributeSelection(null);
// Do nothing
}
Aggregations