Search in sources :

Example 11 with VersionData

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

the class RenderTransformationDialog method main.

/**
 * The main method.
 *
 * @param args the arguments
 */
public static void main(String[] args) {
    GeoServerConnectionManagerInterface dummyInterface = new GeoServerConnectionManagerInterface() {

        @Override
        public List<GeoServerConnection> getConnectionList() {
            List<GeoServerConnection> list = new ArrayList<GeoServerConnection>();
            GeoServerConnection connection = new GeoServerConnection();
            connection.setConnectionName("Test");
            try {
                connection.setUrl(new URL("http://localhost:8080/geoserver"));
                connection.setUserName("admin");
                connection.setPassword("geoserver");
                list.add(connection);
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }
            return list;
        }

        @Override
        public void updateList() {
        }

        @Override
        public GeoServerConnection getConnection(String connectionDataName) {
            return null;
        }

        @Override
        public void readPropertyFile(GeoServerReadProgress progress) {
        }

        @Override
        public Map<GeoServerConnection, GeoServerClientInterface> getConnectionMap() {
            return null;
        }

        @Override
        public void removeConnection(GeoServerConnection connection) {
        }

        @Override
        public void addNewConnection(GeoServerReadProgress progress, GeoServerConnection newConnectionDetails) {
        }
    };
    List<VersionData> vendorOptionList = new ArrayList<VersionData>();
    vendorOptionList.add(VersionData.getLatestVersion(GeoServerVendorOption.class));
    VendorOptionManager.getInstance().setSelectedVendorOptions(vendorOptionList);
    RenderTransformationDialog dlg = new RenderTransformationDialog(dummyInterface);
    dlg.showDialog(null);
}
Also used : MalformedURLException(java.net.MalformedURLException) GeoServerVendorOption(com.sldeditor.common.vendoroption.GeoServerVendorOption) ArrayList(java.util.ArrayList) GeoServerConnection(com.sldeditor.common.data.GeoServerConnection) URL(java.net.URL) GeoServerClientInterface(com.sldeditor.extension.filesystem.geoserver.client.GeoServerClientInterface) VersionData(com.sldeditor.common.vendoroption.VersionData) GeoServerConnectionManagerInterface(com.sldeditor.common.connection.GeoServerConnectionManagerInterface) GeoServerReadProgress(com.sldeditor.extension.filesystem.geoserver.GeoServerReadProgress)

Example 12 with VersionData

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

the class CheckUpdate method shouldUpdate.

/**
 * Should update.
 *
 * @param currentVersion the current version
 * @return true, if successful
 */
public boolean shouldUpdate(String currentVersion) {
    if (client != null) {
        latestData = client.getLatest();
        if (latestData != null) {
            VersionData current = VersionData.decode(latestData.getVersion().getVendorOptionType(), currentVersion);
            int result = current.compareTo(latestData.getVersion());
            return (result == -1);
        }
    }
    return false;
}
Also used : VersionData(com.sldeditor.common.vendoroption.VersionData)

Example 13 with VersionData

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

the class PrefDataTest method testVendorOptionVersionList.

/**
 * Test method for {@link com.sldeditor.common.preferences.PrefData#getVendorOptionVersionList()}.
 * Test method for {@link com.sldeditor.common.preferences.PrefData#setVendorOptionVersionList()}.
 */
@Test
public void testVendorOptionVersionList() {
    PrefData prefData = new PrefData();
    List<VersionData> vendorOptionList = new ArrayList<VersionData>();
    vendorOptionList.add(VendorOptionManager.getInstance().getDefaultVendorOptionVersionData());
    prefData.setVendorOptionVersionList(vendorOptionList);
    assertEquals(vendorOptionList, prefData.getVendorOptionVersionList());
}
Also used : PrefData(com.sldeditor.common.preferences.PrefData) VersionData(com.sldeditor.common.vendoroption.VersionData) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 14 with VersionData

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

the class PrefDataTest method testClone.

/**
 * Test method for {@link com.sldeditor.common.preferences.PrefData#clone()}.
 */
@Test
public void testClone() {
    PrefData prefData = new PrefData();
    prefData.setUseAntiAlias(true);
    List<VersionData> vendorOptionList = new ArrayList<VersionData>();
    vendorOptionList.add(VendorOptionManager.getInstance().getDefaultVendorOptionVersionData());
    prefData.setVendorOptionVersionList(vendorOptionList);
    String uiLayoutClass = "perfect curve";
    prefData.setUiLayoutClass(uiLayoutClass);
    prefData.setLastFolderViewed("last folder");
    PrefData newObj = prefData.clone();
    assertEquals(newObj.getBackgroundColour(), prefData.getBackgroundColour());
    assertEquals(newObj.getUiLayoutClass(), prefData.getUiLayoutClass());
    assertEquals(newObj.getVendorOptionVersionList(), prefData.getVendorOptionVersionList());
    assertEquals(newObj.isUseAntiAlias(), prefData.isUseAntiAlias());
    assertEquals(newObj.isSaveLastFolderView(), prefData.isSaveLastFolderView());
    assertEquals(newObj.getLastViewedKey(), prefData.getLastViewedKey());
    assertEquals(newObj.getLastFolderViewed(), prefData.getLastFolderViewed());
    assertEquals(newObj.isCheckAppVersionOnStartUp(), prefData.isCheckAppVersionOnStartUp());
}
Also used : PrefData(com.sldeditor.common.preferences.PrefData) VersionData(com.sldeditor.common.vendoroption.VersionData) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 15 with VersionData

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

the class SLDEditorFileTest method testVendorOptionsUpdated.

/**
 * Test method for {@link com.sldeditor.datasource.SLDEditorFile#vendorOptionsUpdated()}.
 */
@Test
public void testVendorOptionsUpdated() {
    SLDEditorFile.destroyInstance();
    DummyDataUpdate dataUpdateListener = new DummyDataUpdate();
    SLDEditorFile.getInstance().addSLDEditorFileUpdateListener(dataUpdateListener);
    assertFalse(dataUpdateListener.dataEditedFlag);
    SLDEditorFile.getInstance().vendorOptionsUpdated(null);
    assertFalse(dataUpdateListener.dataEditedFlag);
    List<VersionData> vendorOptionVersionsList = new ArrayList<VersionData>();
    SLDEditorFile.getInstance().vendorOptionsUpdated(vendorOptionVersionsList);
    assertFalse(dataUpdateListener.dataEditedFlag);
    StyleWrapper styleWrapper = new StyleWrapper("workspace", "style");
    SLDData sldData = new SLDData(styleWrapper, "contents");
    SLDEditorFile.getInstance().setSLDData(sldData);
    SLDEditorFile.getInstance().vendorOptionsUpdated(vendorOptionVersionsList);
    assertTrue(dataUpdateListener.dataEditedFlag);
}
Also used : SLDData(com.sldeditor.common.data.SLDData) StyleWrapper(com.sldeditor.common.data.StyleWrapper) VersionData(com.sldeditor.common.vendoroption.VersionData) ArrayList(java.util.ArrayList) Test(org.junit.Test)

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