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


Java Children.getNodesCount方法代碼示例

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


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

示例1: expandOnlyChilds

import org.openide.nodes.Children; //導入方法依賴的package包/類
private void expandOnlyChilds(Node parent) {
    setExpansionListenerEnabled(false);
    try {
        Node node = parent;
        while (node != null) {
            Children children = node.getChildren();
            if (children.getNodesCount(true) == 1) {
                node = children.getNodeAt(0);
                outlineView.expandNode(node);
            } else {
                node = null;
            }
        }
    } finally {
        setExpansionListenerEnabled(true);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:ResultsOutlineSupport.java

示例2: requestFocusTreeOrTable

import org.openide.nodes.Children; //導入方法依賴的package包/類
void requestFocusTreeOrTable() {
    if (treeViewShowing) {
        treeView.requestFocusInWindow();
    } else if (tableView != null) {
        tableView.getTable().requestFocusInWindow();
    }
    Node selectedNode = getTreeSelectedNode();
    if (selectedNode == null) {
        Children rootChildren = explorerManager.getRootContext().getChildren();
        if (rootChildren.getNodesCount() > 0) {
            try {
                explorerManager.setSelectedNodes(new Node[] { rootChildren.getNodeAt(0) });
            } catch (PropertyVetoException ex) {
                // Ignored
            }
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:BookmarksView.java

示例3: createInnerPanel

import org.openide.nodes.Children; //導入方法依賴的package包/類
/**
 * Creates an inner panel for this and populates
 * it with the children of this node (if there are any).
 */
public SectionNodeInnerPanel createInnerPanel() {
    Children children = getChildren();
    if (children.getNodesCount() == 0) {
        return createNodeInnerPanel();
    } else {
        BoxPanel boxPanel = new BoxPanel(sectionNodeView);
        populateBoxPanel(boxPanel);
        return boxPanel;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:SectionNode.java

示例4: testNodesHaveDataObjectInLookup

import org.openide.nodes.Children; //導入方法依賴的package包/類
public void testNodesHaveDataObjectInLookup() throws Exception {
    FileObject fa = FileUtil.createData(FileUtil.getConfigRoot(), "FK/A");
    FileObject fb = FileUtil.createData(FileUtil.getConfigRoot(), "FK/B");

    FileObject bb = FileUtil.getConfigFile("/FK");

    DataFolder folder = DataFolder.findFolder(bb);
    final CountDownLatch latch = new CountDownLatch(1);
    FormKitDataLoader.waiter = latch;
    // wake up in 3s
    RequestProcessor.getDefault().post(new Runnable() {
        @Override
        public void run() {
            latch.countDown();
        }
    }, 3000);
    
    Pool.setLoader(FormKitDataLoader.class);
    final Children ch = folder.getNodeDelegate().getChildren();
    int cnt = ch.getNodesCount(true);
    assertEquals("Two children", 2, cnt);

    FileObject af = ch.getNodeAt(0).getLookup().lookup(FileObject.class);
    assertEquals("The right file a", fa, af);
    FileObject bf = ch.getNodeAt(1).getLookup().lookup(FileObject.class);
    assertEquals("The right file b", fb, bf);

    FormKitDataLoader.assertMode = false;
    DataObject a = ch.getNodeAt(0).getLookup().lookup(DataObject.class);
    DataObject b = ch.getNodeAt(1).getLookup().lookup(DataObject.class);

    assertSame("Node is there #0", ch.getNodeAt(0), ch.getNodeAt(0).getLookup().lookup(Node.class));
    assertSame("Node is there #1", ch.getNodeAt(1), ch.getNodeAt(1).getLookup().lookup(Node.class));
    
    latch.countDown();
    
    assertNotNull("Obj A found", a);
    assertNotNull("Obj B found", b);
    
    assertEquals("Right primary File A", fa, a.getPrimaryFile());
    assertEquals("Right primary File B", fb, b.getPrimaryFile());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:43,代碼來源:FolderChildrenTest.java


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