當前位置: 首頁>>代碼示例>>Java>>正文


Java Node.isLeaf方法代碼示例

本文整理匯總了Java中org.openide.nodes.Node.isLeaf方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.isLeaf方法的具體用法?Java Node.isLeaf怎麽用?Java Node.isLeaf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openide.nodes.Node的用法示例。


在下文中一共展示了Node.isLeaf方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getChild

import org.openide.nodes.Node; //導入方法依賴的package包/類
public java.lang.Object getChild(java.lang.Object parent, int index) {
    int superCnt = super.getChildCount(parent);
    int myCnt = 0;

    for (int i = 0; i < superCnt; i++) {
        Object origChild = super.getChild(parent, i);
        Node n = Visualizer.findNode(origChild);

        if (!n.isLeaf()) {
            if (myCnt++ == index) {
                return origChild;
            }
        }
    }

    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:ContextTreeView.java

示例2: getIndexOfChild

import org.openide.nodes.Node; //導入方法依賴的package包/類
public int getIndexOfChild(java.lang.Object parent, java.lang.Object child) {
    int superCnt = super.getChildCount(parent);
    int myCnt = 0;

    for (int i = 0; i < superCnt; i++) {
        Object origChild = super.getChild(parent, i);

        if (child.equals(origChild)) {
            return myCnt;
        }

        Node n = Visualizer.findNode(origChild);

        if (!n.isLeaf()) {
            myCnt++;
        }
    }

    return -1;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:ContextTreeView.java

示例3: representationOf

import org.openide.nodes.Node; //導入方法依賴的package包/類
private static void representationOf(Children c, StringBuilder b) {
    boolean first = true;
    for (Node n : c.getNodes(true)) {
        if (first) {
            first = false;
        } else {
            b.append(", ");
        }
        b.append(n.getDisplayName());
        if (!n.isLeaf()) {
            b.append('[');
            representationOf(n.getChildren(), b);
            b.append(']');
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:TemplateChooserPanelGUITest.java

示例4: getPrevRow

import org.openide.nodes.Node; //導入方法依賴的package包/類
private int getPrevRow(int row) {
    row = row - 1;
    Outline outline = tablePanel.treeView.getOutline();
    if(row < 0 || row >= outline.getRowCount()) {
        return -1;
    }
    TreePath path = outline.getOutlineModel().getLayout().getPathForRow(row);
    Node node = Visualizer.findNode(path.getLastPathComponent());
    if(node.isLeaf()) {
        if(node instanceof RevisionNode || node instanceof RevisionNode.FileNode) {
            return row;
        } else {
            return -1;
        }
    } else {
        TreePathSupport support = outline.getOutlineModel().getTreePathSupport();
        if(support.isExpanded(path)) {
            return getPrevRow(row);
        } else {
            support.expandPath(path);
            return row + node.getChildren().getNodesCount();
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:HistoryFileView.java

示例5: getNextRow

import org.openide.nodes.Node; //導入方法依賴的package包/類
private int getNextRow(int row) {
    row = row + 1;
    Outline outline = tablePanel.treeView.getOutline();
    if(row < 0 || row >= outline.getRowCount()) {
        return -1;
    }
    TreePath path = outline.getOutlineModel().getLayout().getPathForRow(row);
    Node node = Visualizer.findNode(path.getLastPathComponent());
    if(node.isLeaf()) {
        if(node instanceof RevisionNode || node instanceof RevisionNode.FileNode) {
            return row;
        } else {
            return -1;
        }
    } else {
        TreePathSupport support = outline.getOutlineModel().getTreePathSupport();
        if(support.isExpanded(path)) {
            return getPrevRow(row);
        } else {
            support.expandPath(path);
            return row + 1;
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:HistoryFileView.java

示例6: copyNode

import org.openide.nodes.Node; //導入方法依賴的package包/類
protected Node copyNode (Node node) {
    boolean filter = false;
    try {
        DataObject d = (DataObject) node.getCookie (DataObject.class);
        if (d != null) {
            InstanceCookie.Of inst = (InstanceCookie.Of)d.getCookie(InstanceCookie.Of.class);
            if (inst != null && (inst.instanceOf(Node.class) || inst.instanceOf(Node.Handle.class))) {
                // This is just a node, not a real setting. E.g. ModuleNode, LoaderPoolNode. As such,
                // it itself should not display any origin information, it would make no sense. However
                // its children might have a legitimate DataObject cookie from the SFS.
                d = null;
            }
        }
        DataFolder folder = (DataFolder) node.getCookie (DataFolder.class);
        FileSystem fs = d == null || folder != null ? null : d.getPrimaryFile ().getFileSystem ();
        filter = fs == null ? false : fs.isDefault();
    } catch (FileStateInvalidException e) {
        // ignore
    }

    return filter ? new SettingFilterNode (node) : 
        node.isLeaf() ? node.cloneNode() : new TrivialFilterNode(node);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:SettingChildren.java

示例7: isRelevantNode

import org.openide.nodes.Node; //導入方法依賴的package包/類
@Override
public boolean isRelevantNode(Node node) {
    if (node == null) {
        return false;
    } else {
        Node parent = node.getParentNode();
        return node.isLeaf() && parent != null
                && parent.getParentNode() != null;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:DefaultSearchResultsDisplayer.java

示例8: printTree

import org.openide.nodes.Node; //導入方法依賴的package包/類
private static String printTree(Node n) {
    String name = n.getDisplayName();
    if (n.isLeaf()) {
        return name;
    } else {
        List<String> kidNames = new ArrayList<String>();
        for (Node kid : n.getChildren().getNodes(true)) {
            kidNames.add(printTree(kid));
        }
        return name + kidNames;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:PackageViewTest.java

示例9: createChildren

import org.openide.nodes.Node; //導入方法依賴的package包/類
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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:VersionNode.java

示例10: FilteredNode

import org.openide.nodes.Node; //導入方法依賴的package包/類
FilteredNode(Node original, String displayName, Filter filter) {
    super(original, original.isLeaf() ? Children.LEAF : new FilteredChildren(original, filter));
    if (displayName != null) {
        disableDelegation(DELEGATE_GET_DISPLAY_NAME | DELEGATE_SET_DISPLAY_NAME);
        setDisplayName(displayName);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:ClassPathFileChooser.java

示例11: getChildCount

import org.openide.nodes.Node; //導入方法依賴的package包/類
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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:ContextTreeView.java

示例12: initChildren

import org.openide.nodes.Node; //導入方法依賴的package包/類
private void initChildren() {
    Node node = getOriginal();
    node.addNodeListener(WeakListeners.create(NodeListener.class, this, node));
    final boolean leaf = node.isLeaf();
    if (!leaf) {
        setChildren(children);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:ActionFilterNode.java

示例13: ActionFilterNode

import org.openide.nodes.Node; //導入方法依賴的package包/類
private ActionFilterNode(Node original, int mode) {
    super(original, original.isLeaf() ? Children.LEAF : new ActionFilterChildren(original, mode, null));
    this.mode = mode;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:ActionFilterNode.java

示例14: initTreeView

import org.openide.nodes.Node; //導入方法依賴的package包/類
/**
 * Initializes the tree view.
 */
private void initTreeView() {
    treeView = new BeanTreeView() {
        {
            tree.setCellRenderer(createTreeCellRenderer(tree.getCellRenderer()));
        }

        @Override
        public void expandAll() {
            // The original expandAll() doesn't work for us as it doesn't
            // seem to wait for the calculation of sub-nodes.
            Node root = manager.getRootContext();
            expandAll(root);
            // The view attempts to scroll to the expanded node
            // and it does it with a delay. Hence, simple calls like
            // tree.scrollRowToVisible(0) have no effect (are overriden
            // later) => the dummy collapse and expansion attempts
            // to work around that and keep the root node visible.
            collapseNode(root);
            expandNode(root);
        }

        /**
         * Expands the whole sub-tree under the specified node.
         *
         * @param node root node of the sub-tree that should be expanded.
         */
        private void expandAll(Node node) {
            treeView.expandNode(node);
            for (Node subNode : node.getChildren().getNodes(true)) {
                if (!subNode.isLeaf()) {
                    expandAll(subNode);
                }
            }
        }
    };
    treeView.setAllowedDragActions(DnDConstants.ACTION_NONE);
    treeView.setAllowedDropActions(DnDConstants.ACTION_NONE);
    treeView.setRootVisible(false);
    add(treeView, BorderLayout.CENTER);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:44,代碼來源:DocumentViewPanel.java

示例15: SortedNode

import org.openide.nodes.Node; //導入方法依賴的package包/類
public SortedNode (Node original) {
    super(original, original.isLeaf() ? Children.LEAF : new SortedChildren(original));
    original2filter.put (original, this);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:TreeTableView.java


注:本文中的org.openide.nodes.Node.isLeaf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。