Search in sources :

Example 6 with FileSystemInterface

use of com.sldeditor.common.filesystem.FileSystemInterface in project sldeditor by robward-scisys.

the class GeoServerWorkspaceNodeTest method testGeoServerLayerNode.

/**
 * Test method for
 * {@link com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerWorkspaceNode#GeoServerStyleNode(com.sldeditor.common.filesystem.FileSystemInterface)}.
 */
@Test
public void testGeoServerLayerNode() {
    FileSystemInterface fileHandler = new DummyFileSystemInput();
    GeoServerConnection connection = new GeoServerConnection();
    connection.setConnectionName("test connection");
    connection.setUserName("test user name");
    String workspaceName = "workspace";
    GeoServerWorkspaceNode node = new GeoServerWorkspaceNode(fileHandler, connection, workspaceName, true);
    assertEquals(fileHandler, node.getHandler());
    assertEquals(connection, node.getConnection());
    assertEquals(workspaceName, node.getWorkspaceName());
    assertEquals(DataFlavourManager.GEOSERVER_WORKSPACE_DATAITEM_FLAVOUR, node.getDataFlavour());
    assertNull(node.getDestinationText());
}
Also used : FileSystemInterface(com.sldeditor.common.filesystem.FileSystemInterface) GeoServerWorkspaceNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerWorkspaceNode) GeoServerConnection(com.sldeditor.common.data.GeoServerConnection) Test(org.junit.Test)

Example 7 with FileSystemInterface

use of com.sldeditor.common.filesystem.FileSystemInterface in project sldeditor by robward-scisys.

the class GeoServerOverallNodeTest method testGeoServerLayerNode.

/**
 * Test method for {@link com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerOverallNode#GeoServerOverallNode(com.sldeditor.common.filesystem.FileSystemInterface)}.
 */
@Test
public void testGeoServerLayerNode() {
    FileSystemInterface fileHandler = new DummyFileSystemInput();
    GeoServerOverallNode node = new GeoServerOverallNode(fileHandler);
    assertEquals(fileHandler, node.getHandler());
    assertEquals(BuiltInDataFlavour.GEOSERVER_OVERALL_DATAITEM_FLAVOUR, node.getDataFlavour());
    assertNull(node.getDestinationText());
}
Also used : GeoServerOverallNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerOverallNode) FileSystemInterface(com.sldeditor.common.filesystem.FileSystemInterface) Test(org.junit.Test)

Example 8 with FileSystemInterface

use of com.sldeditor.common.filesystem.FileSystemInterface in project sldeditor by robward-scisys.

the class FileSystemExtension method treeItemSelected.

/**
 * Called to determine the selected items from the tree nodes selected.
 *
 * @return the selected files
 */
private SelectedFiles treeItemSelected() {
    List<SLDDataInterface> sldDataList = new ArrayList<SLDDataInterface>();
    List<NodeInterface> nodeList = new ArrayList<NodeInterface>();
    SelectedFiles combinedFiles = new SelectedFiles();
    TreePath[] selectedPaths = tree.getSelectionPaths();
    if (selectedPaths != null) {
        for (TreePath selectedPath : selectedPaths) {
            Object o = selectedPath.getLastPathComponent();
            if (o instanceof NodeInterface) {
                NodeInterface handler = (NodeInterface) o;
                FileSystemInterface input = handler.getHandler();
                SelectedFiles selectedFiles = input.getSLDContents(handler);
                if (selectedFiles != null) {
                    combinedFiles.setDataSource(selectedFiles.isDataSource());
                    combinedFiles.setFolderName(selectedFiles.getFolderName());
                    combinedFiles.setConnectionData(selectedFiles.getConnectionData());
                    combinedFiles.setIsFolder(combinedFiles.isFolder() | selectedFiles.isFolder());
                    List<SLDDataInterface> handlerDataList = selectedFiles.getSldData();
                    if (handlerDataList != null) {
                        combinedFiles.appendSLDData(handlerDataList);
                        sldDataList.addAll(handlerDataList);
                    }
                }
                nodeList.add(handler);
            }
        }
    }
    if (toolMgr != null) {
        toolMgr.setSelectedItems(nodeList, sldDataList);
    }
    return combinedFiles;
}
Also used : FileSystemInterface(com.sldeditor.common.filesystem.FileSystemInterface) TreePath(javax.swing.tree.TreePath) SLDDataInterface(com.sldeditor.common.SLDDataInterface) SelectedFiles(com.sldeditor.common.filesystem.SelectedFiles) ArrayList(java.util.ArrayList) NodeInterface(com.sldeditor.common.NodeInterface)

Example 9 with FileSystemInterface

use of com.sldeditor.common.filesystem.FileSystemInterface 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 10 with FileSystemInterface

use of com.sldeditor.common.filesystem.FileSystemInterface in project sldeditor by robward-scisys.

the class GeoServerNodeTest 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();
    GeoServerConnection connection = new GeoServerConnection();
    connection.setConnectionName("test connection");
    connection.setUserName("test user name");
    GeoServerNode node = new GeoServerNode(fileHandler, connection);
    assertEquals(connection, node.getConnection());
    assertEquals(fileHandler, node.getHandler());
    assertEquals(BuiltInDataFlavour.GEOSERVER_DATAITEM_FLAVOUR, node.getDataFlavour());
    assertNull(node.getDestinationText());
}
Also used : FileSystemInterface(com.sldeditor.common.filesystem.FileSystemInterface) GeoServerNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode) GeoServerConnection(com.sldeditor.common.data.GeoServerConnection) Test(org.junit.Test)

Aggregations

FileSystemInterface (com.sldeditor.common.filesystem.FileSystemInterface)15 Test (org.junit.Test)12 ArrayList (java.util.ArrayList)8 FileSystemExtension (com.sldeditor.extension.filesystem.FileSystemExtension)7 GeoServerConnection (com.sldeditor.common.data.GeoServerConnection)3 TreePath (javax.swing.tree.TreePath)2 NodeInterface (com.sldeditor.common.NodeInterface)1 SLDDataInterface (com.sldeditor.common.SLDDataInterface)1 GeoServerLayer (com.sldeditor.common.data.GeoServerLayer)1 SLDData (com.sldeditor.common.data.SLDData)1 StyleWrapper (com.sldeditor.common.data.StyleWrapper)1 SelectedFiles (com.sldeditor.common.filesystem.SelectedFiles)1 FSTree (com.sldeditor.datasource.extension.filesystem.node.FSTree)1 GeoServerLayerNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerLayerNode)1 GeoServerNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode)1 GeoServerOverallNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerOverallNode)1 GeoServerStyleNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerStyleNode)1 GeoServerWorkspaceNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerWorkspaceNode)1 FileSystemInput (com.sldeditor.extension.filesystem.file.FileSystemInput)1 BorderLayout (java.awt.BorderLayout)1