use of com.sldeditor.common.filesystem.SelectedFiles in project sldeditor by robward-scisys.
the class SLDEditor method chooseNewSLD.
/**
* Choose new sld.
*/
@Override
public void chooseNewSLD() {
NewSLDPanel panel = new NewSLDPanel();
List<SLDDataInterface> newSLDList = panel.showDialog(Controller.getInstance().getFrame());
if (newSLDList != null) {
SelectedFiles selectedFiles = new SelectedFiles();
selectedFiles.setSldData(newSLDList);
if (loadSLDString(selectedFiles)) {
uiMgr.populateUI(1);
}
}
}
use of com.sldeditor.common.filesystem.SelectedFiles in project sldeditor by robward-scisys.
the class DataFlavourManager method displayMessages.
/**
* Display messages.
*
* @param destinationTreeNode the destination tree node
* @param transferredData the transferred data
* @param action the action
*/
public static void displayMessages(NodeInterface destinationTreeNode, TransferredData transferredData, int action) {
if ((destinationTreeNode == null) || (transferredData == null)) {
return;
}
String actionString = "???";
if (action == TransferHandler.MOVE) {
actionString = "Moved";
} else if (action == TransferHandler.COPY) {
actionString = "Copied";
}
String destinationString = destinationTreeNode.getHandler().getDestinationText(destinationTreeNode);
for (int index = 0; index < transferredData.getDataListSize(); index++) {
NodeInterface nodeToTransfer = (NodeInterface) transferredData.getTreePath(index).getLastPathComponent();
SelectedFiles selectedFiles = nodeToTransfer.getHandler().getSLDContents(nodeToTransfer);
for (SLDDataInterface sldData : selectedFiles.getSldData()) {
ConsoleManager.getInstance().information(DataFlavourManager.class, String.format("%s %s -> %s", actionString, sldData.getLayerName(), destinationString));
}
}
}
use of com.sldeditor.common.filesystem.SelectedFiles 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.common.filesystem.SelectedFiles in project sldeditor by robward-scisys.
the class DatabaseInput method getSLDContents.
/*
* (non-Javadoc)
*
* @see com.sldeditor.extension.input.FileSystemInterface#getSLDContents(com.sldeditor.extension.input.NodeInterface)
*/
@Override
public SelectedFiles getSLDContents(NodeInterface node) {
SelectedFiles selectedFiles = new SelectedFiles();
if (node instanceof DatabaseFeatureClassNode) {
List<SLDDataInterface> sldContentList = new ArrayList<SLDDataInterface>();
selectedFiles.setSldData(sldContentList);
selectedFiles.setDataSource(true);
}
return selectedFiles;
}
use of com.sldeditor.common.filesystem.SelectedFiles in project sldeditor by robward-scisys.
the class FileSystemInput method getSLDContents.
/**
* Gets the SLD contents.
*
* @param node the node
* @return the SLD contents
*/
@Override
public SelectedFiles getSLDContents(NodeInterface node) {
SelectedFiles selectedFiles = new SelectedFiles();
if (node instanceof FileTreeNode) {
FileTreeNode fileTreeNode = (FileTreeNode) node;
selectedFiles.setIsFolder(fileTreeNode.isDir());
File f = fileTreeNode.getFile();
String folderName = f.isFile() ? f.getParent() : f.getAbsolutePath();
selectedFiles.setFolderName(folderName);
}
for (FileHandlerInterface handler : fileHandlerMap.values()) {
List<SLDDataInterface> sldContentList = handler.getSLDContents(node);
if (sldContentList != null) {
selectedFiles.setSldData(sldContentList);
selectedFiles.setDataSource(handler.isDataSource());
return selectedFiles;
}
}
return selectedFiles;
}
Aggregations