List of usage examples for javax.swing.tree DefaultMutableTreeNode DefaultMutableTreeNode
public DefaultMutableTreeNode(Object userObject, boolean allowsChildren)
From source file:org.apache.cayenne.modeler.ProjectTreeView.java
public void embeddableAdded(EmbeddableEvent e, DataMap map) { Embeddable embeddable = e.getEmbeddable(); DefaultMutableTreeNode mapNode = getProjectModel().getNodeForObjectPath(new Object[] { e.getDomain() != null ? e.getDomain() : (DataChannelDescriptor) mediator.getProject().getRootNode(), map });/*from ww w. j a v a 2 s.c om*/ if (mapNode == null) { return; } DefaultMutableTreeNode currentNode = new DefaultMutableTreeNode(embeddable, false); positionNode(mapNode, currentNode, Comparators.getDataMapChildrenComparator()); showNode(currentNode); }
From source file:org.apache.jackrabbit.oak.explorer.NodeStoreTree.java
private void refreshModel() { index = backend.getTarReaderIndex(); sizeCache = newHashMap();/* w w w.jav a 2 s . co m*/ DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode( new NamePathModel("/", "/", backend.getHead(), sizeCache, skipSizeCheck, backend), true); treeModel = new DefaultTreeModel(rootNode); addChildren(rootNode); tree.setModel(treeModel); }
From source file:org.apache.jackrabbit.oak.explorer.NodeStoreTree.java
private void addChildren(DefaultMutableTreeNode parent) { NamePathModel model = (NamePathModel) parent.getUserObject(); if (model.isLoaded()) { return;// w ww .ja v a 2s. c o m } List<NamePathModel> kids = newArrayList(); for (ChildNodeEntry ce : model.getState().getChildNodeEntries()) { NamePathModel c = new NamePathModel(ce.getName(), concat(model.getPath(), ce.getName()), ce.getNodeState(), sizeCache, skipSizeCheck, backend); kids.add(c); } sort(kids); for (NamePathModel c : kids) { DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(c, true); treeModel.insertNodeInto(childNode, parent, parent.getChildCount()); } model.loaded(); }