use of com.sldeditor.common.SLDDataInterface in project sldeditor by robward-scisys.
the class DataSourceImpl method openExternalDataSource.
/**
* Open external data source.
*
* @param typeName the type name
*/
private void openExternalDataSource(String typeName) {
logger.debug("openExternalDataSource : " + typeName);
if (externalDataSource == null) {
ConsoleManager.getInstance().error(this, "No external data source creation object set");
} else {
List<DataSourceInfo> dataSourceInfoList = externalDataSource.connect(typeName, null, this.editorFileInterface);
if ((dataSourceInfoList != null) && (dataSourceInfoList.size() == 1)) {
dataSourceInfo = dataSourceInfoList.get(0);
if (dataSourceInfo.hasData()) {
logger.debug("External data sources:");
dataSourceInfo.populateFieldMap();
connectedToDataSourceFlag = true;
} else {
openWithoutDataSource();
}
}
// Populate external fields
DataSourceAttributeList attributeData = new DataSourceAttributeList();
readAttributes(attributeData);
SLDDataInterface sldData = this.editorFileInterface.getSLDData();
sldData.setFieldList(attributeData.getData());
}
}
use of com.sldeditor.common.SLDDataInterface in project sldeditor by robward-scisys.
the class DataSourceImpl method updateFields.
/**
* Update fields.
*
* @param attributeData the attribute data
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.datasource.DataSourceInterface#updateFields(com.sldeditor.render.iface. RenderAttributeDataInterface)
*/
@Override
public void updateFields(DataSourceAttributeListInterface attributeData) {
if (attributeData != null) {
List<DataSourceAttributeData> attributeDataList = attributeData.getData();
if (this.editorFileInterface != null) {
this.dataSourceProperties = editorFileInterface.getDataSource();
SLDDataInterface sldData = this.editorFileInterface.getSLDData();
if (sldData != null) {
sldData.setFieldList(attributeDataList);
}
}
this.connectedToDataSourceFlag = false;
createInternalDataSource();
notifyDataSourceLoaded();
}
}
use of com.sldeditor.common.SLDDataInterface in project sldeditor by robward-scisys.
the class DataSourceImpl method addField.
/**
* Adds the field.
*
* @param dataSourceField the data source field
*/
@Override
public void addField(DataSourceAttributeData dataSourceField) {
if (dataSourceField != null) {
if (connectedToDataSourceFlag == false) {
SLDDataInterface sldData = this.editorFileInterface.getSLDData();
List<DataSourceAttributeData> fieldList = sldData.getFieldList();
if (fieldList == null) {
fieldList = new ArrayList<DataSourceAttributeData>();
sldData.setFieldList(fieldList);
}
fieldList.add(dataSourceField);
createInternalDataSource();
notifyDataSourceLoaded();
}
}
}
use of com.sldeditor.common.SLDDataInterface 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.SLDDataInterface in project sldeditor by robward-scisys.
the class SLDFileHandler method internalOpenFile.
/**
* Internal open file.
*
* @param f the file
* @param list the list
*/
private void internalOpenFile(File f, List<SLDDataInterface> list) {
if (f.isFile() && FileSystemUtils.isFileExtensionSupported(f, getFileExtensionList())) {
try {
String sldContents = readFile(f, Charset.defaultCharset());
SLDDataInterface sldData = new SLDData(new StyleWrapper(f.getName()), sldContents);
sldData.setSLDFile(f);
sldData.setReadOnly(false);
list.add(sldData);
} catch (IOException e) {
e.printStackTrace();
}
}
}
Aggregations