Search in sources :

Example 1 with VersionData

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

the class FieldConfigVendorOptionTest method testVendorOptionsUpdated.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigVendorOption#vendorOptionsUpdated(java.util.List)}.
 */
@Test
public void testVendorOptionsUpdated() {
    RasterSymbolizerDetails panel = new RasterSymbolizerDetails();
    VendorOptionRasterFactory vendorOptionRasterFactory = new VendorOptionRasterFactory(getClass(), panel);
    // CHECKSTYLE:OFF
    List<VendorOptionInterface> veList = vendorOptionRasterFactory.getVendorOptionList("com.sldeditor.ui.detail.vendor.geoserver.raster.VOGeoServerContrastEnhancementNormalizeOverall");
    for (VendorOptionInterface extension : veList) {
        extension.setParentPanel(panel);
    }
    FieldConfigVendorOption field = new FieldConfigVendorOption(new FieldConfigCommonData(Double.class, FieldIdEnum.NAME, "label", false), veList);
    field.vendorOptionsUpdated(null);
    field.createUI();
    List<VersionData> vendorOptionVersionsList = new ArrayList<VersionData>();
    vendorOptionVersionsList.add(VersionData.getLatestVersion(GeoServerVendorOption.class));
    field.vendorOptionsUpdated(vendorOptionVersionsList);
}
Also used : VendorOptionRasterFactory(com.sldeditor.ui.detail.vendor.geoserver.raster.VendorOptionRasterFactory) GeoServerVendorOption(com.sldeditor.common.vendoroption.GeoServerVendorOption) FieldConfigVendorOption(com.sldeditor.ui.detail.config.FieldConfigVendorOption) VersionData(com.sldeditor.common.vendoroption.VersionData) RasterSymbolizerDetails(com.sldeditor.ui.detail.RasterSymbolizerDetails) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) ArrayList(java.util.ArrayList) VendorOptionInterface(com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface) Test(org.junit.Test)

Example 2 with VersionData

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

the class PrefManager method setVendorOptionList.

/**
 * Sets the vendor option list.
 *
 * @param vendorOptionVersionList the new vendor option list
 * @param saveChange the save change flag
 */
private void setVendorOptionList(List<VersionData> vendorOptionVersionList, boolean saveChange) {
    if (vendorOptionVersionList == null) {
        vendorOptionVersionList = new ArrayList<VersionData>();
        vendorOptionVersionList.add(VendorOptionManager.getInstance().getDefaultVendorOptionVersion().getLatest());
    }
    if (!cmpList(this.prefData.getVendorOptionVersionList(), vendorOptionVersionList)) {
        this.prefData.setVendorOptionVersionList(vendorOptionVersionList);
        List<String> vendorOptionVersionStringList = new ArrayList<String>();
        for (VersionData versionData : vendorOptionVersionList) {
            vendorOptionVersionStringList.add(versionData.getEncodedString());
        }
        if (saveChange) {
            // When running integration tests don't update users preferences
            if (propertyManagerInstance != null) {
                propertyManagerInstance.updateValue(VENDOROPTIONS_FIELD, vendorOptionVersionStringList);
            }
        }
    }
}
Also used : VersionData(com.sldeditor.common.vendoroption.VersionData) ArrayList(java.util.ArrayList)

Example 3 with VersionData

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

the class PrefManager method finish.

/**
 * Finish.
 */
public void finish() {
    if (propertyManagerInstance != null) {
        PrefData newPrefData = new PrefData();
        newPrefData.setCheckAppVersionOnStartUp(propertyManagerInstance.getBooleanValue(CHECK_APP_VERSION_ON_STARTUP_FIELD, true));
        newPrefData.setUseAntiAlias(propertyManagerInstance.getBooleanValue(USE_ANTI_ALIAS_FIELD, true));
        List<String> stringList = propertyManagerInstance.getStringListValue(VENDOROPTIONS_FIELD);
        List<VersionData> vendorOptionVersionList = new ArrayList<VersionData>();
        if (stringList != null) {
            for (String string : stringList) {
                VersionData versionData = VersionData.getDecodedString(string);
                if (versionData != null) {
                    vendorOptionVersionList.add(versionData);
                }
            }
        }
        VersionData defaultVendorOption = VendorOptionManager.getInstance().getDefaultVendorOptionVersionData();
        if (!vendorOptionVersionList.contains(defaultVendorOption)) {
            vendorOptionVersionList.add(defaultVendorOption);
        }
        newPrefData.setVendorOptionVersionList(vendorOptionVersionList);
        newPrefData.setBackgroundColour(propertyManagerInstance.getColourValue(BACKGROUND_COLOUR_FIELD, Color.WHITE));
        newPrefData.setSaveLastFolderView(propertyManagerInstance.getBooleanValue(SAVE_LAST_FOLDER_VIEWED_FIELD, false));
        String folderName = propertyManagerInstance.getStringValue(LAST_FOLDER_VIEWED_FIELD, null);
        if (folderName != null) {
            newPrefData.setLastViewedKey(PrefDataLastViewedEnum.FOLDER);
            newPrefData.setLastFolderViewed(folderName);
        }
        String geoServerConnection = propertyManagerInstance.getStringValue(LAST_GEOSERVER_VIEWED_FIELD, null);
        if (geoServerConnection != null) {
            newPrefData.setLastViewedKey(PrefDataLastViewedEnum.GEOSERVER);
            newPrefData.setLastFolderViewed(geoServerConnection);
        }
        newPrefData.setUiLayoutClass(propertyManagerInstance.getStringValue(UILAYOUT_FIELD, null));
        setPrefData(newPrefData);
    }
}
Also used : VersionData(com.sldeditor.common.vendoroption.VersionData) ArrayList(java.util.ArrayList)

