Search in sources :

Example 6 with FieldConfigVendorOption

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

the class FieldConfigVendorOptionTest method testGenerateExpression.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigVendorOption#generateExpression()}. Test
 * method for {@link com.sldeditor.ui.detail.config.FieldConfigVendorOption#getStringValue()}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigVendorOption#populateExpression(java.lang.Object)}.
 */
@Test
public void testGenerateExpression() {
    boolean valueOnly = true;
    List<VendorOptionInterface> veList = null;
    FieldConfigVendorOption field = new FieldConfigVendorOption(new FieldConfigCommonData(Double.class, FieldIdEnum.NAME, "label", valueOnly), veList);
    assertNull(field.getStringValue());
    field.populateExpression(null);
}
Also used : FieldConfigVendorOption(com.sldeditor.ui.detail.config.FieldConfigVendorOption) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) VendorOptionInterface(com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface) Test(org.junit.Test)

Example 7 with FieldConfigVendorOption

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

the class MultiOptionGroup method populateOptionGroup.

/**
 * Populate option group.
 *
 * @param fieldConfigManager the field config manager
 * @param optionBox the option box
 * @param groupConfigList the group config list
 */
private void populateOptionGroup(GraphicPanelFieldManager fieldConfigManager, Box optionBox, List<GroupConfigInterface> groupConfigList) {
    for (GroupConfigInterface groupConfigI : groupConfigList) {
        groupConfigI.createTitle(optionBox, null);
        if (groupConfigI instanceof GroupConfig) {
            GroupConfig groupConfig = (GroupConfig) groupConfigI;
            for (FieldConfigBase field : groupConfig.getFieldConfigList()) {
                field.createUI();
                field.revertToDefaultValue();
                FieldPanel component = field.getPanel();
                optionBox.add(component);
                fieldConfigManager.addField(field);
                optionFieldList.add(field);
                if (field instanceof FieldConfigVendorOption) {
                    ((FieldConfigVendorOption) field).addToOptionBox(optionBox);
                }
            }
            populateOptionGroup(fieldConfigManager, optionBox, groupConfig.getSubGroupList());
        } else if (groupConfigI instanceof MultiOptionGroup) {
            MultiOptionGroup multiOptionGroupConfig = (MultiOptionGroup) groupConfigI;
            fieldConfigManager.addMultiOptionGroup(multiOptionGroupConfig);
            multiOptionGroupConfig.createUI(fieldConfigManager, optionBox, parent, this.panelId);
        }
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) FieldConfigVendorOption(com.sldeditor.ui.detail.config.FieldConfigVendorOption) FieldPanel(com.sldeditor.ui.widgets.FieldPanel)

Example 8 with FieldConfigVendorOption

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

the class FieldConfigVendorOptionTest method testRevertToDefaultValue.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigVendorOption#revertToDefaultValue()}.
 */
@Test
public void testRevertToDefaultValue() {
    List<VendorOptionInterface> veList = null;
    boolean valueOnly = true;
    FieldConfigVendorOption field = new FieldConfigVendorOption(new FieldConfigCommonData(Double.class, FieldIdEnum.NAME, "label", valueOnly), veList);
    field.revertToDefaultValue();
    field.createUI();
    field.revertToDefaultValue();
}
Also used : FieldConfigVendorOption(com.sldeditor.ui.detail.config.FieldConfigVendorOption) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) VendorOptionInterface(com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface) Test(org.junit.Test)

Example 9 with FieldConfigVendorOption

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

the class FieldConfigVendorOptionTest method testCreateCopy.

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

        public TestFieldConfigVendorOption(FieldConfigCommonData commonData, List<VendorOptionInterface> veList) {
            super(commonData, veList);
        }

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

Aggregations

FieldConfigVendorOption (com.sldeditor.ui.detail.config.FieldConfigVendorOption)9 FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)8 Test (org.junit.Test)8 VendorOptionInterface (com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface)5 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)2 ArrayList (java.util.ArrayList)2 GeoServerVendorOption (com.sldeditor.common.vendoroption.GeoServerVendorOption)1 VersionData (com.sldeditor.common.vendoroption.VersionData)1 RasterSymbolizerDetails (com.sldeditor.ui.detail.RasterSymbolizerDetails)1 VendorOptionRasterFactory (com.sldeditor.ui.detail.vendor.geoserver.raster.VendorOptionRasterFactory)1 FieldPanel (com.sldeditor.ui.widgets.FieldPanel)1 List (java.util.List)1