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


Java Node.getChildren方法代碼示例

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


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

示例1: expandOnlyChilds

import org.openide.nodes.Node; //導入方法依賴的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: expandAllNodes

import org.openide.nodes.Node; //導入方法依賴的package包/類
private static void expandAllNodes (BeanTreeView btv, Node node, ExplorerManager mgr, JavaPlatform platform) {
    btv.expandNode (node);
    Children ch = node.getChildren();
    if ( ch == Children.LEAF ) {
        if (platform != null && platform.equals(node.getLookup().lookup(JavaPlatform.class))) {
            try {
                mgr.setSelectedNodes (new Node[] {node});
            } catch (PropertyVetoException e) {
                //Ignore it
            }
        }
        return;
    }
    Node nodes[] = ch.getNodes( true );
    for ( int i = 0; i < nodes.length; i++ ) {
        expandAllNodes( btv, nodes[i], mgr, platform);
    }

}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:PlatformsCustomizer.java

示例3: testModulesNode

import org.openide.nodes.Node; //導入方法依賴的package包/類
@RandomlyFails // NB-Core-Build #7497: two children expected:<2> but was:<0>
public void testModulesNode() throws Exception {
    SuiteProject suite1 = generateSuite("suite1");
    TestBase.generateSuiteComponent(suite1, "module1a");
    Node modulesNode = new ModulesNodeFactory.ModulesNode(suite1);
    modulesNode.getChildren().getNodes(true); // "expand the node" simulation
    waitForGUIUpdate();
    assertEquals("one children", 1, modulesNode.getChildren().getNodes(true).length);
    
    final ModulesNodeFactory.ModulesNode.ModuleChildren children = (ModulesNodeFactory.ModulesNode.ModuleChildren) modulesNode.getChildren();
    TestBase.generateSuiteComponent(suite1, "module1b");
    waitForGUIUpdate();
    assertEquals("two children", 2, children.getNodes(true).length);
    TestBase.generateSuiteComponent(suite1, "module1c");
    ProjectManager.mutex().writeAccess(new Mutex.Action<Void>() {
        public Void run() {
            children.stateChanged(null); // #70914
            return null; // #70914
        }
    });
    waitForGUIUpdate();
    assertEquals("three children", 3, children.getNodes(true).length);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:SuiteLogicalViewTest.java

示例4: initExpandCollapseNotify

import org.openide.nodes.Node; //導入方法依賴的package包/類
private Object initExpandCollapseNotify(TreeExpansionEvent event) {
    Node node = Visualizer.findNode(event.getPath ().getLastPathComponent());
    Object obj = node.getLookup().lookup(Object.class);
    Object actOn;
    node = node.getParentNode();
    if (node == null) {
        actOn = new Integer(0);
    } else {
        Children ch = node.getChildren();
        if (ch instanceof TreeModelNode.TreeModelChildren) {
            actOn = ((TreeModelNode.TreeModelChildren) ch).getTreeDepth();
        } else {
            actOn = ch;
        }
    }
    Models.CompoundModel model = getModel();
    if (model != null) {
        DefaultTreeExpansionManager.get(model).setChildrenToActOn(actOn);
    }
    return obj;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:TreeModelRoot.java

示例5: sortingChanged

import org.openide.nodes.Node; //導入方法依賴的package包/類
void sortingChanged() {
    // PENDING: remember the last sorting to avoid multiple sorting
    // remenber expanded folders
    TreeNode tn = (TreeNode) (this.getRoot());
    java.util.List<TreePath> list = new ArrayList<TreePath>();
    Enumeration<TreePath> en = TreeTableView.this.tree.getExpandedDescendants(new TreePath(tn));

    while ((en != null) && en.hasMoreElements()) {
        TreePath path = en.nextElement();

        // bugfix #32328, don't sort whole subtree but only expanded folders
        Node n = ((VisualizerNode) path.getLastPathComponent ()).node;
        Children children = n.getChildren();
        if (children instanceof SortedChildren) {
            ((SortedChildren) children).sortNodes ();
            list.add(path);
        } // else Children.LEAF
    }

    // expand again folders
    for (int i = 0; i < list.size(); i++) {
        TreeTableView.this.tree.expandPath(list.get(i));
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:TreeTableView.java

示例6: findFirstBookmarkNode

import org.openide.nodes.Node; //導入方法依賴的package包/類
public Node findFirstBookmarkNode(ProjectBookmarks projectBookmarks, FileObject fo) {
    if (rootNode != null) {
        List<Node> projectNodes = rootNode.getChildren().snapshot();
        for (Node pNode : projectNodes) {
            ProjectBookmarksChildren pChildren =
                    (ProjectBookmarksChildren) pNode.getChildren();
            if (pChildren.projectBookmarks == projectBookmarks) {
                for (Node fNode : pChildren.snapshot()) {
                    FileBookmarksChildren fChildren = (FileBookmarksChildren) fNode.getChildren();
                    if (fChildren.fileBookmarks.getFileObject() == fo) {
                        List<Node> bNodes = fChildren.snapshot();
                        if (!bNodes.isEmpty()) {
                            return bNodes.get(0);
                        }
                    }
                }
            }
        }
    }
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:BookmarksNodeTree.java

示例7: expandAllNodes

import org.openide.nodes.Node; //導入方法依賴的package包/類
private static void expandAllNodes(BeanTreeView btv, Node node, ExplorerManager mgr, AndroidSdk platform) {
    btv.expandNode(node);
    Children ch = node.getChildren();
    if (ch == Children.LEAF) {
        if (platform != null && platform.equals(node.getLookup().lookup(AndroidSdk.class))) {
            try {
                mgr.setSelectedNodes(new Node[]{node});
            } catch (PropertyVetoException e) {
                //Ignore it
            }
        }
        return;
    }
    Node nodes[] = ch.getNodes(true);
    for (int i = 0; i < nodes.length; i++) {
        expandAllNodes(btv, nodes[i], mgr, platform);
    }

}
 
開發者ID:NBANDROIDTEAM,項目名稱:NBANDROID-V2,代碼行數:20,代碼來源:SdksCustomizer.java

示例8: getSelectionNodes

import org.openide.nodes.Node; //導入方法依賴的package包/類
private Node[] getSelectionNodes() {
    if(selectionNodes == null) {
        String[] segments = selectionUrl.getPathSegments();
        Node node = (RepositoryPathNode) browser.getExplorerManager().getRootContext();            
        
        for (int i = 0; i < segments.length; i++) {
            Children children = node.getChildren();    
            node = children.findChild(segments[i]);
            if(node==null) {
                break;
            }                    
        }            
        if(node == null) {
            selectionNodes = EMPTY_NODES;
        } else {
            selectionNodes = new Node[] {node};    
        }            
    }
    return selectionNodes;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:SelectPathAction.java

示例9: getTemplateNode

import org.openide.nodes.Node; //導入方法依賴的package包/類
private static Node getTemplateNode(FileObject fo, FileObject rootFO) {
    if (rootFO.equals(fo)) {
        return getTemplateRootNode();
    }
    Node parent = getTemplateNode(fo.getParent(), rootFO);
    if (parent == null) {
        return null;
    }
    Children ch = parent.getChildren();
    for (Node node : ch.getNodes(true)) {
        if (fo.equals(node.getLookup().lookup(FileObject.class))) {
            return node;
        }
    }
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:TemplatesPanel.java

示例10: testChangeableDataFilterOnNodeDelegate

import org.openide.nodes.Node; //導入方法依賴的package包/類
@RandomlyFails // NB-Core-Build #1049 (in FolderChildrenLazyTest), #1051 (in this)
public void testChangeableDataFilterOnNodeDelegate() throws Exception {
    String pref = getName() + "/";
    FileUtil.createData (FileUtil.getConfigRoot(), pref + "BB/A.txt");
    FileUtil.createData (FileUtil.getConfigRoot(), pref + "BB/B.txt");
    FileUtil.createData (FileUtil.getConfigRoot(), pref + "BB/AA.txt");
    FileUtil.createData (FileUtil.getConfigRoot(), pref + "BB/BA.txt");


    FileObject bb = FileUtil.getConfigFile(pref + "BB");

    Filter filter = new Filter();
    DataFolder folder = DataFolder.findFolder (bb);


    Node n = folder.getClonedNodeDelegate(filter);
    Children ch = n.getChildren();
    Node[] arr = ch.getNodes (true);

    assertNodes( arr, new String[] { "A.txt", "AA.txt" } );
    filter.fire();
    arr = ch.getNodes (true);
    assertNodes( arr, new String[] { "B.txt", "BA.txt" } );
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:FolderChildrenTest.java

示例11: testChangeableDataFilter

import org.openide.nodes.Node; //導入方法依賴的package包/類
@RandomlyFails // Because testChangeableDataFilter() RandomlyFails
public void testChangeableDataFilterOnFilterNodeWithPartialRefresh() throws Exception {
    String pref = getName() + "/";
    FileUtil.createData (FileUtil.getConfigRoot(), pref + "BB/0/A.txt");
    FileUtil.createData (FileUtil.getConfigRoot(), pref + "BB/0/B.txt");
    FileUtil.createData (FileUtil.getConfigRoot(), pref + "BB/0/AA.txt");
    FileUtil.createData (FileUtil.getConfigRoot(), pref + "BB/0/BA.txt");
    FileUtil.createData (FileUtil.getConfigRoot(), pref + "BB/1/A.txt");
    FileUtil.createData (FileUtil.getConfigRoot(), pref + "BB/1/B.txt");
    FileUtil.createData (FileUtil.getConfigRoot(), pref + "BB/1/AA.txt");
    FileUtil.createData (FileUtil.getConfigRoot(), pref + "BB/1/BA.txt");

    FileObject bb = FileUtil.getConfigFile(pref + "/BB");

    Filter filter = new Filter();
    DataFolder folder = DataFolder.findFolder (bb);

    Node root = new FilterNode (folder.getNodeDelegate (), folder.createNodeChildren (filter));
    Children ch = root.getChildren();
    doTestChangeableDataFilterWithPartialRefresh(ch, filter, bb);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:FolderChildrenTest.java

示例12: findDropedNodes

import org.openide.nodes.Node; //導入方法依賴的package包/類
private Node[] findDropedNodes(Node folder, Node[] dragNodes) {
    if ((folder == null) || (dragNodes.length == 0)) {
        return null;
    }

    Node[] dropNodes = new Node[dragNodes.length];
    Children children = folder.getChildren();

    for (int i = 0; i < dragNodes.length; i++) {
        dropNodes[i] = children.findChild(dragNodes[i].getName());
    }

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

示例13: setSchema

import org.openide.nodes.Node; //導入方法依賴的package包/類
public void setSchema(SchemaElement schema) {
  schemaElement = schema;
  if (isValid()) {
      Node n = getNodeDelegate();
      Children ch = n.getChildren();
      ((SchemaRootChildren) ch).setElement(schemaElement);
  }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:DBschemaDataObject.java

示例14: testViewItemBasic

import org.openide.nodes.Node; //導入方法依賴的package包/類
public void testViewItemBasic() throws Exception {
    Node root = lvp.createLogicalView();
    Children ch = root.getChildren();
    Node[] kids = ch.getNodes(true);
    assertEquals("two child nodes", 2, kids.length);
    assertEquals("correct code name #1", "../src", kids[0].getName());
    assertEquals("correct display name #1", "External Sources", kids[0].getDisplayName());
    assertEquals("correct cookie #1",
        DataObject.find(egdirFO.getFileObject("extsrcroot/src")),
        kids[0].getLookup().lookup(DataObject.class));
    Node[] kids2 = kids[0].getChildren().getNodes(true);
    assertEquals("one child of ../src", 1, kids2.length);
    assertEquals("correct name of #1's kid", "org.foo", kids2[0].getName());
    // Do not test node #2; supplied by ant/freeform.
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:ViewTest.java

示例15: testViewItemBasic

import org.openide.nodes.Node; //導入方法依賴的package包/類
public void testViewItemBasic() throws Exception {
    Node root = extsrcroot.getLookup().lookup(LogicalViewProvider.class).createLogicalView();
    assertEquals("lookup has project", extsrcroot, root.getLookup().lookup(Project.class));
    Children ch = root.getChildren();
    Node[] kids = ch.getNodes(true);
    assertEquals("two child nodes", 2, kids.length);
    // Do not check anything about #1, since it is provided by java/freeform.
    assertEquals("correct code name #2", "nbproject/project.xml", kids[1].getName());
    assertEquals("correct display name #2", "project.xml", kids[1].getDisplayName());
    assertEquals("correct cookie #2",
            DataObject.find(egdirFO.getFileObject("extsrcroot/proj/nbproject/project.xml")),
            kids[1].getLookup().lookup(DataObject.class));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:ViewTest.java


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