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


Java Children.add方法代碼示例

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


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

示例1: 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

示例2: 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

示例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: prepareChildren

import org.openide.nodes.Children; //導入方法依賴的package包/類
static Children prepareChildren(int nodesCount, int subnodesCount) {
    Children ch = new Children.Array();
    Node[] nodes = new Node[nodesCount];
    for (int i = 0; i < nodes.length; i++) {
        nodes[i] = createNodes(subnodesCount);
    }
    ch.add(nodes);
    return ch;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:TreeTableView126560Test.java

示例5: createNodes

import org.openide.nodes.Children; //導入方法依賴的package包/類
static Node createNodes(int subNodesCount) {
    if (subNodesCount == 0) {
        return new TestNode(Children.LEAF);
    }
    Node[] subnodes = new TestNode[subNodesCount];
    for (int i = 0; i < subnodes.length; i++) {
        subnodes[i] = new TestNode(Children.LEAF);
    }
    Children ch = new Children.Array();
    ch.add(subnodes);
    return new TestNode(ch);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:TreeTableView126560Test.java

示例6: 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

示例7: loadingVCSFinished

import org.openide.nodes.Children; //導入方法依賴的package包/類
synchronized void loadingVCSFinished(Date dateFrom) {
    Children children = getChildren();
    removeWaitNode();         
    if(loadNextNode != null) {
        children.remove(new Node[] { loadNextNode });
    }
    if(dateFrom != null && !HistorySettings.getInstance().getLoadAll()) {
        loadNextNode = new LoadNextNode(dateFrom);
        children.add(new Node[] {loadNextNode});
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:HistoryRootNode.java

示例8: createNodeStructure

import org.openide.nodes.Children; //導入方法依賴的package包/類
private NodeStructure createNodeStructure (NodeHolderProperty[] props) {
    NodeStructure createdData = new NodeStructure();
    createdData.childrenNodes = new Node[100];
    Children rootChildren = new Children.Array();
    createdData.rootNode = new AbstractNode(rootChildren);
    createdData.rootNode.setDisplayName("Root test node");
    for (int i = 0; i < 100; i++) {
        Node newNode = new TestNode("node #" + i);
        createdData.childrenNodes[i] = newNode;
    }
    rootChildren.add(createdData.childrenNodes);
    return createdData;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:TTVTest.java

示例9: 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

示例10: createChildren

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

示例11: 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

示例12: createPaletteRoot

import org.openide.nodes.Children; //導入方法依賴的package包/類
public static Node createPaletteRoot() {
    Children categories = new Children.Array();
    categories.add( createCategories() );
    return new RootNode( categories );
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:DummyPalette.java

示例13: taskFinished

import org.openide.nodes.Children; //導入方法依賴的package包/類
@Override
@NbBundle.Messages({
    "LBL_NoModesFound=No layout definition found",
    "MSG_NoModesFound=Is everything OK? Did your application compile and run?"
})
public void taskFinished(Task task) {
    handle.finish();
    FileObject modeDir = userDir.get().getFileObject("config/Windows2Local/Modes");
    boolean one = false;
    final Children ch = getExplorerManager().getRootContext().getChildren();
    if (modeDir != null) {
        try {
            FileSystem layer = DesignSupport.findLayer(data.getProject());
            if (layer == null) {
                throw new IOException("Cannot find layer in " + data.getProject()); // NOI18N
            }
            data.setSFS(layer);
            for (FileObject m : modeDir.getChildren()) {
                if (m.isData() && "wsmode".equals(m.getExt())) {
                    ModeNode mn = new ModeNode(m, data);
                    ch.add(new Node[] { mn });
                    one = true;
                }
            }
        } catch (IOException ex) {
            Exceptions.printStackTrace(ex);
        }
    }
    if (!one) {
        AbstractNode empty = new AbstractNode(Children.LEAF);
        empty.setName("empty"); // NOI18N
        empty.setDisplayName(Bundle.LBL_NoModesFound());
        empty.setShortDescription(Bundle.MSG_NoModesFound());
        ch.add(new Node[] { empty });
        markInvalid();
    } else {
        markValid();
    }
    
    EventQueue.invokeLater(this);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:42,代碼來源:LayoutLaunchingPanel.java

示例14: testDestroySelectedNodes

import org.openide.nodes.Children; //導入方法依賴的package包/類
/**
 * Removes selected node by calling destroy
 */
public void testDestroySelectedNodes() {
    final Children c = new Array();
    Node n = new AbstractNode (c);
    final PListView lv = new PListView();
    final ExplorerPanel p = new ExplorerPanel();
    p.add(lv, BorderLayout.CENTER);
    p.getExplorerManager().setRootContext(n);
    p.open();
    Node[] children = new Node[NO_OF_NODES];

    for (int i = 0; i < NO_OF_NODES; i++) {
        children[i] = new AbstractNode(Children.LEAF);
        children[i].setDisplayName(Integer.toString(i));
        children[i].setName(Integer.toString(i));
        c.add(new Node[] { children[i] } );
    }
    //Thread.sleep(2000);
    
    for (int i = NO_OF_NODES-1; i >= 0; i--) {     
        // Waiting for until the view is updated.
        // This should not be necessary
        try {
            SwingUtilities.invokeAndWait( new EmptyRunnable() );
        } catch (InterruptedException ie) {
            fail ("Caught InterruptedException:" + ie.getMessage ());
        } catch (InvocationTargetException ite) {
            fail ("Caught InvocationTargetException: " + ite.getMessage ());
        }
        try {
            p.getExplorerManager().setSelectedNodes(new Node[] {children[i]} );
        } catch (PropertyVetoException  pve) {
            fail ("Caught the PropertyVetoException when set selected node " + children[i].getName ()+ ".");
        }
        //Thread.sleep(500);
        try {
            children[i].destroy();
        } catch (IOException ioe) {
            fail ("Caught the IOException when destroy the node " + children[i].getName ()+ ".");
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:45,代碼來源:ListViewTest.java

示例15: testNodeAddingAndRemoving

import org.openide.nodes.Children; //導入方法依賴的package包/類
/**
 * Creates two nodes. Selects one and tries to remove it
 * and replace with the other one (several times).
 */
public void testNodeAddingAndRemoving() {
    final Children c = new Array();
    Node n = new AbstractNode (c);
    final PListView lv = new PListView();
    final ExplorerPanel p = new ExplorerPanel();
    p.add(lv, BorderLayout.CENTER);
    p.getExplorerManager().setRootContext(n);
    p.open();

    final Node c1 = new AbstractNode(Children.LEAF);
    c1.setDisplayName("First");
    c1.setName("First");
    c.add(new Node[] { c1 });
    Node c2 = new AbstractNode(Children.LEAF);
    c2.setDisplayName("Second");
    c2.setName("Second");
    //Thread.sleep(500);

    for (int i = 0; i < 5; i++) {
        c.remove(new Node[] { c1 });
        c.add(new Node[] { c2 });
        
        // Waiting for until the view is updated.
        // This should not be necessary
        try {
            SwingUtilities.invokeAndWait( new EmptyRunnable() );
        } catch (InterruptedException ie) {
            fail ("Caught InterruptedException:" + ie.getMessage ());
        } catch (InvocationTargetException ite) {
            fail ("Caught InvocationTargetException: " + ite.getMessage ());
        }
        
        try {
            p.getExplorerManager().setSelectedNodes(new Node[] {c2} );
        } catch (PropertyVetoException  pve) {
            fail ("Caught the PropertyVetoException when set selected node " + c2.getName ()+ ".");
        }
        
        c.remove(new Node[] { c2 });
        c.add(new Node[] { c1 });
        
        //Thread.sleep(350);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:49,代碼來源:ListViewTest.java


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