Search in sources :

Example 21 with VendorOptionVersion

use of com.sldeditor.common.vendoroption.VendorOptionVersion in project sldeditor by robward-scisys.

the class FieldConfigSymbolType method addField.

/**
 * Adds the field to the symbol type field.
 *
 * @param symbolType the symbol type
 */
public void addField(FieldState symbolType) {
    if (symbolType != null) {
        FieldConfigBase fieldConfig = symbolType.getConfigField();
        Class<?> panelId = symbolType.getClass();
        VendorOptionVersion vendorOption = symbolType.getVendorOption();
        if (fieldConfig == null) {
            ConsoleManager.getInstance().error(this, "FieldConfigSymbolType.addPanel passed a field config as null");
        } else {
            // Add to card layout
            containingPanel.add(fieldConfig.getPanel(), panelId.getName());
            fieldConfigMap.put(panelId, fieldConfig);
            vendorOptionMap.put(panelId, vendorOption);
            fieldConfig.setExpressionUpdateListener(this);
            fieldConfig.setParent(this);
        }
    }
}
Also used : VendorOptionVersion(com.sldeditor.common.vendoroption.VendorOptionVersion)

Example 22 with VendorOptionVersion

use of com.sldeditor.common.vendoroption.VendorOptionVersion in project sldeditor by robward-scisys.

the class VOGeoServerFTSCompositeTest method testVOGeoServerFTSComposite.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSComposite#VOGeoServerFTSComposite(java.lang.Class)}.
 */
@Test
public void testVOGeoServerFTSComposite() {
    Class<FeatureTypeStyleDetails> panelId = FeatureTypeStyleDetails.class;
    VOGeoServerFTSComposite obj = new VOGeoServerFTSComposite(panelId);
    assertEquals(panelId, obj.getPanelId());
    assertNotNull(obj.getFieldDataManager());
    assertNotNull(obj.getPanel());
    assertTrue(obj.isDataPresent());
    assertNotNull(obj.getVendorOptionInfo());
    // Check getVendorOptionVersion
    VendorOptionVersion vendorOption = obj.getVendorOption();
    assertEquals(GeoServerVendorOption.class, vendorOption.getClassType());
    String actualVersionString = vendorOption.getEarliest().getVersionString();
    String expectedVersionString = "2.7.0";
    assertEquals(expectedVersionString, actualVersionString);
    obj.setParentPanel(null);
    assertNull(obj.getParentPanel());
    obj.preLoadSymbol();
    List<VendorOptionPresent> vendorOptionsPresentList = new ArrayList<VendorOptionPresent>();
    String testString = "test";
    obj.getMinimumVersion(null, testString, vendorOptionsPresentList);
    assertTrue(vendorOptionsPresentList.isEmpty());
    StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
    FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
    obj.getMinimumVersion(null, fts, vendorOptionsPresentList);
    assertEquals(0, vendorOptionsPresentList.size());
    // Valid string
    String expectedValue = "copy,0.42";
    fts.getOptions().put(FeatureTypeStyle.COMPOSITE, expectedValue);
    obj.getMinimumVersion(null, fts, vendorOptionsPresentList);
    assertEquals(1, vendorOptionsPresentList.size());
    obj.populate(fts);
    obj.updateSymbol(fts);
    String actualValue = fts.getOptions().get(FeatureTypeStyle.COMPOSITE);
    assertEquals(actualValue, expectedValue);
    // No opacity
    expectedValue = "source-in";
    fts.getOptions().put(FeatureTypeStyle.COMPOSITE, expectedValue);
    obj.populate(fts);
    obj.updateSymbol(fts);
    actualValue = fts.getOptions().get(FeatureTypeStyle.COMPOSITE);
    assertEquals(actualValue, expectedValue);
    // Invalid string
    expectedValue = "invalid";
    fts.getOptions().put(FeatureTypeStyle.COMPOSITE, expectedValue);
    obj.populate(fts);
    obj.updateSymbol(fts);
    actualValue = fts.getOptions().get(FeatureTypeStyle.COMPOSITE);
    assertEquals(actualValue, "copy");
    // Increase code coverage
    obj.populate((PolygonSymbolizer) null);
    obj.updateSymbol((PolygonSymbolizer) null);
    obj.populate((RasterSymbolizer) null);
    obj.updateSymbol((RasterSymbolizer) null);
    obj.populate((TextSymbolizer) null);
    obj.updateSymbol((TextSymbolizer) null);
    obj.populate((SelectedSymbol) null);
    obj.dataChanged(FieldIdEnum.VO_FTS_COMPOSITE_OPACITY);
}
Also used : VendorOptionPresent(com.sldeditor.common.vendoroption.minversion.VendorOptionPresent) StyleFactoryImpl(org.geotools.styling.StyleFactoryImpl) VendorOptionVersion(com.sldeditor.common.vendoroption.VendorOptionVersion) FeatureTypeStyleDetails(com.sldeditor.ui.detail.FeatureTypeStyleDetails) ArrayList(java.util.ArrayList) VOGeoServerFTSComposite(com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSComposite) FeatureTypeStyle(org.geotools.styling.FeatureTypeStyle) Test(org.junit.Test)

Example 23 with VendorOptionVersion

use of com.sldeditor.common.vendoroption.VendorOptionVersion in project sldeditor by robward-scisys.

the class VOGeoServerFTSRuleEvaluationTest method testVOGeoServerFTSRuleEvaluation.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSRuleEvaluationTest#VOGeoServerFTSRuleEvaluationTest(java.lang.Class)}.
 */
