Search in sources :

Example 11 with GeoServerLayer

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

the class GeoServerLayerTest method testGetConnection.

/**
 * Test method for {@link com.sldeditor.common.data.GeoServerLayer#getConnection()}.
 * Test method for {@link com.sldeditor.common.data.GeoServerLayer#setConnection(com.sldeditor.common.data.GeoServerConnection)}.
 */
@Test
public void testGetConnection() {
    GeoServerConnection connection = new GeoServerConnection();
    GeoServerLayer layer = new GeoServerLayer();
    layer.setConnection(connection);
    assertEquals(connection, layer.getConnection());
}
Also used : GeoServerLayer(com.sldeditor.common.data.GeoServerLayer) GeoServerConnection(com.sldeditor.common.data.GeoServerConnection) Test(org.junit.Test)

Example 12 with GeoServerLayer

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

the class GeoServerLayerNodeTest method testGeoServerLayerNode.

/**
 * Test method for {@link com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerLayerNode#GeoServerLayerNode(com.sldeditor.common.filesystem.FileSystemInterface, com.sldeditor.common.data.GeoServerLayer)}.
 */
@Test
public void testGeoServerLayerNode() {
    FileSystemInterface fileHandler = new DummyFileSystemInput();
    GeoServerLayer layer = new GeoServerLayer();
    String expectedLayerName = "layer name";
    layer.setLayerName(expectedLayerName);
    GeoServerLayerNode node = new GeoServerLayerNode(fileHandler, layer);
    assertEquals(layer, node.getLayer());
    assertEquals(fileHandler, node.getHandler());
    assertEquals(BuiltInDataFlavour.GEOSERVER_LAYER_DATAITEM_FLAVOUR, node.getDataFlavour());
    assertNull(node.getDestinationText());
}
Also used : FileSystemInterface(com.sldeditor.common.filesystem.FileSystemInterface) GeoServerLayer(com.sldeditor.common.data.GeoServerLayer) GeoServerLayerNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerLayerNode) Test(org.junit.Test)

Example 13 with GeoServerLayer

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

the class GeoServerLayerUpdateTool method setSelectedItems.

/*
     * (non-Javadoc)
     * 
     * @see com.sldeditor.tool.ToolInterface#setSelectedItems(java.util.List, java.util.List)
     */
@Override
public void setSelectedItems(List<NodeInterface> nodeTypeList, List<SLDDataInterface> sldDataList) {
    layerList.clear();
    connection = null;
    for (NodeInterface node : nodeTypeList) {
        if (node instanceof GeoServerLayerNode) {
            GeoServerLayerNode layerNode = (GeoServerLayerNode) node;
            GeoServerLayer layer = layerNode.getLayer();
            layerList.add(layer);
            if (connection == null) {
                connection = layer.getConnection();
            }
        } else if (node instanceof GeoServerLayerHeadingNode) {
            GeoServerLayerHeadingNode layerHeadingNode = (GeoServerLayerHeadingNode) node;
            connection = layerHeadingNode.getConnection();
            for (int workspaceIndex = 0; workspaceIndex < layerHeadingNode.getChildCount(); workspaceIndex++) {
                TreeNode treeNode = layerHeadingNode.getChildAt(workspaceIndex);
                if (treeNode instanceof GeoServerWorkspaceNode) {
                    GeoServerWorkspaceNode workspaceNode = (GeoServerWorkspaceNode) treeNode;
                    extractWorkspaceLayers(workspaceNode);
                }
            }
        } else if (node instanceof GeoServerWorkspaceNode) {
            GeoServerWorkspaceNode workspaceNode = (GeoServerWorkspaceNode) node;
            if (!workspaceNode.isStyle()) {
                connection = workspaceNode.getConnection();
                extractWorkspaceLayers(workspaceNode);
            }
        }
    }
}
Also used : GeoServerLayer(com.sldeditor.common.data.GeoServerLayer) GeoServerWorkspaceNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerWorkspaceNode) TreeNode(javax.swing.tree.TreeNode) GeoServerLayerHeadingNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerLayerHeadingNode) NodeInterface(com.sldeditor.common.NodeInterface) GeoServerLayerNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerLayerNode)

Example 14 with GeoServerLayer

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

the class LayerStyleModel method populate.

/**
 * Populate model.
 *
 * @param styleMap the style map
 * @param layerList the layer list
 */
public void populate(Map<String, List<StyleWrapper>> styleMap, List<GeoServerLayer> layerList) {
    this.layerMap.clear();
    this.layerList = layerList;
    if (layerList != null) {
        for (GeoServerLayer layer : layerList) {
            this.layerMap.put(layer, Boolean.FALSE);
        }
    }
}
Also used : GeoServerLayer(com.sldeditor.common.data.GeoServerLayer)

Example 15 with GeoServerLayer

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

the class LayerStyleModel method updateStyle.

/**
 * Update style.
 *
 * @param selectedRows the selected rows
 * @param styleWrapper the style wrapper
 */
public void updateStyle(int[] selectedRows, StyleWrapper styleWrapper) {
    for (int index = 0; index < selectedRows.length; index++) {
        GeoServerLayer layer = getLayer(selectedRows[index]);
        layer.setStyle(styleWrapper);
        layerMap.put(layer, Boolean.TRUE);
    }
    this.fireTableDataChanged();
}
Also used : GeoServerLayer(com.sldeditor.common.data.GeoServerLayer)

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