Search in sources :

Example 6 with FieldConfigBoolean

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

the class FieldConfigBooleanTest method testAttributeSelection.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigBoolean#attributeSelection(java.lang.String)}.
 */
@Test
public void testAttributeSelection() {
    boolean valueOnly = true;
    FieldConfigBoolean field = new FieldConfigBoolean(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", valueOnly));
    field.attributeSelection(null);
// Does nothing
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigBoolean(com.sldeditor.ui.detail.config.FieldConfigBoolean) Test(org.junit.Test)

Example 7 with FieldConfigBoolean

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

the class FieldConfigBooleanTest method testSetEnabled.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigBoolean#internal_setEnabled(boolean)}. Test
 * method for {@link com.sldeditor.ui.detail.config.FieldConfigBoolean#isEnabled()}.
 */
@Test
public void testSetEnabled() {
    // Value only, no attribute/expression dropdown
    boolean valueOnly = true;
    FieldConfigBoolean field = new FieldConfigBoolean(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", valueOnly));
    // Text field will not have been created
    boolean expectedValue = true;
    field.internal_setEnabled(expectedValue);
    assertFalse(field.isEnabled());
    // Create text field
    field.createUI();
    assertEquals(expectedValue, field.isEnabled());
    expectedValue = false;
    field.internal_setEnabled(expectedValue);
    assertEquals(expectedValue, field.isEnabled());
    // Has attribute/expression dropdown
    valueOnly = false;
    FieldConfigBoolean field2 = new FieldConfigBoolean(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", valueOnly));
    // Text field will not have been created
    expectedValue = true;
    field2.internal_setEnabled(expectedValue);
    assertFalse(field2.isEnabled());
    // Create text field
    field2.createUI();
    assertEquals(expectedValue, field2.isEnabled());
    expectedValue = false;
    field2.internal_setEnabled(expectedValue);
    // Actual value is coming from the attribute panel, not the text field
    assertEquals(!expectedValue, field2.isEnabled());
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigBoolean(com.sldeditor.ui.detail.config.FieldConfigBoolean) Test(org.junit.Test)

Example 8 with FieldConfigBoolean

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

the class FieldConfigBooleanTest method testSetVisible.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigBoolean#setVisible(boolean)}.
 */
@Test
public void testSetVisible() {
    boolean valueOnly = true;
    FieldConfigBoolean field = new FieldConfigBoolean(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", valueOnly));
    boolean expectedValue = true;
    field.setVisible(expectedValue);
    field.createUI();
    field.setVisible(expectedValue);
    expectedValue = false;
    field.setVisible(expectedValue);
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigBoolean(com.sldeditor.ui.detail.config.FieldConfigBoolean) Test(org.junit.Test)

Example 9 with FieldConfigBoolean

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

the class FieldConfigBooleanTest method testRevertToDefaultValue.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigBoolean#revertToDefaultValue()}. Test method
 * for {@link com.sldeditor.ui.detail.config.FieldConfigBoolean#setDefaultValue(boolean)}.
 */
@Test
public void testRevertToDefaultValue() {
    boolean valueOnly = true;
    FieldConfigBoolean field = new FieldConfigBoolean(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", valueOnly));
    field.revertToDefaultValue();
    assertFalse(field.getBooleanValue());
    field.createUI();
    field.revertToDefaultValue();
    assertFalse(field.getBooleanValue());
    boolean expectedDefaultValue = true;
    field.setDefaultValue(expectedDefaultValue);
    field.revertToDefaultValue();
    assertEquals(expectedDefaultValue, field.getBooleanValue());
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigBoolean(com.sldeditor.ui.detail.config.FieldConfigBoolean) Test(org.junit.Test)

Example 10 with FieldConfigBoolean

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

the class FieldConfigBooleanTest method testCreateCopy.

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

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

        public FieldConfigPopulate callCreateCopy(FieldConfigBase fieldConfigBase) {
            return createCopy(fieldConfigBase);
        }
    }
    TestFieldConfigBoolean field = new TestFieldConfigBoolean(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", valueOnly));
    FieldConfigBoolean copy = (FieldConfigBoolean) field.callCreateCopy(null);
    assertNull(copy);
    copy = (FieldConfigBoolean) 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) FieldConfigBoolean(com.sldeditor.ui.detail.config.FieldConfigBoolean) Test(org.junit.Test)

Aggregations

FieldConfigBoolean (com.sldeditor.ui.detail.config.FieldConfigBoolean)10 FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)9 Geometry (com.vividsolutions.jts.geom.Geometry)9 Test (org.junit.Test)8 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)3 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)2 FieldConfigDouble (com.sldeditor.ui.detail.config.FieldConfigDouble)2 FieldConfigInteger (com.sldeditor.ui.detail.config.FieldConfigInteger)2 UndoEvent (com.sldeditor.common.undo.UndoEvent)1 Disjoint (com.sldeditor.filter.v2.function.geometry.Disjoint)1 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)1 FieldConfigColour (com.sldeditor.ui.detail.config.FieldConfigColour)1 FieldConfigDate (com.sldeditor.ui.detail.config.FieldConfigDate)1 FieldConfigEnum (com.sldeditor.ui.detail.config.FieldConfigEnum)1 FieldConfigGeometry (com.sldeditor.ui.detail.config.FieldConfigGeometry)1 FieldConfigMapUnits (com.sldeditor.ui.detail.config.FieldConfigMapUnits)1 FieldConfigPopulation (com.sldeditor.ui.detail.config.FieldConfigPopulation)1 FieldConfigString (com.sldeditor.ui.detail.config.FieldConfigString)1 GroupConfig (com.sldeditor.ui.detail.config.base.GroupConfig)1 GroupConfigInterface (com.sldeditor.ui.detail.config.base.GroupConfigInterface)1