@Test
public void testVOGeoServerFTSRuleEvaluation() {
    Class<FeatureTypeStyleDetails> panelId = FeatureTypeStyleDetails.class;
    VOGeoServerFTSRuleEvaluation obj = new VOGeoServerFTSRuleEvaluation(panelId);
    assertEquals(panelId, obj.getPanelId());
    assertNotNull(obj.getFieldDataManager());
    assertNotNull(obj.getPanel());
    assertTrue(obj.isDataPresent());
    assertNotNull(obj.getVendorOptionInfo());
    // Check getVendorOptionVersion
    VendorOptionVersion vendorOption = obj.getVendorOption();
    assertEquals(GeoServerVendorOption.class, vendorOption.getClassType());
    String actualVersionString = vendorOption.getEarliest().getVersionString();
    String expectedVersionString = "2.4.0";
    assertEquals(expectedVersionString, actualVersionString);
    obj.setParentPanel(null);
    assertNull(obj.getParentPanel());
    obj.preLoadSymbol();
    List<VendorOptionPresent> vendorOptionsPresentList = new ArrayList<VendorOptionPresent>();
    String testString = "test";
    obj.getMinimumVersion(null, testString, vendorOptionsPresentList);
    assertTrue(vendorOptionsPresentList.isEmpty());
    StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
    FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
    obj.getMinimumVersion(null, fts, vendorOptionsPresentList);
    assertEquals(0, vendorOptionsPresentList.size());
    // Valid string - first
    String expectedValue = "first";
    fts.getOptions().put(FeatureTypeStyle.KEY_EVALUATION_MODE, expectedValue);
    obj.getMinimumVersion(null, fts, vendorOptionsPresentList);
    assertEquals(1, vendorOptionsPresentList.size());
    obj.populate(fts);
    obj.updateSymbol(fts);
    String actualValue = fts.getOptions().get(FeatureTypeStyle.KEY_EVALUATION_MODE);
    assertEquals(actualValue, expectedValue);
    // Valid string - all
    expectedValue = "all";
    fts.getOptions().put(FeatureTypeStyle.KEY_EVALUATION_MODE, expectedValue);
    obj.populate(fts);
    obj.updateSymbol(fts);
    actualValue = fts.getOptions().get(FeatureTypeStyle.KEY_EVALUATION_MODE);
    assertEquals(actualValue, expectedValue);
    // Invalid string
    expectedValue = "invalid";
    fts.getOptions().put(FeatureTypeStyle.KEY_EVALUATION_MODE, expectedValue);
    obj.populate(fts);
    obj.updateSymbol(fts);
    actualValue = fts.getOptions().get(FeatureTypeStyle.KEY_EVALUATION_MODE);
    assertEquals("all", actualValue);
    // Increase code coverage
    obj.populate((PolygonSymbolizer) null);
    obj.updateSymbol((PolygonSymbolizer) null);
    obj.populate((RasterSymbolizer) null);
    obj.updateSymbol((RasterSymbolizer) null);
    obj.populate((TextSymbolizer) null);
    obj.updateSymbol((TextSymbolizer) null);
    obj.populate((SelectedSymbol) null);
    obj.dataChanged(FieldIdEnum.VO_FTS_RULE_EVALUATION_OPTION);
}
Also used : VendorOptionPresent(com.sldeditor.common.vendoroption.minversion.VendorOptionPresent) StyleFactoryImpl(org.geotools.styling.StyleFactoryImpl) VOGeoServerFTSRuleEvaluation(com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSRuleEvaluation) VendorOptionVersion(com.sldeditor.common.vendoroption.VendorOptionVersion) FeatureTypeStyleDetails(com.sldeditor.ui.detail.FeatureTypeStyleDetails) ArrayList(java.util.ArrayList) FeatureTypeStyle(org.geotools.styling.FeatureTypeStyle) Test(org.junit.Test)

Aggregations

VendorOptionVersion (com.sldeditor.common.vendoroption.VendorOptionVersion)23 Test (org.junit.Test)16 VersionData (com.sldeditor.common.vendoroption.VersionData)13 ArrayList (java.util.ArrayList)8 VendorOptionPresent (com.sldeditor.common.vendoroption.minversion.VendorOptionPresent)4 FeatureTypeStyle (org.geotools.styling.FeatureTypeStyle)4 VendorOptionInfo (com.sldeditor.common.vendoroption.info.VendorOptionInfo)3 FeatureTypeStyleDetails (com.sldeditor.ui.detail.FeatureTypeStyleDetails)3 StyleFactoryImpl (org.geotools.styling.StyleFactoryImpl)3 GeoServerVendorOption (com.sldeditor.common.vendoroption.GeoServerVendorOption)2 ValueComboBoxData (com.sldeditor.ui.widgets.ValueComboBoxData)2 File (java.io.File)2 DataSourcePropertiesInterface (com.sldeditor.common.DataSourcePropertiesInterface)1 SLDData (com.sldeditor.common.data.SLDData)1 PrefData (com.sldeditor.common.preferences.PrefData)1 VendorOptionInfoModel (com.sldeditor.common.vendoroption.info.VendorOptionInfoModel)1 ParseXML (com.sldeditor.common.xml.ParseXML)1 XMLFieldConfigString (com.sldeditor.common.xml.ui.XMLFieldConfigString)1 SLDEditorFile (com.sldeditor.datasource.SLDEditorFile)1 EnvVar (com.sldeditor.filter.v2.envvar.EnvVar)1