(children == null) ? (original.isLeaf() ? org.openide.nodes.Children.LEAF : new Children(original)) : children, lookup );
protected boolean enable (Node[] activatedNodes) { if ((activatedNodes == null) || (activatedNodes.length != 1) || (activatedNodes[0].isLeaf())) return false; return true; }
if (original.isLeaf() && (getChildren() != Children.LEAF)) { setChildren(Children.LEAF); } else if (!original.isLeaf() && (getChildren() == Children.LEAF)) { setChildren(new Children(original)); } else if (!original.isLeaf() && (getChildren() != Children.LEAF)) { ((FilterNode.Children) getChildren()).changeOriginal(original);
public SortedNode (Node original) { super(original, original.isLeaf() ? Children.LEAF : new SortedChildren(original)); original2filter.put (original, this); } public Node getOriginalNode () {
private static org.openide.nodes.Children createChildren(Node original) { if( original.isLeaf()) { return Children.LEAF; } else { return new ContextChildren(original); } }
public static int getHeight(Node n){ if(n.isLeaf()){ return 0; }else{ int maxDepth = 0; foreach(Node child : n.getChildren()){ maxDepth = Math.max(maxDepth, getHeight(child)); } return maxDepth + 1; } }
static private Set<Node> getNodes2Open (Node [] nodes) { Set<Node> nodes2open = new HashSet<> (nodes.length); for (int i = 0; i < nodes.length; i++) { if (nodes [i].isLeaf ()) { nodes2open.add (nodes [i]); } else { nodes2open.addAll (getNodes2Open (nodes [i].getChildren ().getNodes (true))); } } return nodes2open; }
/** Create a menu element for a node. The default implementation creates * {@link MenuView.MenuItem}s for leafs and <code>Menu</code> for other nodes. * * @param n node to create element for * @return the created node */ protected JMenuItem createMenuItem (Node n) { return n.isLeaf () ? (JMenuItem) new MenuItem (n, action) : (JMenuItem) new Menu (n, action); }
public long minValue() { Node curNode = root; while (!curNode.isLeaf()) { curNode = curNode.getChild(0); } return curNode.getMin(); }
/** Create a menu element for a node. The default implementation creates * {@link MenuView.MenuItem}s for leafs and <code>Menu</code> for other nodes. * * @param n node to create element for * @return the created node */ protected JMenuItem createMenuItem(Node n) { return n.isLeaf() ? (JMenuItem) new MenuItem(n, action) : (JMenuItem) new Menu(n, action); }
public static void rotateLeft(Node node) { assert(!node.isLeaf() && !node.right != null); final Node child = node.right; node.setRight(child.left); if(node.isLeftChild()) { node.parent.setLeft(child); } else { node.parent.setRight(child); } chlid.setLeft(node); }
private boolean isMoveUpEnabled (Node [] nodes) { if (nodes == null || nodes.length != 1 || ! nodes [0].isLeaf ()) { return false; } Node parent = nodes [0].getParentNode (); if (parent == null) { return false; } int pos = getNodePosition (nodes [0]); return pos != -1 && pos > 0; }
private static Children createChildren(FileObject fo) { if (fo != null) { try { Node n = DataObject.find(fo).getNodeDelegate(); if (!n.isLeaf()) { // using n.cloneNode().getChildren() does not work; someone caches cloneNode?? return new FilterNode.Children(n); } } catch (DataObjectNotFoundException x) { Exceptions.printStackTrace(x); } } return Children.LEAF; }
public int getChildCount(java.lang.Object parent) { int superCnt = super.getChildCount(parent); int myCnt = 0; for (int i = 0; i < superCnt; i++) { Node n = Visualizer.findNode(super.getChild(parent, i)); if (!n.isLeaf()) { myCnt++; } } return myCnt; }
public int getChildCount(java.lang.Object parent) { int superCnt = super.getChildCount (parent); int myCnt = 0; for (int i = 0; i < superCnt; i++) { Node n = Visualizer.findNode (super.getChild (parent, i)); if (!n.isLeaf ()) { myCnt++; } } return myCnt; }
public static void rotateRight(Node node) { assert(!node.isLeaf() && !node.left.isLeaf()); final Node child = node.left; node.setLeft(child.right); if (node.isRightChild()) node.parent.setRight(child); else node.parent.setLeft(child); child.setRight(node); }
public int getChildCount(java.lang.Object parent) { int superCnt = super.getChildCount (parent); int myCnt = 0; for (int i = 0; i < superCnt; i++) { Node n = Visualizer.findNode (super.getChild (parent, i)); if (!n.isLeaf ()) { myCnt++; } } return myCnt; }
private boolean isMoveDownEnabled (Node [] nodes) { if (nodes == null || nodes.length != 1 || ! nodes [0].isLeaf ()) { return false; } Node parent = nodes [0].getParentNode (); if (parent == null) { return false; } int count = parent.getChildren ().getNodesCount (); int pos = getNodePosition (nodes [0]); return pos != -1 && pos < (count - 1); }
public FolderFilterNode(BasicNodes nodeType, Node folderNode, List<File> ignoreList) { super(folderNode, folderNode.isLeaf() ? Children.LEAF : new FolderFilterChildren(folderNode, ignoreList)); this.nodeType = nodeType; iconDelegate = DataFolder.findFolder (FileUtil.getConfigRoot()).getNodeDelegate(); delegate = folderNode; }
public void num(Node n) { if(n.getleft()!=null)num(n.getleft()); if(n.getRight()!=null)num(n.getRight()); if(n.isLeaf()) { n.assignIndex(ini); ini++; } }