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


Java Children.Array方法代碼示例

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


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

示例1: setUp

import org.openide.nodes.Children; //導入方法依賴的package包/類
protected void setUp () {        
    System.setProperty("org.openide.util.Lookup", Lkp.class.getName()); // no lookup
    
    
    p = new ExplorerPanel ();
    em = p.getExplorerManager ();
    
    TreeView tv = new BeanTreeView ();
    p.add (tv);
    Children ch = new Children.Array ();
    nodes = new Node[10];
    for (int i = 0; i < 10; i++) {
        nodes[i] = new AbstractNode (Children.LEAF);
        nodes[i].setName ("Node" + i);
    }
    ch.add (nodes);
    Node root = new AbstractNode (ch);
    em.setRootContext (root);
    
    // check synchronixzation before
    assertArrays ("INIT: getSelectedNodes equals getActivatedNodes.",
        em.getSelectedNodes (), p.getActivatedNodes ());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:TopComponentActivatedNodesTest.java

示例2: postInitComponents

import org.openide.nodes.Children; //導入方法依賴的package包/類
@Messages("LBL_TemplatesPanel_PleaseWait=Please wait...")
private void postInitComponents () {        
    Mnemonics.setLocalizedText(jLabel1, this.firer.getCategoriesName());
    Mnemonics.setLocalizedText(jLabel2, this.firer.getTemplatesName());
    this.description.setEditorKit(new HTMLEditorKit());
    description.putClientProperty( JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE );

    // please wait node, see issue 52900
    pleaseWait = new AbstractNode (Children.LEAF) {
        @Override
        public Image getIcon (int ignore) {
            return PLEASE_WAIT_ICON;
        }
    };
    pleaseWait.setName(LBL_TemplatesPanel_PleaseWait());
    Children ch = new Children.Array ();
    ch.add (new Node[] {pleaseWait});
    final Node root = new AbstractNode (ch);
    SwingUtilities.invokeLater (new Runnable () {
        @Override public void run() {
            ((ExplorerProviderPanel)categoriesPanel).setRootNode (root);
        }
    });
    ((ExplorerProviderPanel)projectsPanel).addDefaultActionListener( firer );
    description.addHyperlinkListener(new ClickHyperlinks());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:TemplatesPanelGUI.java

示例3: getRootNode

import org.openide.nodes.Children; //導入方法依賴的package包/類
private Node getRootNode(FileObject fileInProject, Filter filter) {
    Children children = new Children.Array();
    children.add(createPackageRootNodes(fileInProject, choosingFolder, filter));
    AbstractNode root = new AbstractNode(children);
    root.setIconBaseWithExtension("org/netbeans/modules/form/editors2/iconResourceRoot.gif"); // NOI18N
    root.setDisplayName(NbBundle.getMessage(ClassPathFileChooser.class, "CTL_ClassPathName")); // NOI18N
    // ProjectUtils.getInformation(prj).getDisplayName()
    return root;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:ClassPathFileChooser.java

示例4: MyNode

import org.openide.nodes.Children; //導入方法依賴的package包/類
private MyNode(boolean addChildren) {
    super(new Children.Array());
    setName("my2");
    setDisplayName("disp2");
    setShortDescription("short2");
    setIconBaseWithExtension("org/netbeans/core/ide/TestIcon2.png");

    if (addChildren) {
        getChildren().add(new Node[] { new MyNode(false), new MyNode(false) });
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:ServiceTabProcessorTest.java

示例5: getWaitRoot

import org.openide.nodes.Children; //導入方法依賴的package包/類
private AbstractNode getWaitRoot() {
    return new AbstractNode(new Children.Array() {
        @Override
        protected Collection<Node> initCollection() {
            return Collections.singleton((Node) new WaitNode());
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:ResourceBundleBrandingPanel.java

示例6: setUp

import org.openide.nodes.Children; //導入方法依賴的package包/類
protected void setUp() throws Exception {
    Children kids = new Children.Array();
    nodes = new Node[] {
        new NoHelpNode(),
        new WithHelpNode("foo"),
        new WithHelpNode("bar"),
        new WithHelpNode("foo"),
    };
    kids.add(nodes);
    root = new AbstractNode(kids);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:FindHelpTest.java

示例7: createCategories

import org.openide.nodes.Children; //導入方法依賴的package包/類
private static Node[] createCategories() {
    Node[] categories = new Node[ CATEGORY_COUNT ];
    
    for( int i=0; i<categories.length; i++ ) {
        Children items = new Children.Array();
        items.add( createItems() );
        categories[i] = new CategoryNode( items, i );
    }
    return categories;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:DummyPalette.java

示例8: createChildren

import org.openide.nodes.Children; //導入方法依賴的package包/類
private static Children createChildren(final PackageData data, CustomScopePanel panel) {
    Children childs = new Children.Array();
    for (ClassData classData : data.getClasses()) {
        childs.add(new Node[]{new ClassNode(classData, panel)});
    }
    return childs;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:CustomScopePanel.java

示例9: setRootNode

import org.openide.nodes.Children; //導入方法依賴的package包/類
/**
 * Sets the given <code>rootNode</code> as the root
 * of this view and adds its associated section node 
 * panel as a section for this.
 */
public void setRootNode(SectionNode rootNode) {
    this.rootNode = rootNode;
    Children root = new Children.Array();
    root.add(new Node[]{rootNode});
    AbstractNode mainNode = new AbstractNode(root);
    mainNode.setDisplayName(rootNode.getDisplayName());
    mainNode.setIconBaseWithExtension(rootNode.getIconBase() + ".gif"); //NOI18N
    setRoot(mainNode);
    addSection(rootNode.getSectionNodePanel());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:SectionNodeView.java

示例10: testIndexOfProvidesResultsEvenIfTheVisualizerIsComputedViaDifferentMeans

import org.openide.nodes.Children; //導入方法依賴的package包/類
public void testIndexOfProvidesResultsEvenIfTheVisualizerIsComputedViaDifferentMeans() throws Exception {
    AbstractNode a = new AbstractNode(new Children.Array());
    AbstractNode m = new AbstractNode(Children.LEAF);
    a.getChildren().add(new Node[] { Node.EMPTY.cloneNode(), m, Node.EMPTY.cloneNode() });
    
    TreeNode ta = Visualizer.findVisualizer(a);
    TreeNode tm = Visualizer.findVisualizer(m);
    
    assertEquals("Index is 1", 1, ta.getIndex(tm));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:VisualizerNodeTest.java

示例11: testLeafNodeReallyNotDisplayed

import org.openide.nodes.Children; //導入方法依賴的package包/類
public void testLeafNodeReallyNotDisplayed() throws Throwable {
    final AbstractNode root = new AbstractNode(new Children.Array());
    root.setName("test root");
    
    
    
    root.getChildren().add(new Node[] {
        createLeaf("kuk"),
        createLeaf("huk"),
    });
    
    class AWTTst implements Runnable {
        public void run() {
            Panel p = new Panel();
            p.getExplorerManager().setRootContext(root);

            ContextTreeView ctv = new ContextTreeView();
            p.add(BorderLayout.CENTER, ctv);

            JFrame f = new JFrame();
            f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
            f.getContentPane().add(BorderLayout.CENTER, p);
            f.setVisible(true);

            final JTree tree = ctv.tree;
    
            // wait a while till the frame is realized and ctv.addNotify called
            Object r = tree.getModel().getRoot();
            assertEquals("There is root", Visualizer.findVisualizer(root), r);
            
            int cnt = tree.getModel().getChildCount(r);
            if (cnt != 0) {
                fail("Should be zero " + cnt + " but there was:  " +
                        tree.getModel().getChild(r, 0) + " and " +
                        tree.getModel().getChild(r, 1)
                        );
            }
            assertEquals("No children as they are leaves", 0, cnt);

            Node n = Visualizer.findNode(r);
            n.setName("Try Rename!");
        }
    }
    AWTTst awt = new AWTTst();
    try {
        SwingUtilities.invokeAndWait(awt);
    } catch (InvocationTargetException ex) {
        throw ex.getTargetException();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:51,代碼來源:ContextTreeViewTest.java

示例12: setUp

import org.openide.nodes.Children; //導入方法依賴的package包/類
@Override
public void setUp () {
    TestNode[] childrenNodes = new TestNode[3];
    for (int i = 0; i < childrenNodes.length; i ++) {
        TestNode[] leafNodes = new TestNode[100];
        for (int j = 0; j < leafNodes.length; j ++) {
            leafNodes[j] = new TestNode ("[" + (100 * i + j) + "]");
        }
        Children.Array leafs = new Children.Array ();
        leafs.add (leafNodes);
        //childrenNodes [i] = new TestNode (leafs, "[" + (i * 100) + "-" + ((i + 1) *100 - 1) + "]");
        switch (i) {
            case 0:
                childrenNodes[i] = new TestNode (leafs, "[1-index from 0 to 99]");
                break;
            case 1:
                childrenNodes[i] = new TestNode (leafs, "[10-index from 100 to 199]");
                break;
            case 2:
                childrenNodes[i] = new TestNode (leafs, "[2-index from 200 to 299]");
                break;
            default:
                fail ("Unexcepted value " + i);
        }
    }

    Children.Array children = new Children.Array ();
    children.add (childrenNodes);

    rootNode = new TestNode (children, "[0 - 1000]");

    component = new OutlineViewComponent (rootNode);
    view = component.getOutlineView ();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:35,代碼來源:OutlineViewOrderingTest.java

示例13: testEnable

import org.openide.nodes.Children; //導入方法依賴的package包/類
public void testEnable() {
    OpenLocalExplorerAction action = new OpenLocalExplorerAction();
    Node leaf = new AbstractNode(Children.LEAF);
    Node parent = new AbstractNode(new Children.Array());
    assertFalse(action.enable(null));
    assertFalse(action.enable(new Node[0]));
    assertTrue(action.enable(new Node[] {parent}));
    assertFalse(action.enable(new Node[] {leaf}));
    assertFalse(action.enable(new Node[] {parent, parent}));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:OpenLocalExplorerActionTest.java

示例14: testStructureFullOfFormFiles

import org.openide.nodes.Children; //導入方法依賴的package包/類
public void testStructureFullOfFormFiles() throws Exception {
    if ((
        Utilities.getOperatingSystem() & 
        (Utilities.OS_SOLARIS | Utilities.OS_SUNOS)
    ) != 0) {
        LOG.log(Level.CONFIG, "Giving up, this test fails too randomly on Solaris");
        return;
    }
    
    Children ch = new Children.Array();
    Node root = new AbstractNode(ch);
    root.setName(getName());

    ch.add(nodeWith("A", "-A", "-B", "B"));
    ch.add(nodeWith("X", "Y", "Z"));

    final Node first = ch.getNodes()[0];

    LOG.log(Level.INFO, "Nodes are ready: {0}", root);
    final ExplorerManager em = testWindow.getExplorerManager();
    em.setRootContext(root);
    LOG.info("setRootContext done");
    em.setSelectedNodes(new Node[] { first });
    LOG.log(Level.INFO, "setSelectedNodes to {0}", first);
    LOG.log(Level.INFO, "Verify setSelectedNodes: {0}", Arrays.asList(em.getSelectedNodes()));

    EventQueue.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            TreePath path = treeView.tree.getSelectionPath();
            LOG.log(Level.INFO, "getSelectionPath {0}", path);
            LOG.log(Level.INFO, "getSelectedNodes {0}", Arrays.toString(em.getSelectedNodes()));
            assertNotNull("Something is selected", path);
            Node node = Visualizer.findNode(path.getLastPathComponent());
            assertEquals("It is the first node", first, node);
        }
    });
    
    sendAction("expand");
    sendAction("selectNext");

    assertEquals("Explored context is N0", first, em.getExploredContext());
    assertEquals("Selected node is A", 1, em.getSelectedNodes().length);
    assertEquals("Selected node is A", "A", em.getSelectedNodes()[0].getName());

    sendAction(enter);

    Keys keys = (Keys)first.getChildren();
    assertEquals("One invocation", 1, keys.actionPerformed);
    assertFalse("No write access", keys.writeAccess);
    assertFalse("No read access", keys.readAccess);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:53,代碼來源:NavigationTreeViewTest.java

示例15: createNode

import org.openide.nodes.Children; //導入方法依賴的package包/類
private static Node createNode(String name, boolean leaf) {
    AbstractNode n = new AbstractNode(leaf ? Children.LEAF : new Children.Array());
    n.setName(name);
    return n;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:ContextTreeViewModelTest.java


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