Search in sources :

Example 11 with GeoServerNode

use of com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode in project sldeditor by robward-scisys.

the class GeoServerReadProgress method readStylesComplete.

/*
     * (non-Javadoc)
     * 
     * @see com.sldeditor.extension.input.geoserver.GeoServerReadProgressInterface#readStylesComplete(com.sldeditor.extension.input.geoserver.
     * GeoServerConnection, java.util.Map, boolean)
     */
@Override
public void readStylesComplete(GeoServerConnection connection, Map<String, List<StyleWrapper>> styleMap, boolean partialRefresh) {
    if (styleMap == null) {
        return;
    }
    if (partialRefresh) {
        Map<String, List<StyleWrapper>> extistingStyleMap = this.geoServerStyleMap.get(connection);
        for (String workspace : styleMap.keySet()) {
            extistingStyleMap.put(workspace, styleMap.get(workspace));
        }
        GeoServerNode geoServerNode = nodeMap.get(connection);
        for (String workspace : styleMap.keySet()) {
            DefaultMutableTreeNode stylesNode = getNode(geoServerNode, STYLES_NODE_TITLE);
            GeoServerWorkspaceNode workspaceNode = (GeoServerWorkspaceNode) getNode(stylesNode, workspace);
            refreshWorkspace(connection, workspaceNode);
        }
    } else {
        this.geoServerStyleMap.put(connection, styleMap);
        // Update state
        PopulateState state = populateStateMap.get(connection);
        if (state != null) {
            state.setStylesComplete();
        }
        checkPopulateComplete(connection);
    }
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) GeoServerWorkspaceNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerWorkspaceNode) GeoServerNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode) List(java.util.List)

Example 12 with GeoServerNode

use of com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode in project sldeditor by robward-scisys.

the class GeoServerReadProgress method showProgress.

/**
 * Show progress.
 *
 * @param connection the connection
 * @return the default mutable tree node
 */
private void showProgress(GeoServerConnection connection) {
    GeoServerNode geoServerNode = nodeMap.get(connection);
    if (geoServerNode == null) {
        return;
    }
    DefaultMutableTreeNode stylesNode = getNode(geoServerNode, PROGRESS_NODE_TITLE);
    if (stylesNode == null) {
        stylesNode = new DefaultMutableTreeNode(PROGRESS_NODE_TITLE);
        geoServerNode.add(stylesNode);
        if (treeModel != null) {
            TreeNode[] nodes = treeModel.getPathToRoot(geoServerNode);
            TreePath path = new TreePath(nodes);
            tree.expandPath(path);
            nodes = treeModel.getPathToRoot(stylesNode);
            path = new TreePath(nodes);
            tree.scrollPathToVisible(path);
        }
    }
    stylesNode.setUserObject(String.format("%s - %s %s", PROGRESS_NODE_TITLE, styleProgressText, layerProgressText));
    if (treeModel != null) {
        treeModel.reload(stylesNode);
    }
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) TreePath(javax.swing.tree.TreePath) GeoServerNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode) TreeNode(javax.swing.tree.TreeNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode)

Example 13 with GeoServerNode

use of com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode in project sldeditor by robward-scisys.

the class GeoServerReadProgress method deleteConnection.

/**
 * Delete connection.
 *
 * @param connection the connection
 */
public void deleteConnection(GeoServerConnection connection) {
    GeoServerNode node = nodeMap.get(connection);
    if (treeModel != null) {
        treeModel.removeNodeFromParent(node);
    }
    nodeMap.remove(connection);
}
Also used : GeoServerNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode)

Example 14 with GeoServerNode

use of com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode in project sldeditor by robward-scisys.

the class GeoServerReadProgress method checkPopulateComplete.

/**
 * Check populate complete.
 *
 * @param connection the connection
 */
private void checkPopulateComplete(GeoServerConnection connection) {
    PopulateState state = populateStateMap.get(connection);
    if (state != null) {
        if (state.isComplete()) {
            GeoServerNode geoServerNode = nodeMap.get(connection);
            if (geoServerNode != null) {
                removeNode(geoServerNode, PROGRESS_NODE_TITLE);
                populateStyles(connection, geoServerNode);
                populateLayers(connection, geoServerNode);
                if (treeModel != null) {
                    // this notifies the listeners and changes the GUI
                    treeModel.reload(geoServerNode);
                }
            }
            parseComplete.populateComplete(connection, geoServerStyleMap.get(connection), geoServerLayerMap.get(connection));
        }
    }
}
Also used : GeoServerNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode)

