Search in sources :

Example 1 with MinimumVersion

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

the class VendorOptionManager method loadSLDFile.

/**
 * Load SLD file.
 *
 * @param uiMgr the ui mgr
 * @param sld the sld
 * @param sldData the sld data
 */
public void loadSLDFile(GetMinimumVersionInterface uiMgr, StyledLayerDescriptor sld, SLDDataInterface sldData) {
    if (sldData != null) {
        List<VersionData> selectedVendorOptionVersion = null;
        String messageString = null;
        if (sldData.getSldEditorFile() == null) {
            MinimumVersion minimumVersion = new MinimumVersion(uiMgr);
            minimumVersion.findMinimumVersion(sld);
            // Find out what the default is
            PrefData prefData = PrefManager.getInstance().getPrefData();
            selectedVendorOptionVersion = minimumVersion.getMinimumVersion(prefData.getVendorOptionVersionList());
            messageString = Localisation.getString(VendorOptionManager.class, "VendorOptionManager.loadedFromFile");
        } else {
            selectedVendorOptionVersion = sldData.getVendorOptionList();
            messageString = Localisation.getString(VendorOptionManager.class, "VendorOptionManager.loadedFromSLDEditorFile");
        }
        if (selectedVendorOptionVersion != null) {
            setSelectedVendorOptions(selectedVendorOptionVersion);
            List<VersionData> listCopy = new ArrayList<>(selectedVendorOptionVersion);
            Collections.sort(listCopy);
            VersionData versionData = listCopy.get(listCopy.size() - 1);
            ConsoleManager.getInstance().information(this, String.format("%s : %s", messageString, VendorOptionStatus.getVersionString(versionData)));
        }
    }
}
Also used : MinimumVersion(com.sldeditor.common.vendoroption.minversion.MinimumVersion) PrefData(com.sldeditor.common.preferences.PrefData) ArrayList(java.util.ArrayList)

Aggregations

PrefData (com.sldeditor.common.preferences.PrefData)1 MinimumVersion (com.sldeditor.common.vendoroption.minversion.MinimumVersion)1 ArrayList (java.util.ArrayList)1