Search in sources :

Example 6 with BaseTreeNode

use of com.revolsys.swing.tree.BaseTreeNode in project com.revolsys.open by revolsys.

the class ParentTreeNode method loadChildrenDo.

@Override
protected List<BaseTreeNode> loadChildrenDo() {
    final List<BaseTreeNode> children = new ArrayList<>();
    final Parent<?> parent = getUserData();
    if (parent != null) {
        parent.refresh();
        for (final Object child : parent.getChildren()) {
            final BaseTreeNode childNode = BaseTreeNode.newTreeNode(child);
            if (childNode != null) {
                children.add(childNode);
            }
        }
    }
    return children;
}
Also used : ArrayList(java.util.ArrayList) BaseTreeNode(com.revolsys.swing.tree.BaseTreeNode)

Example 7 with BaseTreeNode

use of com.revolsys.swing.tree.BaseTreeNode in project com.revolsys.open by revolsys.

the class WebServiceConnectionTrees method newWebServiceConnectionsTreeNode.

public static BaseTreeNode newWebServiceConnectionsTreeNode() {
    final WebServiceConnectionManager webServicesConnectionManager = WebServiceConnectionManager.get();
    final BaseTreeNode webServices = BaseTreeNode.newTreeNode(webServicesConnectionManager);
    webServices.setOpen(true);
    return webServices;
}
Also used : WebServiceConnectionManager(com.revolsys.webservice.WebServiceConnectionManager) BaseTreeNode(com.revolsys.swing.tree.BaseTreeNode)

Example 8 with BaseTreeNode

use of com.revolsys.swing.tree.BaseTreeNode in project com.revolsys.open by revolsys.

the class FolderConnectionsTrees method newFolderConnectionsTreeNode.

public static BaseTreeNode newFolderConnectionsTreeNode() {
    final FileConnectionManager connectionManager = FileConnectionManager.get();
    final BaseTreeNode node = BaseTreeNode.newTreeNode(connectionManager);
    node.setOpen(true);
    return node;
}
Also used : FileConnectionManager(com.revolsys.io.file.FileConnectionManager) BaseTreeNode(com.revolsys.swing.tree.BaseTreeNode)

Example 9 with BaseTreeNode

use of com.revolsys.swing.tree.BaseTreeNode in project com.revolsys.open by revolsys.

the class ProjectTreeNode method loadChildrenDo.

@Override
protected List<BaseTreeNode> loadChildrenDo() {
    final List<BaseTreeNode> children = super.loadChildrenDo();
    final Project project = getProject();
    final LayerGroup baseMapLayers = project.getBaseMapLayers();
    final LayerGroupTreeNode baseMapLayersNode = new LayerGroupTreeNode(baseMapLayers);
    children.add(baseMapLayersNode);
    return children;
}
Also used : Project(com.revolsys.swing.map.layer.Project) BaseTreeNode(com.revolsys.swing.tree.BaseTreeNode) LayerGroup(com.revolsys.swing.map.layer.LayerGroup)

Example 10 with BaseTreeNode

use of com.revolsys.swing.tree.BaseTreeNode in project com.revolsys.open by revolsys.

the class RecordStoreConnectionTrees method addLayer.

private static void addLayer(final RecordDefinitionImpl recordDefinition) {
    final PathName typePath = recordDefinition.getPathName();
    final RecordStore recordStore = recordDefinition.getRecordStore();
    final Map<String, Object> connection = recordStore.getConnectionProperties();
    final Map<String, Object> layerConfig = new LinkedHashMap<>();
    MapObjectFactory.setType(layerConfig, "recordStoreLayer");
    layerConfig.put("name", recordDefinition.getName());
    layerConfig.put("connection", connection);
    layerConfig.put("typePath", typePath);
    layerConfig.put("showTableView", AbstractLayer.isShowNewLayerTableView());
    final LinkedList<String> path = new LinkedList<>();
    {
        BaseTreeNode node = BaseTree.getMenuNode();
        node = node.getParent();
        while (node != null) {
            final Object nodeValue = node.getUserObject();
            String nodeName = node.getName();
            if (node instanceof PathTreeNode) {
                nodeName = FileUtil.getBaseName(nodeName);
            }
            if (nodeValue instanceof RecordStoreSchemaElement) {
                path.addFirst(nodeName);
                node = node.getParent();
            } else {
                path.addFirst(nodeName);
                node = null;
            }
        }
    }
    final AbstractLayer layer = new RecordStoreLayer(layerConfig);
    LayerGroup layerGroup = Project.get();
    for (final String name : path) {
        try {
            layerGroup = layerGroup.addLayerGroup(name);
        } catch (final IllegalArgumentException e) {
            int i = 1;
            while (layerGroup.hasLayerWithSameName(null, name + i)) {
                i++;
            }
            layerGroup = layerGroup.addLayerGroup(name + i);
        }
    }
    layerGroup.addLayer(layer);
}
Also used : RecordStoreLayer(com.revolsys.swing.map.layer.record.RecordStoreLayer) AbstractLayer(com.revolsys.swing.map.layer.AbstractLayer) LayerGroup(com.revolsys.swing.map.layer.LayerGroup) LinkedList(java.util.LinkedList) LinkedHashMap(java.util.LinkedHashMap) PathTreeNode(com.revolsys.swing.tree.node.file.PathTreeNode) RecordStore(com.revolsys.record.schema.RecordStore) BaseTreeNode(com.revolsys.swing.tree.BaseTreeNode) PathName(com.revolsys.io.PathName) RecordStoreSchemaElement(com.revolsys.record.schema.RecordStoreSchemaElement)

Aggregations

BaseTreeNode (com.revolsys.swing.tree.BaseTreeNode)27 LayerGroup (com.revolsys.swing.map.layer.LayerGroup)5 ArrayList (java.util.ArrayList)5 AbstractLayer (com.revolsys.swing.map.layer.AbstractLayer)4 Layer (com.revolsys.swing.map.layer.Layer)4 TreePath (javax.swing.tree.TreePath)4 Component (java.awt.Component)3 Path (java.nio.file.Path)3 JComponent (javax.swing.JComponent)3 RecordStore (com.revolsys.record.schema.RecordStore)2 RecordStoreSchemaElement (com.revolsys.record.schema.RecordStoreSchemaElement)2 BaseTree (com.revolsys.swing.tree.BaseTree)2 JTree (javax.swing.JTree)2 PathName (com.revolsys.io.PathName)1 FileConnectionManager (com.revolsys.io.file.FileConnectionManager)1 RecordStoreConnectionManager (com.revolsys.record.io.RecordStoreConnectionManager)1 RecordStoreSchema (com.revolsys.record.schema.RecordStoreSchema)1 TabbedPane (com.revolsys.swing.TabbedPane)1 DnDTabbedPane (com.revolsys.swing.component.DnDTabbedPane)1 Project (com.revolsys.swing.map.layer.Project)1