Search in sources :

Example 1 with DatabaseOverallNode

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

the class DatabaseInput method populate.

/*
     * (non-Javadoc)
     * 
     * @see com.sldeditor.common.filesystem.FileSystemInterface#populate(com.sldeditor.datasource.extension.filesystem.node.FSTree,
     * javax.swing.tree.DefaultTreeModel, javax.swing.tree.DefaultMutableTreeNode)
     */
@Override
public void populate(FSTree tree, DefaultTreeModel model, DefaultMutableTreeNode rootNode) {
    progress.setTreeModel(tree, model);
    if (rootNode != null) {
        for (String key : getRootDatabaseNodes().keySet()) {
            DatabaseOverallNode node = getRootDatabaseNodes().get(key);
            rootNode.add(node);
        }
    }
    for (DatabaseConnection connection : DatabaseConnectionManager.getInstance().getConnectionMap().keySet()) {
        addConnectionNode(connection);
    }
}
Also used : DatabaseOverallNode(com.sldeditor.datasource.extension.filesystem.node.database.DatabaseOverallNode) DatabaseConnection(com.sldeditor.common.data.DatabaseConnection)

Example 2 with DatabaseOverallNode

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

the class DatabaseInput method getRootDatabaseNodes.

/**
 * Gets the root database nodes.
 *
 * @return the list of root database nodes
 */
private Map<String, DatabaseOverallNode> getRootDatabaseNodes() {
    if (databaseRootNodeMap == null) {
        databaseRootNodeMap = new LinkedHashMap<String, DatabaseOverallNode>();
        List<DatabaseOverallNode> list = new ArrayList<DatabaseOverallNode>();
        list.add(new DatabaseOverallNode(this, "PostGIS", "ui/filesystemicons/postgresql.png"));
        list.add(new DatabaseOverallNode(this, "GeoPackage", "ui/filesystemicons/geopackage.png"));
        list.add(new DatabaseOverallNode(this, "SpatiaLite", "ui/filesystemicons/spatialite.png"));
        list.add(new DatabaseOverallNode(this, "DB2", "ui/filesystemicons/db2.png"));
        list.add(new DatabaseOverallNode(this, "H2", "ui/filesystemicons/h2.png"));
        list.add(new DatabaseOverallNode(this, "MySQL", "ui/filesystemicons/mysql.png"));
        list.add(new DatabaseOverallNode(this, "Oracle", "ui/filesystemicons/oracle.png"));
        list.add(new DatabaseOverallNode(this, "Microsoft SQL Server (JTDS Driver) (JNDI)", "ui/filesystemicons/sqlserver.png"));
        list.add(new DatabaseOverallNode(this, "Teradata", "ui/filesystemicons/teradata.png"));
        for (DatabaseOverallNode node : list) {
            databaseRootNodeMap.put(node.toString(), node);
        }
    }
    return databaseRootNodeMap;
}
Also used : DatabaseOverallNode(com.sldeditor.datasource.extension.filesystem.node.database.DatabaseOverallNode) ArrayList(java.util.ArrayList)

Example 3 with DatabaseOverallNode

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

the class DatabaseConnectionListTool 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();
    selectedDatabaseType = null;
    boolean databaseNodesSelected = false;
    boolean canDuplicate = true;
    for (NodeInterface nodeType : nodeTypeList) {
        if (nodeType instanceof DatabaseNode) {
            DatabaseNode databaseNode = (DatabaseNode) nodeType;
            DatabaseConnection connection = databaseNode.getConnection();
            connectionList.add(connection);
            databaseNodesSelected = true;
            if (!connection.isSupportsDuplication()) {
                canDuplicate = false;
            }
        } else if (nodeType instanceof DatabaseOverallNode) {
            DatabaseOverallNode databaseOverallNode = (DatabaseOverallNode) nodeType;
            selectedDatabaseType = databaseOverallNode.toString();
            canDuplicate = false;
        }
    }
    btnDuplicate.setEnabled(canDuplicate && databaseNodesSelected && (connectionList.size() == 1));
    btnEdit.setEnabled(databaseNodesSelected && (connectionList.size() == 1));
    btnDelete.setEnabled(databaseNodesSelected);
}
Also used : DatabaseNode(com.sldeditor.datasource.extension.filesystem.node.database.DatabaseNode) DatabaseOverallNode(com.sldeditor.datasource.extension.filesystem.node.database.DatabaseOverallNode) DatabaseConnection(com.sldeditor.common.data.DatabaseConnection) NodeInterface(com.sldeditor.common.NodeInterface)

Aggregations

DatabaseOverallNode (com.sldeditor.datasource.extension.filesystem.node.database.DatabaseOverallNode)3 DatabaseConnection (com.sldeditor.common.data.DatabaseConnection)2 NodeInterface (com.sldeditor.common.NodeInterface)1 DatabaseNode (com.sldeditor.datasource.extension.filesystem.node.database.DatabaseNode)1 ArrayList (java.util.ArrayList)1