private void removeFromTree() { DefaultMutableTreeNode last = stack.getLastLeaf(); if (last == null) { System.out.println("removeFromTree - last == null"); return; } DefaultMutableTreeNode parent = (DefaultMutableTreeNode) last.getParent(); if (parent != null) { // for some unknown reasons parent might be null, see bug 1597987 parent.remove(last); } last = stack.getLastLeaf(); if (last == null || last.getUserObject() == null) { return; } PathElement e = (PathElement) last.getUserObject(); if (e != null && e.isPseudoPathElement()) { this.removeFromTree(); } }
private void replaceTree(DefaultMutableTreeNode replaced, DefaultMutableTreeNode replacee) { replaced.removeAllChildren(); while (replacee.getChildCount() > 0) { DefaultMutableTreeNode first = (DefaultMutableTreeNode) replacee. getChildAt(0); replacee.remove(first); first.removeFromParent(); replaced.add(first); first.setParent(replaced); } } }
@Override public void remove(N node) { super.remove(node); }
public void remove(int childIndex) { if (filter != null) { // as child indexes might be inconsistent.. throw new IllegalStateException( "Can't remove while the filter is active"); } super.remove(childIndex); }
@Override public void remove(MutableTreeNode aChild) { setDirty(); super.remove(aChild); }
@Override public void remove(int index) { setDirty(); super.remove(index); }
/** Removes <code>aChild</code> from this node's child array, giving it a * null parent. * * @param aChild a child of this node to remove * @exception IllegalArgumentException if <code>aChild</code> * is null or is not a child of this node * */ public void remove(MutableTreeNode aChild) { loadKidsIfNeeded(); super.remove(aChild); }
protected void done() { _schemaNode.remove(0); updateUI(); }
protected void done() { _tableNode.remove(0); updateUI(); }
@Override public void remove(int childIndex) { // first do the removal in the bean BeanTreeNode child = (BeanTreeNode) getChildAt(childIndex); if (useElementsAsChildren) { ((Collection) userObject).remove(child.getUserObject()); } else throw new IllegalStateException("Must not remove"); // then remove the child node super.remove(childIndex); }
public void removeFolder(DefaultMutableTreeNode node) { ArrayList<WhereConditionColumnWrapper> allChildCols = getAllChildCols(node); DefaultMutableTreeNode parent = (DefaultMutableTreeNode) node.getParent(); parent.remove(node); for (WhereConditionColumnWrapper col : allChildCols) { parent.add(new DefaultMutableTreeNode(col)); } } }
private void removeEmptyGroups(DefaultMutableTreeNode root, Map<String, Integer> groupNodeMap) { DefaultMutableTreeNode rootChild = (DefaultMutableTreeNode) root.getFirstChild(); while (rootChild != null) { DefaultMutableTreeNode nextChild = rootChild.getNextSibling(); if (rootChild.getChildCount() == 0 && groupNodeMap.containsKey(rootChild.getUserObject().toString())) { root.remove(rootChild); } rootChild = nextChild; } }
private void removeEmptyGroups(DefaultMutableTreeNode root, Map<String, Integer> groupNodeMap) { DefaultMutableTreeNode rootChild = (DefaultMutableTreeNode) root.getFirstChild(); while (rootChild != null) { DefaultMutableTreeNode nextChild = rootChild.getNextSibling(); if (rootChild.getChildCount() == 0 && groupNodeMap.containsKey(rootChild.getUserObject().toString())) { root.remove(rootChild); } rootChild = nextChild; } }
/** * Remove a child. * @param idx The index. */ public void remove(MutableTreeNode child) { assert SwingUtilities.isEventDispatchThread(); int idx = getIndex(child); tm.removeNode((IdTreeNode<T>)child); super.remove(child); tm.nodesWereRemoved(this, new int[]{idx}, new TreeNode[]{child}); }
/** * Remove a child. * @param idx The index. */ public void remove(int idx) { assert SwingUtilities.isEventDispatchThread(); IdTreeNode<T> child = (IdTreeNode<T>)getChildAt(idx); tm.removeNode(child); super.remove(idx); tm.nodesWereRemoved(this, new int[]{idx}, new TreeNode[]{child}); }
/** * Removes the child node. * * @param child Node to remove. */ public void remove(DefaultMutableTreeNode child) { super.remove(child); FavoritesItem childItem = (FavoritesItem) ((FavoritesNode) child).getUserObject(); FavoritesItem ParentItem = (FavoritesItem) getUserObject(); if (parent != null) ParentItem.remove(childItem); } /**
public void removePath(TreePath path, int index, Object deletedObject) { TreePath parentPath = path.getParentPath(); Object source = parentPath.getLastPathComponent(); Object[] paths = parentPath.getPath(); if (((LazyMutableTreeNode) source).isLoaded()) { ((DefaultMutableTreeNode) source).remove((MutableTreeNode) deletedObject); } fireTreeNodesRemoved( source, paths, new int[]{index}, new Object[]{deletedObject}); }
public void actionPerformed(ActionEvent e) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) portTree .getSelectionPath().getLastPathComponent(); DefaultMutableTreeNode parent = (DefaultMutableTreeNode) node .getParent(); DefaultMutableTreeNode previousNode = node.getPreviousNode(); parent.remove(node); treeModel.nodeStructureChanged(parent); portTree.setSelectionPath(new TreePath(previousNode.getPath())); } };
public void removeRootPageAt(int index) { _rootNode.remove(index); if (getNumRootPages() > 0) { setCurrentPage(getRootPageAt(0)); } else { setCurrentPage(null); } }
@Test public void remove() { final TreeNode<Integer> tree = newTree(5, new Random(123)); final DefaultMutableTreeNode stree = newSwingTree(5, new Random(123)); tree.remove(0); stree.remove(0); Assert.assertTrue(equals(tree, stree)); }