Search in sources :

Example 31 with FieldConfigCommonData

use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.

the class FieldConfigWKTTest method testGetFieldList.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.FieldConfigWKT#getFieldList(com.sldeditor.ui.detail.GraphicPanelFieldManager)}.
 */
@Test
public void testGetFieldList() {
    boolean valueOnly = true;
    FieldConfigWKT field = new FieldConfigWKT(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    assertEquals(1, field.getFieldList(null).size());
}
Also used : FieldConfigWKT(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.FieldConfigWKT) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) Test(org.junit.Test)

Example 32 with FieldConfigCommonData

use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.

the class FieldConfigWKTTest method testRevertToDefaultValue.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.FieldConfigWKT#revertToDefaultValue()}.
 */
@Test
public void testRevertToDefaultValue() {
    boolean valueOnly = true;
    FieldConfigWKT field = new FieldConfigWKT(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    field.revertToDefaultValue();
    field.createUI();
    field.revertToDefaultValue();
}
Also used : FieldConfigWKT(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.FieldConfigWKT) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) Test(org.junit.Test)

Example 33 with FieldConfigCommonData

use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.

the class ExtractGeometryFieldTest method testGetGeometryField.

/**
 * Test method for {@link com.sldeditor.ui.detail.ExtractGeometryField#getGeometryField(com.sldeditor.ui.detail.config.FieldConfigPopulation)}.
 */
@Test
public void testGetGeometryField() {
    assertNull(ExtractGeometryField.getGeometryField(null));
    FieldIdEnum fieldId = FieldIdEnum.GEOMETRY;
    GraphicPanelFieldManager fieldConfigManager = new GraphicPanelFieldManager(Geometry.class);
    FieldConfigGeometry geometryField = new FieldConfigGeometry(new FieldConfigCommonData(Geometry.class, fieldId, "label", true), "button");
    geometryField.createUI();
    fieldConfigManager.add(fieldId, geometryField);
    FieldConfigPopulation obj = new FieldConfigPopulation(fieldConfigManager);
    // Try valid geometry field name
    geometryField.populateField("ValidTestField");
    Expression actualExpression = ExtractGeometryField.getGeometryField(obj);
    assertNotNull(actualExpression);
    // Try invalid geometry field name
    geometryField.populateField("");
    actualExpression = ExtractGeometryField.getGeometryField(obj);
    assertNull(actualExpression);
    // Try invalid geometry field name
    geometryField.populateField("    ");
    actualExpression = ExtractGeometryField.getGeometryField(obj);
    assertNull(actualExpression);
    // Try when there is no geometry field
    obj = new FieldConfigPopulation(fieldConfigManager);
    actualExpression = ExtractGeometryField.getGeometryField(obj);
    assertNull(actualExpression);
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) FieldConfigGeometry(com.sldeditor.ui.detail.config.FieldConfigGeometry) FieldConfigPopulation(com.sldeditor.ui.detail.config.FieldConfigPopulation) FieldConfigGeometry(com.sldeditor.ui.detail.config.FieldConfigGeometry) Expression(org.opengis.filter.expression.Expression) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) GraphicPanelFieldManager(com.sldeditor.ui.detail.GraphicPanelFieldManager) Test(org.junit.Test)

Example 34 with FieldConfigCommonData

use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.

the class FieldConfigBaseTest method testFireDataChanged.

/**
 * Test method for {@link com.sldeditor.ui.detail.config.FieldConfigBase#fireDataChanged()}.
 */
@Test
public void testFireDataChanged() {
    boolean valueOnly = true;
    FieldIdEnum expectedFieldId = FieldIdEnum.NAME;
    String expectedLabel = "test label";
    TestFieldConfigBase field = new TestFieldConfigBase(new FieldConfigCommonData(String.class, expectedFieldId, expectedLabel, valueOnly));
    TestUpdateSymbolInterface listener = new TestUpdateSymbolInterface();
    field.addDataChangedListener(listener);
    assertFalse(listener.hasBeenCalled());
    Controller.getInstance().setPopulating(true);
    field.testFireDataChanged();
    assertFalse(listener.hasBeenCalled());
    Controller.getInstance().setPopulating(false);
    field.testFireDataChanged();
    assertTrue(listener.hasBeenCalled());
// Leave the is populating flag as false otherwise a load of tests will fail
}
Also used : FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigString(com.sldeditor.ui.detail.config.FieldConfigString) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) Test(org.junit.Test)

Example 35 with FieldConfigCommonData

use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.

the class FieldConfigBaseTest method testExpressionUpdated.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigBase#expressionUpdated(org.opengis.filter.expression.Expression)}.
 */
@Test
public void testExpressionUpdated() {
    FieldIdEnum expectedFieldId = FieldIdEnum.NAME;
    String expectedLabel = "test label";
    TestFieldConfigBase field = new TestFieldConfigBase(new FieldConfigCommonData(String.class, expectedFieldId, expectedLabel, false));
    TestUpdateSymbolInterface listener = new TestUpdateSymbolInterface();
    field.addDataChangedListener(listener);
    String expressionName = "test expression";
    assertFalse(listener.hasBeenCalled());
    FilterFactory ff = CommonFactoryFinder.getFilterFactory();
    Expression testExpression = ff.literal(expressionName);
    field.expressionUpdated(testExpression);
    assertTrue(listener.hasBeenCalled());
    assertEquals(ExpressionTypeEnum.E_EXPRESSION, field.getExpressionType());
    Expression expression = field.getExpression();
    assertTrue(expressionName.compareTo(expression.toString()) == 0);
}
Also used : Expression(org.opengis.filter.expression.Expression) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigString(com.sldeditor.ui.detail.config.FieldConfigString) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) FilterFactory(org.opengis.filter.FilterFactory) Test(org.junit.Test)

Aggregations

FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)322 Test (org.junit.Test)316 Geometry (com.vividsolutions.jts.geom.Geometry)69 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)54 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)44 FieldConfigString (com.sldeditor.ui.detail.config.FieldConfigString)38 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)34 FieldConfigColour (com.sldeditor.ui.detail.config.FieldConfigColour)24 StyleBuilder (org.geotools.styling.StyleBuilder)24 FieldConfigMarker (com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker)22 UndoEvent (com.sldeditor.common.undo.UndoEvent)20 FieldConfigSlider (com.sldeditor.ui.detail.config.FieldConfigSlider)20 FieldConfigSymbolType (com.sldeditor.ui.detail.config.FieldConfigSymbolType)20 Expression (org.opengis.filter.expression.Expression)20 FieldConfigWindBarbs (com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs)18 PointFillDetails (com.sldeditor.ui.detail.PointFillDetails)17 FieldConfigTTF (com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF)17 FieldConfigFilename (com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename)16 FieldConfigArrow (com.sldeditor.ui.detail.vendor.geoserver.marker.arrow.FieldConfigArrow)16 FieldConfigWKT (com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.FieldConfigWKT)16