Example 4 with VersionData

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

the class VendorOptionMenuUtils method createMenu.

/**
 * Creates the menu.
 *
 * @param versionDataList the list version data
 * @return the list
 */
public static List<ValueComboBoxDataGroup> createMenu(List<VersionData> versionDataList) {
    if (dataSelectionList.isEmpty()) {
        Map<String, List<ValueComboBoxData>> map = new HashMap<String, List<ValueComboBoxData>>();
        List<String> keyOrderList = new ArrayList<String>();
        if (versionDataList != null) {
            for (VersionData versionData : versionDataList) {
                String key = getKey(versionData);
                List<ValueComboBoxData> dataList = map.get(key);
                if (dataList == null) {
                    dataList = new ArrayList<ValueComboBoxData>();
                    map.put(key, dataList);
                    keyOrderList.add(key);
                }
                VendorOptionVersion vendorOptionVersion = new VendorOptionVersion(versionData.getVendorOptionType(), versionData);
                ValueComboBoxData value = new ValueComboBoxData(versionData.getVersionString(), versionData.getVersionString(), vendorOptionVersion, String.class);
                dataList.add(value);
                valueMap.put(versionData.getVersionString(), value);
            }
            // Add groups to menu combo
            for (String key : keyOrderList) {
                List<ValueComboBoxData> dataList = map.get(key);
                ValueComboBoxDataGroup group = new ValueComboBoxDataGroup(key + ".x", dataList, (dataList.size() > 1));
                dataSelectionList.add(group);
            }
        }
    }
    return dataSelectionList;
}
Also used : ValueComboBoxDataGroup(com.sldeditor.ui.widgets.ValueComboBoxDataGroup) HashMap(java.util.HashMap) VersionData(com.sldeditor.common.vendoroption.VersionData) VendorOptionVersion(com.sldeditor.common.vendoroption.VendorOptionVersion) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) ValueComboBoxData(com.sldeditor.ui.widgets.ValueComboBoxData)

Example 5 with VersionData

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

the class VendorOptionTableModel method getVendorOptionVersionList.

/**
 * Gets the vendor option version list.
 *
 * @return the vendor option version list
 */
public List<VersionData> getVendorOptionVersionList() {
    List<VersionData> localVendorOptionList = new ArrayList<VersionData>();
    localVendorOptionList.add(VendorOptionManager.getInstance().getDefaultVendorOptionVersionData());
    // Add all non-Not Set values
    for (VersionData versionData : selectedVersionList) {
        if (!versionData.isNotSet()) {
            localVendorOptionList.add(versionData);
        }
    }
    return localVendorOptionList;
}
Also used : VersionData(com.sldeditor.common.vendoroption.VersionData) ArrayList(java.util.ArrayList)

Aggregations

VersionData (com.sldeditor.common.vendoroption.VersionData)56 Test (org.junit.Test)36 ArrayList (java.util.ArrayList)26 VendorOptionVersion (com.sldeditor.common.vendoroption.VendorOptionVersion)13 GeoServerVendorOption (com.sldeditor.common.vendoroption.GeoServerVendorOption)9 PrefData (com.sldeditor.common.preferences.PrefData)7 VendorOptionInfo (com.sldeditor.common.vendoroption.info.VendorOptionInfo)5 Color (java.awt.Color)5 SLDData (com.sldeditor.common.data.SLDData)4 VendorOptionTypeInterface (com.sldeditor.common.vendoroption.VendorOptionTypeInterface)4 File (java.io.File)4 VendorOptionTableModel (com.sldeditor.common.vendoroption.selection.VendorOptionTableModel)3 ValueComboBoxDataGroup (com.sldeditor.ui.widgets.ValueComboBoxDataGroup)3 IOException (java.io.IOException)3 LinkedHashMap (java.util.LinkedHashMap)3 DataSourcePropertiesInterface (com.sldeditor.common.DataSourcePropertiesInterface)2 StyleWrapper (com.sldeditor.common.data.StyleWrapper)2 JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 JsonParser (com.google.gson.JsonParser)1