Search in sources :

Example 1 with PrefData

use of com.sldeditor.common.preferences.PrefData in project sldeditor by robward-scisys.

the class PrefPanelTest method testShowDialog.

/**
 * Test method for
 * {@link com.sldeditor.ui.preferences.PrefPanel#showDialog(com.sldeditor.common.preferences.PrefData)}.
 */
@Test
public void testShowDialog() {
    TestPrefPanel panel = new TestPrefPanel();
    panel.testPopulate(null);
    PrefManager.destroyInstance();
    PrefData prefData = PrefManager.getInstance().getPrefData();
    prefData.setUiLayoutClass("com.sldeditor.ui.layout.SLDEditorDefaultLayout");
    panel.testPopulate(prefData);
    PrefData actual = panel.getPrefData();
    assertTrue(prefData.equals(actual));
}
Also used : PrefData(com.sldeditor.common.preferences.PrefData) Test(org.junit.Test)

Example 2 with PrefData

use of com.sldeditor.common.preferences.PrefData 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)

Example 3 with PrefData

use of com.sldeditor.common.preferences.PrefData in project sldeditor by robward-scisys.

the class PrefPanel method getPrefData.

/**
 * Get preference data.
 *
 * @return the preference data
 */
public PrefData getPrefData() {
    PrefData prefData = new PrefData();
    prefData.setCheckAppVersionOnStartUp(chckbxCheckAppVersionOnStartUp.isSelected());
    prefData.setUseAntiAlias(chckbxUseAntiAlias.isSelected());
    prefData.setVendorOptionVersionList(model.getVendorOptionVersionList());
    String uiLayoutClass = uiLayoutMap.get(uiLayoutComboBox.getSelectedItem());
    prefData.setUiLayoutClass(uiLayoutClass);
    prefData.setSaveLastFolderView(chckbxSetSaveLastFolderViewed.isSelected());
    return prefData;
}
Also used : PrefData(com.sldeditor.common.preferences.PrefData)

Example 4 with PrefData

use of com.sldeditor.common.preferences.PrefData in project sldeditor by robward-scisys.

the class PrefDataTest method testSaveLastFolderView.

/**
 * Test method for {@link com.sldeditor.common.preferences.PrefData#getSaveLastFolderView()}.
 * Test method for {@link com.sldeditor.common.preferences.PrefData#setSaveLastFolderView(boolean)}.
 */
@Test
public void testSaveLastFolderView() {
    PrefData prefData = new PrefData();
    boolean expectedValue = true;
    prefData.setSaveLastFolderView(expectedValue);
    assertEquals(expectedValue, prefData.isSaveLastFolderView());
    expectedValue = false;
    prefData.setSaveLastFolderView(expectedValue);
    assertEquals(expectedValue, prefData.isSaveLastFolderView());
}
Also used : PrefData(com.sldeditor.common.preferences.PrefData) Test(org.junit.Test)

Example 5 with PrefData

use of com.sldeditor.common.preferences.PrefData in project sldeditor by robward-scisys.

the class PrefDataTest method testUseAntiAlias.

/**
 * Test method for {@link com.sldeditor.common.preferences.PrefData#isUseAntiAlias()}.
 */
@Test
public void testUseAntiAlias() {
    PrefData prefData = new PrefData();
    prefData.setUseAntiAlias(true);
    assertTrue(prefData.isUseAntiAlias());
    prefData.setUseAntiAlias(false);
    assertFalse(prefData.isUseAntiAlias());
}
Also used : PrefData(com.sldeditor.common.preferences.PrefData) Test(org.junit.Test)

Aggregations

PrefData (com.sldeditor.common.preferences.PrefData)20 Test (org.junit.Test)17 ArrayList (java.util.ArrayList)9 VersionData (com.sldeditor.common.vendoroption.VersionData)7 Color (java.awt.Color)5 GeoServerVendorOption (com.sldeditor.common.vendoroption.GeoServerVendorOption)3 PrefDataLastViewedEnum (com.sldeditor.common.preferences.PrefDataLastViewedEnum)2 GeoServerConnection (com.sldeditor.common.data.GeoServerConnection)1 SLDData (com.sldeditor.common.data.SLDData)1 SelectedFiles (com.sldeditor.common.filesystem.SelectedFiles)1 UndoEvent (com.sldeditor.common.undo.UndoEvent)1 VendorOptionVersion (com.sldeditor.common.vendoroption.VendorOptionVersion)1 VendorOptionInfo (com.sldeditor.common.vendoroption.info.VendorOptionInfo)1 MinimumVersion (com.sldeditor.common.vendoroption.minversion.MinimumVersion)1 VendorOptionPresent (com.sldeditor.common.vendoroption.minversion.VendorOptionPresent)1 FileSystemExtension (com.sldeditor.extension.filesystem.FileSystemExtension)1 GetMinimumVersionInterface (com.sldeditor.ui.panels.GetMinimumVersionInterface)1 File (java.io.File)1 FeatureTypeStyle (org.geotools.styling.FeatureTypeStyle)1 NamedLayer (org.geotools.styling.NamedLayer)1