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);
}
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);
}
}
}
}
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);
}
}
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;
}
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;
}
Aggregations