use of com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode in project sldeditor by robward-scisys.
the class GeoServerInput method getSLDContents.
/*
* (non-Javadoc)
*
* @see com.sldeditor.extension.input.FileSystemInterface#getSLDContents(com.sldeditor.extension.input.NodeInterface)
*/
@Override
public SelectedFiles getSLDContents(NodeInterface node) {
if (node instanceof GeoServerStyleNode) {
GeoServerStyleNode styleNode = (GeoServerStyleNode) node;
GeoServerConnection connectionData = styleNode.getConnectionData();
GeoServerClientInterface client = GeoServerConnectionManager.getInstance().getConnectionMap().get(connectionData);
if (client != null) {
String sldContent = client.getStyle(styleNode.getStyle());
SLDDataInterface sldData = new SLDData(styleNode.getStyle(), sldContent);
sldData.setConnectionData(connectionData);
sldData.setReadOnly(false);
List<SLDDataInterface> sldDataList = new ArrayList<SLDDataInterface>();
sldDataList.add(sldData);
SelectedFiles selectedFiles = new SelectedFiles();
selectedFiles.setSldData(sldDataList);
selectedFiles.setDataSource(false);
selectedFiles.setConnectionData(connectionData);
return selectedFiles;
}
} else if (node instanceof GeoServerWorkspaceNode) {
GeoServerWorkspaceNode workspaceNode = (GeoServerWorkspaceNode) node;
GeoServerConnection connectionData = workspaceNode.getConnection();
GeoServerClientInterface client = GeoServerConnectionManager.getInstance().getConnectionMap().get(connectionData);
List<SLDDataInterface> sldDataList = new ArrayList<SLDDataInterface>();
if (workspaceNode.isStyle()) {
Map<String, List<StyleWrapper>> styleMap = getStyleMap(connectionData);
if ((client != null) && (styleMap != null)) {
for (StyleWrapper style : styleMap.get(workspaceNode.getWorkspaceName())) {
String sldContent = client.getStyle(style);
SLDDataInterface sldData = new SLDData(style, sldContent);
sldData.setConnectionData(connectionData);
sldData.setReadOnly(false);
sldDataList.add(sldData);
}
}
}
SelectedFiles selectedFiles = new SelectedFiles();
selectedFiles.setSldData(sldDataList);
selectedFiles.setDataSource(false);
selectedFiles.setConnectionData(connectionData);
return selectedFiles;
} else if (node instanceof GeoServerStyleHeadingNode) {
GeoServerStyleHeadingNode styleHeadingNode = (GeoServerStyleHeadingNode) node;
GeoServerConnection connectionData = styleHeadingNode.getConnection();
GeoServerClientInterface client = GeoServerConnectionManager.getInstance().getConnectionMap().get(connectionData);
List<SLDDataInterface> sldDataList = new ArrayList<SLDDataInterface>();
Map<String, List<StyleWrapper>> styleMap = getStyleMap(connectionData);
if ((client != null) && (styleMap != null)) {
for (String workspaceName : styleMap.keySet()) {
for (StyleWrapper style : styleMap.get(workspaceName)) {
String sldContent = client.getStyle(style);
SLDDataInterface sldData = new SLDData(style, sldContent);
sldData.setConnectionData(connectionData);
sldData.setReadOnly(false);
sldDataList.add(sldData);
}
}
}
SelectedFiles selectedFiles = new SelectedFiles();
selectedFiles.setSldData(sldDataList);
selectedFiles.setDataSource(false);
selectedFiles.setConnectionData(connectionData);
return selectedFiles;
} else if (node instanceof GeoServerNode) {
GeoServerNode geoServerNode = (GeoServerNode) node;
GeoServerConnection connectionData = geoServerNode.getConnection();
SelectedFiles selectedFiles = new SelectedFiles();
selectedFiles.setDataSource(false);
selectedFiles.setConnectionData(connectionData);
return selectedFiles;
}
return null;
}
use of com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode in project sldeditor by robward-scisys.
the class GeoServerReadProgress method disconnect.
/**
* Disconnect.
*
* @param connection the node
*/
public void disconnect(GeoServerConnection connection) {
GeoServerNode node = nodeMap.get(connection);
removeNode(node, PROGRESS_NODE_TITLE);
removeNode(node, STYLES_NODE_TITLE);
removeNode(node, LAYERS_NODE_TITLE);
if (treeModel != null) {
treeModel.reload(node);
}
}
use of com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode in project sldeditor by robward-scisys.
the class GeoServerReadProgress method startPopulating.
/*
* (non-Javadoc)
*
* @see com.sldeditor.extension.input.geoserver.GeoServerInputInterface#startPopulating()
*/
@Override
public void startPopulating(GeoServerConnection connection) {
GeoServerNode geoServerNode = nodeMap.get(connection);
removeNode(geoServerNode, STYLES_NODE_TITLE);
removeNode(geoServerNode, LAYERS_NODE_TITLE);
PopulateState state = populateStateMap.get(connection);
if (state != null) {
state.startStyles();
state.startLayers();
}
}
use of com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode in project sldeditor by robward-scisys.
the class GeoServerConnectionListTool 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) {
connectionList.clear();
boolean geoServerNodesSelected = false;
for (NodeInterface nodeType : nodeTypeList) {
if (nodeType instanceof GeoServerNode) {
GeoServerNode geoserverNode = (GeoServerNode) nodeType;
connectionList.add(geoserverNode.getConnection());
geoServerNodesSelected = true;
}
}
btnDuplicate.setEnabled(geoServerNodesSelected && (connectionList.size() == 1));
btnEdit.setEnabled(geoServerNodesSelected && (connectionList.size() == 1));
btnDelete.setEnabled(geoServerNodesSelected);
}
use of com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode in project sldeditor by robward-scisys.
the class GeoServerConnectionTool 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) {
connectionList.clear();
for (NodeInterface node : nodeTypeList) {
if (node instanceof GeoServerNode) {
GeoServerNode geoserverNode = (GeoServerNode) node;
connectionList.add(geoserverNode.getConnection());
}
}
updateButtonState();
}
Aggregations