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


Java Children.getNodes方法代碼示例

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


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

示例1: expandAllNodes

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

示例2: representationOf

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

示例3: testChildrenCanGC

import org.openide.nodes.Children; //導入方法依賴的package包/類
public void testChildrenCanGC () throws Exception {
    Filter filter = new Filter();
    holder = filter;

    String pref = getName() + '/';
    FileObject bb = FileUtil.createFolder(FileUtil.getConfigRoot(), pref + "/BB");
    bb.createData("Ahoj.txt");
    bb.createData("Hi.txt");
    DataFolder folder = DataFolder.findFolder(bb);

    Children ch = folder.createNodeChildren(filter);
    LOG.info("children created: " + ch);
    Node[] arr = ch.getNodes(true);
    LOG.info("nodes obtained" + arr);
    assertEquals("Accepts only Ahoj", 1, arr.length);
    LOG.info("The one node" + arr[0]);

    WeakReference<Children> ref = new WeakReference<Children>(ch);
    ch = null;
    arr = null;

    assertGC("Children can disappear even we hold the filter", ref);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:FolderChildrenTest.java

示例4: testOrderAttributesAreReflected

import org.openide.nodes.Children; //導入方法依賴的package包/類
public void testOrderAttributesAreReflected() throws Exception {
    FileObject root = FileUtil.createFolder(FileUtil.getConfigRoot(), "order");

    for (int i = 0; i < 256; i++) {
        FileUtil.createData(root, "file" + i + ".txt");
    }

    FileObject[] arr = root.getChildren();
    assertEquals(256, arr.length);

    for (int i = 0; i < 256; i++) {
        arr[i].setAttribute("position", i ^ 0x6B);
    }

    DataFolder folder = DataFolder.findFolder (root);
    Node n = folder.getNodeDelegate();
    Children ch = n.getChildren();
    Node[] nodes = ch.getNodes (true);
    assertEquals(256, nodes.length);

    for (int i = 0; i < 256; i++) {
        FileObject fo = nodes[i].getLookup().lookup(FileObject.class);
        assertNotNull(i + " Has file object: " + nodes[i], fo);
        assertEquals(i + " It is the correct one: ", arr[i ^ 0x6B], fo);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:FolderChildrenTest.java

示例5: expandFirstLevel

import org.openide.nodes.Children; //導入方法依賴的package包/類
private void expandFirstLevel(BeanTreeView btv) {
    
    Node root = manager.getRootContext();
    Children ch = root.getChildren();
    if ( ch == Children.LEAF ) {
        return;
    }
    Node nodes[] = ch.getNodes(true);

    btv.expandNode(root);
    for ( int i = 0; i < nodes.length; i++ ) {            
        btv.expandNode( nodes[i] );
        if ( i == 0 ) {
            try {
                manager.setSelectedNodes( new Node[] { nodes[i] } );
            }
            catch ( java.beans.PropertyVetoException e ) {
                // No selection for some reason
            }
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:BrowseFolders.java

示例6: getNodeForElement

import org.openide.nodes.Children; //導入方法依賴的package包/類
public ElementNode getNodeForElement(ElementHandle<Element> eh) {

        if (getDescritption().elementHandle != null
                && eh.signatureEquals(getDescritption().elementHandle)) {
            return this;
        }

        Children ch = getChildren();
        if (ch instanceof ElementChilren) {
            for (Node sub : ch.getNodes()) {
                ElementNode result = ((ElementNode) sub).getNodeForElement(eh);
                if (result != null) {
                    return result;
                }
            }
        }

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

示例7: getTemplateNode

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

示例8: testChangeableDataFilterOnNodeDelegate

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

示例9: testChangeableDataFilter

import org.openide.nodes.Children; //導入方法依賴的package包/類
@RandomlyFails // NB-Core-Build #1058 (in FolderChildrenLazyTest)
public void testChangeableDataFilter() 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);

    Children ch = folder.createNodeChildren( filter );
    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,代碼行數:23,代碼來源:FolderChildrenTest.java

示例10: getActions

import org.openide.nodes.Children; //導入方法依賴的package包/類
/** Getter for set of actions that should be present in the
* popup menu of this node. This set is used in construction of
* menu returned from getContextMenu and specially when a menu for
* more nodes is constructed.
*
* @return array of system actions that should be in popup menu
*/
@Override
public Action[] getActions ( boolean context ) {
    if ( context ) {
        return super.getActions( true );
    }
    else {
        Children ch = getChildren();
        Node[] nodes = ch.getNodes();
        if ( nodes == null )
            return new SystemAction[0];

        if( nodes.length == 0 || ( nodes[0] != null && ((BiFeatureNode)nodes[0]).getBiFeature() instanceof BiFeature.Descriptor) )
            return new SystemAction[0];

        return new SystemAction[] {
                                SystemAction.get (BiIncludeAllAction.class),
                                SystemAction.get (BiExcludeAllAction.class),
                                null
                            };
    }                          
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:BiNode.java

示例11: testViewItemChanges

import org.openide.nodes.Children; //導入方法依賴的package包/類
@RandomlyFails // NB-Core-Build #1012
public void testViewItemChanges() throws Exception {
    FileObject top = FileUtil.toFileObject(copyFolder(FileUtil.toFile(egdirFO.getFileObject("extsrcroot"))));
    FreeformProject extsrcroot_ = (FreeformProject) ProjectManager.getDefault().findProject(top.getFileObject("proj"));
    Node root = extsrcroot_.getLookup().lookup(LogicalViewProvider.class).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 code name #2", "nbproject/project.xml", kids[1].getName());
    TestNL l = new TestNL();
    root.addNodeListener(l);
    Element data = extsrcroot_.getPrimaryConfigurationData();
    Element view = XMLUtil.findElement(data, "view", FreeformProjectType.NS_GENERAL);
    assertNotNull("have <view>", view);
    Element items = XMLUtil.findElement(view, "items", FreeformProjectType.NS_GENERAL);
    assertNotNull("have <items>", items);
    Element sourceFolder = XMLUtil.findElement(items, "source-folder", FreeformProjectType.NS_GENERAL);
    assertNotNull("have <source-folder>", sourceFolder);
    Element location = XMLUtil.findElement(sourceFolder, "location", FreeformProjectType.NS_GENERAL);
    assertNotNull("have <location>", location);
    NodeList nl = location.getChildNodes();
    assertEquals("one child", 1, nl.getLength());
    location.removeChild(nl.item(0));
    location.appendChild(location.getOwnerDocument().createTextNode("../src2"));
    Element sourceFile =  XMLUtil.findElement(items, "source-file", FreeformProjectType.NS_GENERAL);
    assertNotNull("have <source-file>", sourceFile);
    items.removeChild(sourceFile);
    extsrcroot_.putPrimaryConfigurationData(data);
    // children keys are updated asynchronously. give them a time
    Thread.sleep(500);
    assertFalse("got some changes in children", l.probeChanges().isEmpty());
    kids = ch.getNodes(true);
    assertEquals("one child node", 1, kids.length);
    assertEquals("correct code name #1", "../src2", kids[0].getName());
    assertEquals("correct display name #1", "External Sources", kids[0].getDisplayName());
    assertEquals("correct cookie #1",
            DataObject.find(top.getFileObject("src2")),
            kids[0].getLookup().lookup(DataObject.class));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:41,代碼來源:ViewTest.java

示例12: findNodeFor

import org.openide.nodes.Children; //導入方法依賴的package包/類
ComponentNode findNodeFor(ComponentInfo ci) {
    if (ci.equals(this.ci)) {
        return this;
    }
    Children ch = getChildren();
    Node[] subNodes = ch.getNodes();
    for (Node n : subNodes) {
        ComponentNode cn = (ComponentNode) n;
        ComponentNode node = cn.findNodeFor(ci);
        if (node != null) {
            return node;
        }
    }
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:ComponentNode.java

示例13: checkNoLazyNode

import org.openide.nodes.Children; //導入方法依賴的package包/類
static void checkNoLazyNode(Children children) {
    for (Node n : children.getNodes()) {
        if (n instanceof BadgingNode) {
            ((BadgingNode)n).replaceProject(null);
        }

        if (n.getLookup().lookup(LazyProject.class) != null) {
            OpenProjectList.LOGGER.warning("LazyProjects remain visible");
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:ProjectsRootNode.java

示例14: testViewItemBasic

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

示例15: testViewItemBasic

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


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