use of com.revolsys.swing.tree.BaseTreeNode in project com.revolsys.open by revolsys.
the class ProjectFrame method newTabLeftCatalogPanel.
protected void newTabLeftCatalogPanel() {
final BaseTreeNode recordStores = RecordStoreConnectionTrees.newRecordStoreConnectionsTreeNode();
final BaseTreeNode fileSystems = PathTreeNode.newFileSystemsTreeNode();
final BaseTreeNode folderConnections = FolderConnectionsTrees.newFolderConnectionsTreeNode();
final BaseTreeNode webServices = WebServiceConnectionTrees.newWebServiceConnectionsTreeNode();
final ListTreeNode root = new ListTreeNode("/", recordStores, fileSystems, folderConnections, webServices);
final BaseTree tree = new BaseTree(root);
tree.setRootVisible(false);
recordStores.expandChildren();
fileSystems.expand();
folderConnections.expandChildren();
webServices.expandChildren();
this.catalogTree = tree;
final Icon icon = Icons.getIconWithBadge("folder", "tree");
final TabbedPane tabs = this.leftTabs;
final Component component = this.catalogTree;
tabs.addTab(icon, "Catalog", component, true);
}
use of com.revolsys.swing.tree.BaseTreeNode in project com.revolsys.open by revolsys.
the class TreeTransferHandler method canImport.
@Override
public boolean canImport(final TransferSupport support) {
final Component component = support.getComponent();
if (component instanceof JTree) {
final JTree.DropLocation loc = (JTree.DropLocation) support.getDropLocation();
final TreePath path = loc.getPath();
if (path != null) {
final Object pathItem = path.getLastPathComponent();
if (pathItem instanceof BaseTreeNode) {
final BaseTreeNode node = (BaseTreeNode) pathItem;
return node.isDndCanImport(path, support);
}
}
}
return false;
}
use of com.revolsys.swing.tree.BaseTreeNode in project com.revolsys.open by revolsys.
the class FunctionChildrenTreeNode method loadChildrenDo.
@Override
protected List<BaseTreeNode> loadChildrenDo() {
final Object userObject = getUserObject();
final List<BaseTreeNode> nodes = new ArrayList<>();
for (final Object child : this.factory.apply(userObject)) {
final BaseTreeNode node = BaseTreeNode.newTreeNode(child);
if (node != null) {
nodes.add(node);
}
}
return nodes;
}
use of com.revolsys.swing.tree.BaseTreeNode in project com.revolsys.open by revolsys.
the class ListTreeNode method setChildren.
public void setChildren(final List<? extends BaseTreeNode> children) {
final List<BaseTreeNode> oldChildren = this.children;
if (children != oldChildren) {
for (int i = 0; i < oldChildren.size(); ) {
final BaseTreeNode oldChild = oldChildren.get(i);
if (children.contains(oldChild)) {
i++;
} else {
oldChildren.remove(i);
nodeRemoved(i, oldChild);
oldChild.setParent(null);
}
}
int i = 0;
while (i < children.size() && i < oldChildren.size()) {
final BaseTreeNode oldChild = oldChildren.get(i);
final BaseTreeNode newNode = children.get(i);
if (!newNode.equals(oldChild)) {
newNode.setParent(this);
oldChildren.add(i, newNode);
nodesInserted(i);
}
i++;
}
while (i < children.size()) {
final BaseTreeNode newNode = children.get(i);
newNode.setParent(this);
oldChildren.add(i, newNode);
nodesInserted(i);
i++;
}
}
}
use of com.revolsys.swing.tree.BaseTreeNode in project com.revolsys.open by revolsys.
the class ListTreeNode method removeNode.
public void removeNode(final int index) {
Invoke.andWait(() -> {
if (index >= 0 && index < this.children.size()) {
final BaseTreeNode node = this.children.remove(index);
node.setParent(null);
nodeRemoved(index, node);
}
});
}
Aggregations