Search in sources :

Example 11 with FieldConfigCommonData

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

the class FieldConfigInlineFeatureTest method testSetEnabled.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature#internal_setEnabled(boolean)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature#isEnabled()}.
 */
@Test
public void testSetEnabled() {
    FieldConfigInlineFeature field = new FieldConfigInlineFeature(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, null, true));
    // Field will not have been created
    boolean expectedValue = true;
    field.internal_setEnabled(expectedValue);
    assertFalse(field.isEnabled());
    // Create text field
    field.createUI();
    field.createUI();
    assertEquals(expectedValue, field.isEnabled());
    expectedValue = false;
    field.internal_setEnabled(expectedValue);
    assertEquals(expectedValue, field.isEnabled());
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigInlineFeature(com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature) Test(org.junit.Test)

Example 12 with FieldConfigCommonData

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

the class FieldConfigInlineFeatureTest method testCreateCopy.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature#createCopy(com.sldeditor.ui.detail.config.FieldConfigBase)}.
 */
@Test
public void testCreateCopy() {
    class TestFieldConfigInlineFeature extends FieldConfigInlineFeature {

        public TestFieldConfigInlineFeature(FieldConfigCommonData commonData) {
            super(commonData);
        }

        public FieldConfigPopulate callCreateCopy(FieldConfigBase fieldConfigBase) {
            return createCopy(fieldConfigBase);
        }
    }
    TestFieldConfigInlineFeature field = new TestFieldConfigInlineFeature(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "", true));
    FieldConfigInlineFeature copy = (FieldConfigInlineFeature) field.callCreateCopy(null);
    assertNull(copy);
    copy = (FieldConfigInlineFeature) field.callCreateCopy(field);
    assertEquals(field.getFieldId(), copy.getFieldId());
    assertTrue(field.getLabel().compareTo(copy.getLabel()) == 0);
    assertEquals(field.isValueOnly(), copy.isValueOnly());
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigInlineFeature(com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature) Test(org.junit.Test)

Example 13 with FieldConfigCommonData

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

the class FieldConfigSortByTest method testCreateCopy.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigSortBy#createCopy(com.sldeditor.ui.detail.config.FieldConfigBase)}.
 */
@Test
public void testCreateCopy() {
    boolean valueOnly = true;
    class TestFieldConfigSortBy extends FieldConfigSortBy {

        public TestFieldConfigSortBy(FieldConfigCommonData commonData) {
            super(commonData);
        }

        public FieldConfigPopulate callCreateCopy(FieldConfigBase fieldConfigBase) {
            return createCopy(fieldConfigBase);
        }
    }
    TestFieldConfigSortBy field = new TestFieldConfigSortBy(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly));
    FieldConfigSortBy copy = (FieldConfigSortBy) field.callCreateCopy(null);
    assertNull(copy);
    copy = (FieldConfigSortBy) field.callCreateCopy(field);
    assertEquals(field.getFieldId(), copy.getFieldId());
    assertTrue(field.getLabel().compareTo(copy.getLabel()) == 0);
    assertEquals(field.isValueOnly(), copy.isValueOnly());
}
Also used : FieldConfigSortBy(com.sldeditor.ui.detail.config.sortby.FieldConfigSortBy) FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) Test(org.junit.Test)

Example 14 with FieldConfigCommonData

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

the class FieldConfigSortByTest method testRevertToDefaultValue.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigSortBy#revertToDefaultValue()}. Test method
 * for
 * {@link com.sldeditor.ui.detail.config.FieldConfigSortBy#setDefaultValue(java.lang.String)}.
 * Test method for {@link com.sldeditor.ui.detail.config.FieldConfigSortBy#getStringValue()}.
 */
@Test
public void testRevertToDefaultValue() {
    boolean valueOnly = true;
    FieldConfigSortBy field = new FieldConfigSortBy(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly));
    String expectedDefaultValue = "default value";
    field.setDefaultValue(expectedDefaultValue);
    field.revertToDefaultValue();
    assertNull(field.getStringValue());
    field.createUI();
    field.revertToDefaultValue();
}
Also used : FieldConfigSortBy(com.sldeditor.ui.detail.config.sortby.FieldConfigSortBy) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) Test(org.junit.Test)

Example 15 with FieldConfigCommonData

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

the class FieldConfigSortByTest method testUndoAction.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigSortBy#undoAction(com.sldeditor.common.undo.UndoInterface)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigSortBy#redoAction(com.sldeditor.common.undo.UndoInterface)}.
 */
@Test
public void testUndoAction() {
    boolean valueOnly = true;
    FieldConfigSortBy field = new FieldConfigSortBy(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly));
    field.undoAction(null);
    field.redoAction(null);
    field.createUI();
    field.createUI();
    field.undoAction(null);
    field.redoAction(null);
    String expectedTestValue = "test A, test2 D";
    field.setTestValue(null, expectedTestValue);
    assertTrue(expectedTestValue.compareTo(field.getStringValue()) == 0);
    String expectedUndoTestValue = "test2 D";
    String expectedRedoTestValue = "test A, test2 D";
    UndoEvent undoEvent = new UndoEvent(null, FieldIdEnum.UNKNOWN, expectedUndoTestValue, expectedRedoTestValue);
    field.undoAction(undoEvent);
    assertTrue(expectedUndoTestValue.compareTo(field.getStringValue()) == 0);
    field.redoAction(undoEvent);
    assertTrue(expectedRedoTestValue.compareTo(field.getStringValue()) == 0);
}
Also used : UndoEvent(com.sldeditor.common.undo.UndoEvent) FieldConfigSortBy(com.sldeditor.ui.detail.config.sortby.FieldConfigSortBy) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) 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