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);
}
}
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);
}
}
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);
}
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));
}
}
}
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);
}
}
}
Aggregations