Search in sources :

Example 1 with DatabaseNode

use of com.sldeditor.datasource.extension.filesystem.node.database.DatabaseNode in project sldeditor by robward-scisys.

the class DatabaseInput method addConnectionNode.

/**
 * Adds the connection node.
 *
 * @param connection the connection
 */
private void addConnectionNode(DatabaseConnection connection) {
    DatabaseNode node = new DatabaseNode(this, connection);
    getRootDatabaseNode(connection).add(node);
    progress.addNewConnectionNode(connection, node);
}
Also used : DatabaseNode(com.sldeditor.datasource.extension.filesystem.node.database.DatabaseNode)

Example 2 with DatabaseNode

use of com.sldeditor.datasource.extension.filesystem.node.database.DatabaseNode in project sldeditor by robward-scisys.

the class DatabaseReadProgress method deleteConnection.

/**
 * Delete connection.
 *
 * @param connection the connection
 */
public void deleteConnection(DatabaseConnection connection) {
    DatabaseNode node = nodeMap.get(connection);
    if (treeModel != null) {
        treeModel.removeNodeFromParent(node);
    }
    nodeMap.remove(connection);
}
Also used : DatabaseNode(com.sldeditor.datasource.extension.filesystem.node.database.DatabaseNode)

Example 3 with DatabaseNode

use of com.sldeditor.datasource.extension.filesystem.node.database.DatabaseNode in project sldeditor by robward-scisys.

the class DatabaseReadProgress method checkPopulateComplete.

/**
 * Check populate complete.
 *
 * @param connection the connection
 */
private void checkPopulateComplete(DatabaseConnection connection) {
    PopulateState state = populateStateMap.get(connection);
    if (state != null) {
        if (state.isComplete()) {
            DatabaseNode databaseNode = nodeMap.get(connection);
            if (databaseNode != null) {
                removeNode(databaseNode, PROGRESS_NODE_TITLE);
                populateFeatureClasses(connection, databaseNode);
                if (treeModel != null) {
                    // this notifies the listeners and changes the GUI
                    treeModel.reload(databaseNode);
                }
            }
            parseComplete.populateComplete(connection, databaseFeatureClassMap.get(connection));
        }
    }
}
Also used : DatabaseNode(com.sldeditor.datasource.extension.filesystem.node.database.DatabaseNode)

Example 4 with DatabaseNode

use of com.sldeditor.datasource.extension.filesystem.node.database.DatabaseNode in project sldeditor by robward-scisys.

the class DatabaseConnectionTool 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();
    if (nodeTypeList != null) {
        for (NodeInterface node : nodeTypeList) {
            if (node instanceof DatabaseNode) {
                DatabaseNode databaseNode = (DatabaseNode) node;
                connectionList.add(databaseNode.getConnection());
            } else if (node instanceof FileTreeNode) {
                FileTreeNode fileNode = (FileTreeNode) node;
                if (fileNode.getFileCategory() == FileTreeNodeTypeEnum.DATABASE) {
                    DatabaseConnection databaseConnection = DatabaseConnectionFactory.getConnection(fileNode.getFile().getAbsolutePath());
                    connectionList.add(databaseConnection);
                }
            }
        }
    }
    updateButtonState();
}
Also used : DatabaseNode(com.sldeditor.datasource.extension.filesystem.node.database.DatabaseNode) DatabaseConnection(com.sldeditor.common.data.DatabaseConnection) NodeInterface(com.sldeditor.common.NodeInterface) FileTreeNode(com.sldeditor.datasource.extension.filesystem.node.file.FileTreeNode)

Example 5 with DatabaseNode

use of com.sldeditor.datasource.extension.filesystem.node.database.DatabaseNode in project sldeditor by robward-scisys.

the class DatabaseReadProgress method updateConnection.

/**
 * Update connection.
 *
 * @param originalConnectionDetails the original connection details
 * @param newConnectionDetails the new connection details
 */
public void updateConnection(DatabaseConnection originalConnectionDetails, DatabaseConnection newConnectionDetails) {
    if (newConnectionDetails != null) {
        DatabaseNode databaseNode = nodeMap.get(originalConnectionDetails);
        originalConnectionDetails.update(newConnectionDetails);
        if (databaseNode != null) {
            databaseNode.setUserObject(newConnectionDetails.getConnectionName());
            refreshNode(databaseNode);
            setFolder(newConnectionDetails.getDatabaseTypeLabel(), newConnectionDetails, false);
        }
    }
}
Also used : DatabaseNode(com.sldeditor.datasource.extension.filesystem.node.database.DatabaseNode)

Aggregations

DatabaseNode (com.sldeditor.datasource.extension.filesystem.node.database.DatabaseNode)8 NodeInterface (com.sldeditor.common.NodeInterface)3 DatabaseConnection (com.sldeditor.common.data.DatabaseConnection)3 FileTreeNode (com.sldeditor.datasource.extension.filesystem.node.file.FileTreeNode)2 SLDDataInterface (com.sldeditor.common.SLDDataInterface)1 DatabaseOverallNode (com.sldeditor.datasource.extension.filesystem.node.database.DatabaseOverallNode)1 DatabaseInput (com.sldeditor.extension.filesystem.database.DatabaseInput)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1