Example 15 with GeoServerNode

use of com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode in project sldeditor by robward-scisys.

the class GeoServerInput method rightMouseButton.

/*
     * (non-Javadoc)
     * 
     * @see com.sldeditor.common.filesystem.FileSystemInterface#rightMouseButton(javax.swing.JPopupMenu, java.lang.Object, java.awt.event.MouseEvent)
     */
@Override
public void rightMouseButton(JPopupMenu popupMenu, Object selectedItem, MouseEvent e) {
    if (selectedItem instanceof GeoServerNode) {
        GeoServerNode geoServerNode = (GeoServerNode) selectedItem;
        GeoServerConnection connection = geoServerNode.getConnection();
        GeoServerClientInterface client = GeoServerConnectionManager.getInstance().getConnectionMap().get(connection);
        if (client != null) {
            if (client.isConnected()) {
                JMenuItem connectMenuItem = new JMenuItem(Localisation.getString(GeoServerInput.class, "GeoServerInput.disconnect"));
                connectMenuItem.addActionListener(new ActionListener() {

                    public void actionPerformed(ActionEvent event) {
                        disconnectFromGeoServer(client);
                    }
                });
                popupMenu.add(connectMenuItem);
            } else {
                JMenuItem connectMenuItem = new JMenuItem(Localisation.getString(GeoServerInput.class, "GeoServerInput.connect"));
                connectMenuItem.addActionListener(new ActionListener() {

                    public void actionPerformed(ActionEvent event) {
                        GeoServerNode geoserver = (GeoServerNode) selectedItem;
                        GeoServerConnection connection = geoserver.getConnection();
                        connectToGeoServer(connection);
                    }
                });
                popupMenu.add(connectMenuItem);
            }
        }
    } else if (selectedItem instanceof FileTreeNode) {
        FileTreeNode fileNode = (FileTreeNode) selectedItem;
        if (ExternalFilenames.getFileExtension(fileNode.getFile().getAbsolutePath()).compareToIgnoreCase(SLD_FILE_EXTENSION) == 0) {
            JMenu uploadToGeoServerMenu = new JMenu(Localisation.getString(GeoServerInput.class, "GeoServerInput.uploadToGeoServer"));
            populateGeoServerConnections(uploadToGeoServerMenu);
            popupMenu.add(uploadToGeoServerMenu);
        }
    }
}
Also used : GeoServerClientInterface(com.sldeditor.extension.filesystem.geoserver.client.GeoServerClientInterface) ActionListener(java.awt.event.ActionListener) GeoServerNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode) ActionEvent(java.awt.event.ActionEvent) JMenuItem(javax.swing.JMenuItem) GeoServerConnection(com.sldeditor.common.data.GeoServerConnection) JMenu(javax.swing.JMenu) FileTreeNode(com.sldeditor.datasource.extension.filesystem.node.file.FileTreeNode)

Aggregations

GeoServerNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode)18 GeoServerConnection (com.sldeditor.common.data.GeoServerConnection)8 Test (org.junit.Test)6 GeoServerOverallNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerOverallNode)5 GeoServerReadProgress (com.sldeditor.extension.filesystem.geoserver.GeoServerReadProgress)4 List (java.util.List)3 NodeInterface (com.sldeditor.common.NodeInterface)2 StyleWrapper (com.sldeditor.common.data.StyleWrapper)2 GeoServerWorkspaceNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerWorkspaceNode)2 GeoServerClientInterface (com.sldeditor.extension.filesystem.geoserver.client.GeoServerClientInterface)2 HashMap (java.util.HashMap)2 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 SLDDataInterface (com.sldeditor.common.SLDDataInterface)1 GeoServerLayer (com.sldeditor.common.data.GeoServerLayer)1 SLDData (com.sldeditor.common.data.SLDData)1 FileSystemInterface (com.sldeditor.common.filesystem.FileSystemInterface)1 SelectedFiles (com.sldeditor.common.filesystem.SelectedFiles)1 FileTreeNode (com.sldeditor.datasource.extension.filesystem.node.file.FileTreeNode)1 GeoServerStyleHeadingNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerStyleHeadingNode)1 GeoServerStyleNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerStyleNode)1