Search in sources :

Example 81 with FieldIdEnum

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);
}
Also used : FieldConfigString(com.sldeditor.ui.detail.config.FieldConfigString) StrokeDetails(com.sldeditor.ui.detail.StrokeDetails) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigString(com.sldeditor.ui.detail.config.FieldConfigString) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) MultiOptionGroup(com.sldeditor.ui.detail.config.base.MultiOptionGroup) GraphicPanelFieldManager(com.sldeditor.ui.detail.GraphicPanelFieldManager) GroupIdEnum(com.sldeditor.common.xml.ui.GroupIdEnum) Test(org.junit.Test)

Example 82 with FieldIdEnum

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);
}
Also used : FieldConfigString(com.sldeditor.ui.detail.config.FieldConfigString) StrokeDetails(com.sldeditor.ui.detail.StrokeDetails) FieldConfigDouble(com.sldeditor.ui.detail.config.FieldConfigDouble) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigString(com.sldeditor.ui.detail.config.FieldConfigString) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) PointFillDetails(com.sldeditor.ui.detail.PointFillDetails) FieldConfigDouble(com.sldeditor.ui.detail.config.FieldConfigDouble) GraphicPanelFieldManager(com.sldeditor.ui.detail.GraphicPanelFieldManager) Test(org.junit.Test)

Example 83 with FieldIdEnum

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));
}
Also used : FieldConfigString(com.sldeditor.ui.detail.config.FieldConfigString) StrokeDetails(com.sldeditor.ui.detail.StrokeDetails) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigString(com.sldeditor.ui.detail.config.FieldConfigString) PointFillDetails(com.sldeditor.ui.detail.PointFillDetails) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) GraphicPanelFieldManager(com.sldeditor.ui.detail.GraphicPanelFieldManager) Test(org.junit.Test)

Aggregations

FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)83 Test (org.junit.Test)55 FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)54 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)33 FieldConfigString (com.sldeditor.ui.detail.config.FieldConfigString)28 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)27 FieldConfigColour (com.sldeditor.ui.detail.config.FieldConfigColour)17 PointFillDetails (com.sldeditor.ui.detail.PointFillDetails)16 StyleBuilder (org.geotools.styling.StyleBuilder)14 ColourFieldConfig (com.sldeditor.ui.detail.ColourFieldConfig)13 FieldConfigPopulation (com.sldeditor.ui.detail.config.FieldConfigPopulation)13 Geometry (com.vividsolutions.jts.geom.Geometry)13 Expression (org.opengis.filter.expression.Expression)13 FieldConfigSlider (com.sldeditor.ui.detail.config.FieldConfigSlider)12 FieldConfigSymbolType (com.sldeditor.ui.detail.config.FieldConfigSymbolType)12 GroupIdEnum (com.sldeditor.common.xml.ui.GroupIdEnum)10 GroupConfigInterface (com.sldeditor.ui.detail.config.base.GroupConfigInterface)8 ArrayList (java.util.ArrayList)8 Mark (org.geotools.styling.Mark)7 StrokeDetails (com.sldeditor.ui.detail.StrokeDetails)6