use of com.sldeditor.common.SLDDataInterface 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.SLDDataInterface 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;
}
use of com.sldeditor.common.SLDDataInterface in project sldeditor by robward-scisys.
the class FileSystemInput method deleteNodes.
/*
* (non-Javadoc)
*
* @see
* com.sldeditor.extension.input.FileSystemInterface#deleteNodes(com.sldeditor.extension.input.
* NodeInterface, java.util.List)
*/
@Override
public void deleteNodes(NodeInterface nodeToTransfer, List<SLDDataInterface> sldDataList) {
if (sldDataList == null) {
return;
}
if (nodeToTransfer instanceof FileTreeNode) {
for (SLDDataInterface sldData : sldDataList) {
String sldFilename = sldData.getSLDFile().getAbsolutePath();
File file = new File(sldFilename);
file.delete();
}
DefaultMutableTreeNode destinationNode = (DefaultMutableTreeNode) nodeToTransfer;
TreeNode parent = destinationNode.getParent();
destinationNode.removeFromParent();
if (treeModel != null) {
treeModel.reload(parent);
}
}
}
use of com.sldeditor.common.SLDDataInterface in project sldeditor by robward-scisys.
the class FileSystemInput method copyNodes.
/*
* (non-Javadoc)
*
* @see com.sldeditor.extension.input.FileSystemInterface#drop(com.sldeditor.extension.input.
* NodeInterface, java.util.Map)
*/
@Override
public boolean copyNodes(NodeInterface destinationTreeNode, Map<NodeInterface, List<SLDDataInterface>> copyDataMap) {
if ((destinationTreeNode == null) || (copyDataMap == null)) {
return false;
}
FileTreeNode destinationNode = (FileTreeNode) destinationTreeNode;
if (!destinationNode.isDir()) {
destinationNode = (FileTreeNode) destinationNode.getParent();
}
File destinationFolder = destinationNode.getFile();
for (NodeInterface key : copyDataMap.keySet()) {
List<SLDDataInterface> sldDataList = copyDataMap.get(key);
for (SLDDataInterface sldData : sldDataList) {
String sldFilename = sldData.getSLDFile().getAbsolutePath();
FileHandlerInterface handler = getFileHandler(sldFilename);
if (handler != null) {
String sldName = handler.getSLDName(sldData);
File existingFolder = new File(sldFilename).getParentFile();
if (existingFolder.equals(destinationFolder)) {
sldName = "Copy of " + sldName;
}
File updateFile = new File(destinationFolder, sldName);
sldData.setSLDFile(updateFile);
save(sldData);
}
}
destinationNode.refreshFolder();
if (treeModel != null) {
treeModel.reload(destinationNode);
}
}
return true;
}
use of com.sldeditor.common.SLDDataInterface in project sldeditor by robward-scisys.
the class RenderPanelImpl method renderSymbol.
/**
* Render symbol.
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.marker.iface.RenderSymbolInterface#renderSymbol()
*/
@Override
public void renderSymbol() {
validSymbol = SelectedSymbol.getInstance().isValid();
if (validSymbol) {
StyledLayerDescriptor sld = SelectedSymbol.getInstance().getSld();
SLDDataInterface sldData = SLDEditorFile.getInstance().getSLDData();
if (sld != null) {
for (SLDOutputInterface sldOutput : sldOutputList) {
sldOutput.updatedSLD(sldData, sld);
}
renderSymbol((Style) renderSymbol.getRenderStyle(SelectedSymbol.getInstance()));
} else {
renderSymbol(null);
}
} else {
repaint();
}
}
Aggregations