use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.
the class FieldConfigMarkerTest method testPopulateFieldOverrideMap.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker#populateFieldOverrideMap(java.lang.Class, com.sldeditor.ui.detail.FieldEnableState)}.
*/
@Test
public void testPopulateFieldOverrideMap() {
// Test it with non null values
FieldIdEnum colourFieldId = FieldIdEnum.FILL_COLOUR;
Class<?> panelId = PointFillDetails.class;
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();
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);
ColourFieldConfig strokeConfig = new ColourFieldConfig(GroupIdEnum.STROKE, FieldIdEnum.STROKE_STROKE_COLOUR, FieldIdEnum.OVERALL_OPACITY, FieldIdEnum.STROKE_FILL_WIDTH);
boolean valueOnly = true;
ColourFieldConfig fillConfig = new ColourFieldConfig(GroupIdEnum.FILL, FieldIdEnum.FILL_COLOUR, FieldIdEnum.OVERALL_OPACITY, FieldIdEnum.STROKE_WIDTH);
FieldConfigMarker field = new FieldConfigMarker(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), fillConfig, strokeConfig, null);
field.populateFieldOverrideMap(String.class, null);
field.populateFieldOverrideMap(PointSymbolizerDetails.class, null);
}
use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.
the class FieldConfigTTFTest method testGetValue.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF#getValue(com.sldeditor.ui.detail.GraphicPanelFieldManager, org.opengis.filter.expression.Expression, boolean, boolean)}.
*/
@Test
public void testGetValue() {
GraphicPanelFieldManager fieldConfigManager = null;
Class<?> panelId = PointFillDetails.class;
fieldConfigManager = new GraphicPanelFieldManager(panelId);
FieldIdEnum colourFieldId = FieldIdEnum.FILL_COLOUR;
FieldConfigColour colourField = new FieldConfigColour(new FieldConfigCommonData(panelId, colourFieldId, "", false));
colourField.createUI();
String expectedColourValue = "#012345";
colourField.setTestValue(null, expectedColourValue);
fieldConfigManager.add(colourFieldId, colourField);
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);
boolean valueOnly = true;
FieldConfigTTF field = new FieldConfigTTF(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), fillConfig, strokeConfig, null);
List<GraphicalSymbol> actualValue = field.getValue(null, null, false, false);
assertTrue(actualValue.isEmpty());
field.createUI();
actualValue = field.getValue(null, null, false, false);
assertTrue(actualValue.isEmpty());
actualValue = field.getValue(fieldConfigManager, null, false, false);
assertTrue(actualValue.size() == 1);
}
use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.
the class GraphicPanelFieldManagerTest method testGetFields.
/**
* Test method for {@link com.sldeditor.ui.detail.GraphicPanelFieldManager#getFields(java.lang.Class)}.
*/
@Test
public void testGetFields() {
GraphicPanelFieldManager mgr = new GraphicPanelFieldManager(null);
assertTrue(mgr.getFields(null).isEmpty());
Class<?> expectedPanelId = StrokeDetails.class;
mgr = new GraphicPanelFieldManager(expectedPanelId);
FieldIdEnum expectedFieldId = FieldIdEnum.NAME;
FieldConfigString stringField = new FieldConfigString(new FieldConfigCommonData(String.class, expectedFieldId, "test label", false), "button text");
mgr.addField(stringField);
assertTrue(mgr.getFields(FieldConfigBoolean.class).isEmpty());
assertEquals(1, mgr.getFields(FieldConfigString.class).size());
}
use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.
the class GraphicPanelFieldManagerTest method testAddGroup.
/**
* Test method for {@link com.sldeditor.ui.detail.GraphicPanelFieldManager#getGroup(java.lang.Class, com.sldeditor.common.xml.ui.GroupIdEnum)}.
* Test method for {@link com.sldeditor.ui.detail.GraphicPanelFieldManager#addGroup(com.sldeditor.ui.detail.config.base.GroupConfig)}.
*/
@Test
public void testAddGroup() {
Class<?> expectedPanelId = StrokeDetails.class;
GraphicPanelFieldManager mgr = new GraphicPanelFieldManager(expectedPanelId);
FieldIdEnum expectedFieldId = FieldIdEnum.NAME;
FieldConfigString stringField = new FieldConfigString(new FieldConfigCommonData(String.class, expectedFieldId, "test label", false), "button text");
mgr.addField(stringField);
GroupConfig multiOption = new GroupConfig();
GroupIdEnum expectedGroupId = GroupIdEnum.FILLSYMBOL;
multiOption.setId(expectedGroupId);
mgr.addGroup(multiOption);
GroupConfigInterface actualValue = mgr.getGroup(null, null);
assertNull(actualValue);
actualValue = mgr.getGroup(expectedPanelId, expectedGroupId);
assertEquals(multiOption, actualValue);
}
use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.
the class FieldConfigEnumTest method testGetFieldEnableState.
/**
* Test method for {@link com.sldeditor.ui.detail.config.FieldConfigEnum#getFieldEnableState()}.
*/
@Test
public void testGetFieldEnableState() {
UndoManager.getInstance().setPopulationCheck(Controller.getInstance());
SymbolTypeConfig s1 = new SymbolTypeConfig(Integer.class);
s1.addOption("key1", "Value 1");
s1.addOption("key2", "Value 2");
s1.addOption("key3", "Value 3");
s1.addField(FieldIdEnum.ANCHOR_POINT_H, true);
s1.addField(FieldIdEnum.ANCHOR_POINT_V, false);
List<SymbolTypeConfig> configList = new ArrayList<SymbolTypeConfig>();
configList.add(s1);
boolean valueOnly = true;
FieldConfigEnum field = new FieldConfigEnum(new FieldConfigCommonData(Integer.class, FieldIdEnum.NAME, "label", valueOnly));
field.addConfig(configList);
// Now create the ui
field.createUI();
field.populateField("key3");
Map<FieldIdEnum, Boolean> actualMap = field.getFieldEnableState();
assertEquals(actualMap.get(FieldIdEnum.ANCHOR_POINT_H), Boolean.TRUE);
assertEquals(actualMap.get(FieldIdEnum.ANCHOR_POINT_V), Boolean.FALSE);
UndoManager.getInstance().setPopulationCheck(null);
}
Aggregations