use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.
the class GraphicPanelFieldManagerTest method testAddMultiOptionGroup.
/**
* Test method for {@link com.sldeditor.ui.detail.GraphicPanelFieldManager#addMultiOptionGroup(com.sldeditor.ui.detail.config.base.MultiOptionGroup)}.
* Test method for {@link com.sldeditor.ui.detail.GraphicPanelFieldManager#getMultiOptionGroup(java.lang.Class, com.sldeditor.common.xml.ui.GroupIdEnum)}.
*/
@Test
public void testAddMultiOptionGroup() {
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);
MultiOptionGroup multiOption = new MultiOptionGroup();
GroupIdEnum expectedGroupId = GroupIdEnum.FILLSYMBOL;
multiOption.setId(expectedGroupId);
mgr.addMultiOptionGroup(multiOption);
MultiOptionGroup actualValue = mgr.getMultiOptionGroup(null, null);
assertNull(actualValue);
actualValue = mgr.getMultiOptionGroup(expectedPanelId, expectedGroupId);
assertEquals(multiOption, actualValue);
}
use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.
the class GraphicPanelFieldManagerTest method testAddGraphicPanelFieldManager.
/**
* Test method for {@link com.sldeditor.ui.detail.GraphicPanelFieldManager#add(com.sldeditor.ui.detail.GraphicPanelFieldManager)}.
*/
@Test
public void testAddGraphicPanelFieldManager() {
// Set up manager 1
Class<?> expectedPanelId = StrokeDetails.class;
GraphicPanelFieldManager mgr1 = new GraphicPanelFieldManager(expectedPanelId);
FieldIdEnum expectedFieldId = FieldIdEnum.NAME;
FieldConfigString stringField = new FieldConfigString(new FieldConfigCommonData(String.class, expectedFieldId, "test label", false), "button text");
mgr1.addField(stringField);
assertTrue(mgr1.getFields(FieldConfigBoolean.class).isEmpty());
assertEquals(1, mgr1.getFields(FieldConfigString.class).size());
// Set up manager 2
Class<?> expectedPanelId2 = PointFillDetails.class;
GraphicPanelFieldManager mgr2 = new GraphicPanelFieldManager(expectedPanelId2);
FieldIdEnum expectedFieldId2 = FieldIdEnum.ANGLE;
FieldConfigDouble doubleField = new FieldConfigDouble(new FieldConfigCommonData(Double.class, expectedFieldId2, "test label", false));
mgr2.addField(doubleField);
assertEquals(1, mgr2.getFields(FieldConfigDouble.class).size());
// Add manager 2 to manager 1
mgr1.add(mgr2);
FieldIdEnum actualFieldId = mgr1.getFieldEnum(expectedPanelId, stringField);
assertEquals(expectedFieldId, actualFieldId);
actualFieldId = mgr1.getFieldEnum(expectedPanelId2, doubleField);
assertEquals(expectedFieldId2, actualFieldId);
}
use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.
the class GraphicPanelFieldManagerTest method testGraphicPanelFieldManager.
/**
* Test method for {@link com.sldeditor.ui.detail.GraphicPanelFieldManager#GraphicPanelFieldManager(java.lang.Class)}.
* Test method for {@link com.sldeditor.ui.detail.GraphicPanelFieldManager#get(com.sldeditor.ui.detail.config.FieldId)}.
* Test method for {@link com.sldeditor.ui.detail.GraphicPanelFieldManager#get(com.sldeditor.common.xml.ui.FieldIdEnum)}.
* Test method for {@link com.sldeditor.ui.detail.GraphicPanelFieldManager#getFieldEnum(java.lang.Class, com.sldeditor.ui.detail.config.FieldConfigBase)}.
* Test method for {@link com.sldeditor.ui.detail.GraphicPanelFieldManager#getComponentId()}.
* Test method for {@link com.sldeditor.ui.detail.GraphicPanelFieldManager#addField(com.sldeditor.ui.detail.config.FieldConfigBase)}.
* Test method for {@link com.sldeditor.ui.detail.GraphicPanelFieldManager#add(com.sldeditor.ui.detail.config.FieldId, com.sldeditor.ui.detail.config.FieldConfigBase)}.
* Test method for {@link com.sldeditor.ui.detail.GraphicPanelFieldManager#getData(java.lang.Class, com.sldeditor.ui.detail.config.FieldId)}.
*/
@Test
public void testGraphicPanelFieldManager() {
// Try with a null panel id
GraphicPanelFieldManager mgr = new GraphicPanelFieldManager(null);
assertNull(mgr.get(FieldIdEnum.FILTER));
Class<?> expectedPanelId = StrokeDetails.class;
mgr = new GraphicPanelFieldManager(expectedPanelId);
assertEquals(FieldIdEnum.UNKNOWN, mgr.getFieldEnum(PointFillDetails.class, null));
assertEquals(expectedPanelId, mgr.getComponentId());
// Now try with a field
FieldIdEnum expectedFieldId = FieldIdEnum.NAME;
FieldConfigString stringField = new FieldConfigString(new FieldConfigCommonData(String.class, expectedFieldId, "test label", false), "button text");
mgr.addField(null);
mgr.addField(stringField);
FieldIdEnum actualFieldId = mgr.getFieldEnum(expectedPanelId, stringField);
assertEquals(expectedFieldId, actualFieldId);
assertNull(mgr.getData(null, null));
assertNull(mgr.getData(expectedPanelId, null));
assertEquals(stringField, mgr.getData(expectedPanelId, actualFieldId));
}
Aggregations