Search in sources :

Example 16 with FieldConfigBase

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

the class FieldConfigEnumTest method testCreateCopy.

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

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

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

Example 17 with FieldConfigBase

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

the class FieldConfigGeometryTest method testCreateCopy.

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

        public TestFieldConfigGeometry(FieldConfigCommonData commonData, String buttonText) {
            super(commonData, buttonText);
        }

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

Example 18 with FieldConfigBase

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

the class FieldConfigSliderTest method testCreateCopy.

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

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

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

Example 19 with FieldConfigBase

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

the class FontDetails method populateField.

/**
 * Populate field.
 *
 * @param emptyList the empty list
 * @param showMultipleCheckbox the show multiple checkbox
 * @param fieldId the field id
 * @param value the value
 */
private void populateField(boolean emptyList, boolean showMultipleCheckbox, FieldIdEnum fieldId, Expression value) {
    FieldConfigBase fieldConfig = fieldConfigManager.get(fieldId);
    if (fieldConfig != null) {
        if (emptyList) {
            fieldConfig.showOptionField(false);
            fieldConfig.setEnabled(false);
        } else {
            fieldConfig.setEnabled(true);
            fieldConfigVisitor.populateField(fieldId, value);
            fieldConfig.showOptionField(showMultipleCheckbox);
            boolean isSelected = (value != null);
            fieldConfig.setOptionFieldValue(isSelected);
        }
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase)

Example 20 with FieldConfigBase

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

the class BasePanel method registerForTextFieldButton.

/**
 * Register for text field button.
 *
 * @param fieldId the field id
 * @param listener the listener
 */
protected void registerForTextFieldButton(FieldIdEnum fieldId, FieldConfigStringButtonInterface listener) {
    FieldConfigBase fieldConfig = fieldConfigManager.get(fieldId);
    if (fieldConfig != null) {
        FieldConfigString textField = (FieldConfigString) fieldConfig;
        textField.addButtonPressedListener(listener);
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) FieldConfigString(com.sldeditor.ui.detail.config.FieldConfigString)

Aggregations

FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)93 FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)43 Test (org.junit.Test)42 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)27 FieldConfigColour (com.sldeditor.ui.detail.config.FieldConfigColour)22 Expression (org.opengis.filter.expression.Expression)19 Mark (org.geotools.styling.Mark)14 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)13 FieldConfigSlider (com.sldeditor.ui.detail.config.FieldConfigSlider)13 FieldConfigSymbolType (com.sldeditor.ui.detail.config.FieldConfigSymbolType)13 GroupConfigInterface (com.sldeditor.ui.detail.config.base.GroupConfigInterface)13 PointFillDetails (com.sldeditor.ui.detail.PointFillDetails)12 ColourFieldConfig (com.sldeditor.ui.detail.ColourFieldConfig)10 ArrayList (java.util.ArrayList)10 Fill (org.geotools.styling.Fill)10 GraphicFill (org.opengis.style.GraphicFill)10 GraphicalSymbol (org.opengis.style.GraphicalSymbol)10 Geometry (com.vividsolutions.jts.geom.Geometry)9 StyleBuilder (org.geotools.styling.StyleBuilder)8 FieldConfigMarker (com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker)7