Search in sources :

Example 6 with GeoServerLayer

use of com.sldeditor.common.data.GeoServerLayer in project sldeditor by robward-scisys.

the class GeoServerReadProgress method populateLayers.

/**
 * Populate layers.
 *
 * @param connection the connection
 * @param geoServerNode the geo server node
 */
private void populateLayers(GeoServerConnection connection, GeoServerNode geoServerNode) {
    removeNode(geoServerNode, LAYERS_NODE_TITLE);
    GeoServerLayerHeadingNode layersNode = new GeoServerLayerHeadingNode(this.handler, connection, LAYERS_NODE_TITLE);
    geoServerNode.add(layersNode);
    Map<String, List<GeoServerLayer>> layerMap = geoServerLayerMap.get(connection);
    for (String workspaceName : layerMap.keySet()) {
        List<GeoServerLayer> layerList = layerMap.get(workspaceName);
        GeoServerWorkspaceNode workspaceNode = new GeoServerWorkspaceNode(this.handler, connection, workspaceName, false);
        // It is key to invoke this on the TreeModel, and NOT DefaultMutableTreeNode
        treeModel.insertNodeInto(workspaceNode, layersNode, layersNode.getChildCount());
        for (GeoServerLayer layer : layerList) {
            GeoServerLayerNode childNode = new GeoServerLayerNode(this.handler, layer);
            // It is key to invoke this on the TreeModel, and NOT DefaultMutableTreeNode
            treeModel.insertNodeInto(childNode, workspaceNode, workspaceNode.getChildCount());
        }
    }
}
Also used : GeoServerLayer(com.sldeditor.common.data.GeoServerLayer) GeoServerWorkspaceNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerWorkspaceNode) List(java.util.List) GeoServerLayerHeadingNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerLayerHeadingNode) GeoServerLayerNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerLayerNode)

Example 7 with GeoServerLayer

use of com.sldeditor.common.data.GeoServerLayer in project sldeditor by robward-scisys.

the class GeoServerLayerTest method testGeoServerLayer.

/**
 * Test method for {@link com.sldeditor.common.data.GeoServerLayer#GeoServerLayer()}.
 */
@Test
public void testGeoServerLayer() {
    String layerWorkspace = "workspace";
    String layerName = "layer";
    GeoServerLayer layer = new GeoServerLayer(layerWorkspace, layerName);
    assertTrue(layer.getLayerWorkspace().compareTo(layerWorkspace) == 0);
    assertTrue(layer.getLayerName().compareTo(layerName) == 0);
}
Also used : GeoServerLayer(com.sldeditor.common.data.GeoServerLayer) Test(org.junit.Test)

Example 8 with GeoServerLayer

use of com.sldeditor.common.data.GeoServerLayer in project sldeditor by robward-scisys.

the class GeoServerLayerTest method testGetStyleString.

/**
 * Test method for {@link com.sldeditor.common.data.GeoServerLayer#getStyleString()}.
 * Test method for {@link com.sldeditor.common.data.GeoServerLayer#setDefaultWorkspaceName(java.lang.String)}.
 */
@Test
public void testGetStyleString() {
    GeoServerLayer.setDefaultWorkspaceName(null);
    StyleWrapper styleWrapper = new StyleWrapper();
    String style = "style";
    styleWrapper.setStyle(style);
    String workspace = "workspace";
    styleWrapper.setWorkspace(workspace);
    GeoServerLayer layer = new GeoServerLayer();
    layer.setStyle(styleWrapper);
    String styleString = layer.getStyleString();
    assertTrue(style.compareTo(styleString) == 0);
    String defaultWorkspaceName = "Default workspace";
    styleWrapper.setWorkspace(defaultWorkspaceName);
    layer.setStyle(styleWrapper);
    GeoServerLayer.setDefaultWorkspaceName(defaultWorkspaceName);
    String styleString2 = layer.getStyleString();
    assertTrue(style.compareTo(styleString2) == 0);
    styleWrapper.setWorkspace(workspace);
    layer.setStyle(styleWrapper);
    String styleString3 = layer.getStyleString();
    assertEquals(styleString3.compareTo(workspace + ":" + style), 0);
}
Also used : GeoServerLayer(com.sldeditor.common.data.GeoServerLayer) StyleWrapper(com.sldeditor.common.data.StyleWrapper) Test(org.junit.Test)

Example 9 with GeoServerLayer

use of com.sldeditor.common.data.GeoServerLayer in project sldeditor by robward-scisys.

the class GeoServerLayerTest method testGetLayerWorkspace.

/**
 * Test method for {@link com.sldeditor.common.data.GeoServerLayer#getLayerWorkspace()}.
 * Test method for {@link com.sldeditor.common.data.GeoServerLayer#setLayerWorkspace(java.lang.String)}.
 */
@Test
public void testGetLayerWorkspace() {
    String layerWorkspace = "test workspace";
    GeoServerLayer layer = new GeoServerLayer();
    layer.setLayerWorkspace(layerWorkspace);
    assertEquals(layer.getLayerWorkspace(), layerWorkspace);
}
Also used : GeoServerLayer(com.sldeditor.common.data.GeoServerLayer) Test(org.junit.Test)

Example 10 with GeoServerLayer

use of com.sldeditor.common.data.GeoServerLayer in project sldeditor by robward-scisys.

the class GeoServerLayerTest method testGetLayerName.

/**
 * Test method for {@link com.sldeditor.common.data.GeoServerLayer#getLayerName()}.
 * Test method for {@link com.sldeditor.common.data.GeoServerLayer#setLayerName(java.lang.String)}.
 */
@Test
public void testGetLayerName() {
    String layerName = "test layer";
    GeoServerLayer layer = new GeoServerLayer();
    layer.setLayerName(layerName);
    assertEquals(layer.getLayerName(), layerName);
}
Also used : GeoServerLayer(com.sldeditor.common.data.GeoServerLayer) Test(org.junit.Test)

Aggregations

GeoServerLayer (com.sldeditor.common.data.GeoServerLayer)18 Test (org.junit.Test)11 StyleWrapper (com.sldeditor.common.data.StyleWrapper)8 GeoServerConnection (com.sldeditor.common.data.GeoServerConnection)5 List (java.util.List)5 GeoServerLayerNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerLayerNode)4 GeoServerInput (com.sldeditor.extension.filesystem.geoserver.GeoServerInput)3 SLDFileHandlerTest (com.sldeditor.test.unit.extension.filesystem.file.sld.SLDFileHandlerTest)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 GeoServerLayerHeadingNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerLayerHeadingNode)2 GeoServerWorkspaceNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerWorkspaceNode)2 TreeNode (javax.swing.tree.TreeNode)2 NodeInterface (com.sldeditor.common.NodeInterface)1 FileSystemInterface (com.sldeditor.common.filesystem.FileSystemInterface)1 GeoServerNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode)1 GeoServerOverallNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerOverallNode)1 GeoServerReadProgress (com.sldeditor.extension.filesystem.geoserver.GeoServerReadProgress)1 RESTLayer (it.geosolutions.geoserver.rest.decoder.RESTLayer)1 RESTLayerList (it.geosolutions.geoserver.rest.decoder.RESTLayerList)1