org.openide.nodes.Node.isLeaf()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(236)

本文整理了Java中org.openide.nodes.Node.isLeaf()方法的一些代码示例,展示了Node.isLeaf()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.isLeaf()方法的具体详情如下:
包路径:org.openide.nodes.Node
类名称:Node
方法名:isLeaf

Node.isLeaf介绍

[英]Test whether the node is a leaf, or may contain children.
[中]测试该节点是叶节点,还是可能包含子节点。

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-nodes

  1. (children == null) ? (original.isLeaf() ? org.openide.nodes.Children.LEAF : new Children(original)) : children,
  2. lookup
  3. );

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

  1. protected boolean enable (Node[] activatedNodes) {
  2. if ((activatedNodes == null) || (activatedNodes.length != 1) ||
  3. (activatedNodes[0].isLeaf()))
  4. return false;
  5. return true;
  6. }

代码示例来源:origin: org.netbeans.api/org-openide-nodes

  1. if (original.isLeaf() && (getChildren() != Children.LEAF)) {
  2. setChildren(Children.LEAF);
  3. } else if (!original.isLeaf() && (getChildren() == Children.LEAF)) {
  4. setChildren(new Children(original));
  5. } else if (!original.isLeaf() && (getChildren() != Children.LEAF)) {
  6. ((FilterNode.Children) getChildren()).changeOriginal(original);

代码示例来源:origin: org.netbeans.api/org-openide-explorer

  1. public SortedNode (Node original) {
  2. super(original, original.isLeaf() ? Children.LEAF : new SortedChildren(original));
  3. original2filter.put (original, this);
  4. }
  5. public Node getOriginalNode () {

代码示例来源:origin: nl.cloudfarming.client/nbtaskfocus-core

  1. private static org.openide.nodes.Children createChildren(Node original) {
  2. if( original.isLeaf()) {
  3. return Children.LEAF;
  4. } else {
  5. return new ContextChildren(original);
  6. }
  7. }

代码示例来源:origin: stackoverflow.com

  1. public static int getHeight(Node n){
  2. if(n.isLeaf()){
  3. return 0;
  4. }else{
  5. int maxDepth = 0;
  6. foreach(Node child : n.getChildren()){
  7. maxDepth = Math.max(maxDepth, getHeight(child));
  8. }
  9. return maxDepth + 1;
  10. }
  11. }

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-templates

  1. static private Set<Node> getNodes2Open (Node [] nodes) {
  2. Set<Node> nodes2open = new HashSet<> (nodes.length);
  3. for (int i = 0; i < nodes.length; i++) {
  4. if (nodes [i].isLeaf ()) {
  5. nodes2open.add (nodes [i]);
  6. } else {
  7. nodes2open.addAll (getNodes2Open (nodes [i].getChildren ().getNodes (true)));
  8. }
  9. }
  10. return nodes2open;
  11. }

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

  1. /** Create a menu element for a node. The default implementation creates
  2. * {@link MenuView.MenuItem}s for leafs and <code>Menu</code> for other nodes.
  3. *
  4. * @param n node to create element for
  5. * @return the created node
  6. */
  7. protected JMenuItem createMenuItem (Node n) {
  8. return n.isLeaf () ?
  9. (JMenuItem) new MenuItem (n, action) :
  10. (JMenuItem) new Menu (n, action);
  11. }

代码示例来源:origin: stackoverflow.com

  1. public long minValue() {
  2. Node curNode = root;
  3. while (!curNode.isLeaf()) {
  4. curNode = curNode.getChild(0);
  5. }
  6. return curNode.getMin();
  7. }

代码示例来源:origin: org.netbeans.api/org-openide-explorer

  1. /** Create a menu element for a node. The default implementation creates
  2. * {@link MenuView.MenuItem}s for leafs and <code>Menu</code> for other nodes.
  3. *
  4. * @param n node to create element for
  5. * @return the created node
  6. */
  7. protected JMenuItem createMenuItem(Node n) {
  8. return n.isLeaf() ? (JMenuItem) new MenuItem(n, action) : (JMenuItem) new Menu(n, action);
  9. }

代码示例来源:origin: stackoverflow.com

  1. public static void rotateLeft(Node node) {
  2. assert(!node.isLeaf() && !node.right != null);
  3. final Node child = node.right;
  4. node.setRight(child.left);
  5. if(node.isLeftChild()) {
  6. node.parent.setLeft(child);
  7. }
  8. else {
  9. node.parent.setRight(child);
  10. }
  11. chlid.setLeft(node);
  12. }

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-templates

  1. private boolean isMoveUpEnabled (Node [] nodes) {
  2. if (nodes == null || nodes.length != 1 || ! nodes [0].isLeaf ()) {
  3. return false;
  4. }
  5. Node parent = nodes [0].getParentNode ();
  6. if (parent == null) {
  7. return false;
  8. }
  9. int pos = getNodePosition (nodes [0]);
  10. return pos != -1 && pos > 0;
  11. }

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-maven-repository

  1. private static Children createChildren(FileObject fo) {
  2. if (fo != null) {
  3. try {
  4. Node n = DataObject.find(fo).getNodeDelegate();
  5. if (!n.isLeaf()) { // using n.cloneNode().getChildren() does not work; someone caches cloneNode??
  6. return new FilterNode.Children(n);
  7. }
  8. } catch (DataObjectNotFoundException x) {
  9. Exceptions.printStackTrace(x);
  10. }
  11. }
  12. return Children.LEAF;
  13. }

代码示例来源:origin: org.netbeans.api/org-openide-explorer

  1. public int getChildCount(java.lang.Object parent) {
  2. int superCnt = super.getChildCount(parent);
  3. int myCnt = 0;
  4. for (int i = 0; i < superCnt; i++) {
  5. Node n = Visualizer.findNode(super.getChild(parent, i));
  6. if (!n.isLeaf()) {
  7. myCnt++;
  8. }
  9. }
  10. return myCnt;
  11. }

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

  1. public int getChildCount(java.lang.Object parent) {
  2. int superCnt = super.getChildCount (parent);
  3. int myCnt = 0;
  4. for (int i = 0; i < superCnt; i++) {
  5. Node n = Visualizer.findNode (super.getChild (parent, i));
  6. if (!n.isLeaf ()) {
  7. myCnt++;
  8. }
  9. }
  10. return myCnt;
  11. }

代码示例来源:origin: stackoverflow.com

  1. public static void rotateRight(Node node) {
  2. assert(!node.isLeaf() && !node.left.isLeaf());
  3. final Node child = node.left;
  4. node.setLeft(child.right);
  5. if (node.isRightChild())
  6. node.parent.setRight(child);
  7. else node.parent.setLeft(child);
  8. child.setRight(node);
  9. }

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

  1. public int getChildCount(java.lang.Object parent) {
  2. int superCnt = super.getChildCount (parent);
  3. int myCnt = 0;
  4. for (int i = 0; i < superCnt; i++) {
  5. Node n = Visualizer.findNode (super.getChild (parent, i));
  6. if (!n.isLeaf ()) {
  7. myCnt++;
  8. }
  9. }
  10. return myCnt;
  11. }

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-templates

  1. private boolean isMoveDownEnabled (Node [] nodes) {
  2. if (nodes == null || nodes.length != 1 || ! nodes [0].isLeaf ()) {
  3. return false;
  4. }
  5. Node parent = nodes [0].getParentNode ();
  6. if (parent == null) {
  7. return false;
  8. }
  9. int count = parent.getChildren ().getNodesCount ();
  10. int pos = getNodePosition (nodes [0]);
  11. return pos != -1 && pos < (count - 1);
  12. }

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-clientproject

  1. public FolderFilterNode(BasicNodes nodeType, Node folderNode, List<File> ignoreList) {
  2. super(folderNode, folderNode.isLeaf() ? Children.LEAF :
  3. new FolderFilterChildren(folderNode, ignoreList));
  4. this.nodeType = nodeType;
  5. iconDelegate = DataFolder.findFolder (FileUtil.getConfigRoot()).getNodeDelegate();
  6. delegate = folderNode;
  7. }

代码示例来源:origin: stackoverflow.com

  1. public void num(Node n) {
  2. if(n.getleft()!=null)num(n.getleft());
  3. if(n.getRight()!=null)num(n.getRight());
  4. if(n.isLeaf())
  5. {
  6. n.assignIndex(ini);
  7. ini++;
  8. }
  9. }

相关文章