Java Code Examples for org.openide.nodes.AbstractNode#setName()

The following examples show how to use org.openide.nodes.AbstractNode#setName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MoveUpActionTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected @Override void setUp() throws Exception {
    n1 = new AbstractNode(Children.LEAF);
    n1.setName("n1");
    n2 = new AbstractNode(Children.LEAF);
    n2.setName("n2");
    n3 = new AbstractNode(Children.LEAF);
    n3.setName("n3");
    final Index.ArrayChildren c = new Index.ArrayChildren() {
        {
            add(new Node[] {n1, n2, n3});
        }
        public @Override void reorder() {
            reorder(new int[] {1, 2, 0});
        }
    };
    n = new AbstractNode(c) {
        {
            getCookieSet().add(c);
        }
    };
    n.setName("n");
}
 
Example 2
Source File: Util.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static Node createInfoNode() {
    AbstractNode n = new AbstractNode(Children.LEAF);
    n.setName(NbBundle.getMessage(WildflyItemNode.class, "LBL_InfoNode_DisplayName")); //NOI18N
    n.setShortDescription(NbBundle.getMessage(WildflyItemNode.class, "LBL_InfoNode_ToolTip")); //NOI18N
    n.setIconBaseWithExtension("org/netbeans/core/resources/exception.gif"); // NOI18N
    return n;
}
 
Example 3
Source File: VisualizerNodeTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Node[] createNodes(String key) {
    if (key.startsWith("-")) {
        return null;
    }

    AbstractNode node = new AbstractNode(LEAF);
    node.setName(key);
    cnt++;
    return new Node[] {node};
}
 
Example 4
Source File: AreVisualizersSynchronizedTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Node[] createNodes(String key) {
    if (key.contains("Empty")) {
        return null;
    } else {
        AbstractNode n = new AbstractNode(Children.LEAF);
        n.setName(key);
        return new Node[]{n};
    }
}
 
Example 5
Source File: AnotherSetKeysBeforeEventsProcessedTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Node[] createNodes(String key) {
    if (key.contains("Empty")) {
        return null;
    } else {
        AbstractNode n = new AbstractNode(Children.LEAF);
        n.setName(key);
        return new Node[]{n};
    }
}
 
Example 6
Source File: WSDesignViewNavigatorContent.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void navigate(DataObject implClass){
    add(treeView, BorderLayout.CENTER);
    AbstractNode root = new AbstractNode(Children.create(new WSChildFactory(implClass), true));
    root.setName(NbBundle.getMessage(WSDesignViewNavigatorContent.class, "LBL_Operations"));
    getExplorerManager().setRootContext(root);
    revalidate();
    repaint();
}
 
Example 7
Source File: NodeActionTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void setUp() throws Exception {
    n1 = new AbstractNode(Children.LEAF);
    n1.setName("n1");
    n1.setDisplayName("text");
    n2 = new AbstractNode(Children.LEAF);
    n2.setName("n2");
    n2.setDisplayName("text");
    n3 = new AbstractNode(Children.LEAF);
    n3.setName("n3");
    n3.setDisplayName("somethingelse");
}
 
Example 8
Source File: NodeTreeModelTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Create nodes for a given key.
 * @param key the key
 * @return child nodes for this key or null if there should be no
 *   nodes for this key
 */
protected Node[] createNodes(Object key) {
    AbstractNode an = new AbstractNode (Children.LEAF);
    an.setName (key.toString ());

    cnt++;
    return new Node[] { an };
}
 
Example 9
Source File: UINode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Node[] createNodes(Object key) {
    AbstractNode an = new AbstractNode(Children.LEAF);
    an.setName((String)key);
    an.setIconBaseWithExtension("org/netbeans/lib/uihandler/module.gif"); // NOI18N
    return new Node[] { an };
}
 
Example 10
Source File: ShowExecutionPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Node createPhaseNode(Pair<String, List<ExecutionEventObject.Tree>> key) {
    Children childs;
    if (showOnlyErrors) {
        boolean atLeastOne = false;
        for (ExecutionEventObject.Tree ch : key.second()) {
            ExecutionEventObject end = ch.getEndEvent();
            if (end != null) {
                if (ExecutionEvent.Type.ProjectFailed.equals(end.type)
                        || ExecutionEvent.Type.MojoFailed.equals(end.type)
                        || ExecutionEvent.Type.ForkedProjectFailed.equals(end.type)
                        || ExecutionEvent.Type.ForkFailed.equals(end.type)) {
                    atLeastOne = true;
                    break;
                }
            }
        }
        if (atLeastOne) {
            childs = createChildren(key.second());
        } else {
            childs = Children.LEAF;
        }
    } else {
        childs = createChildren(key.second());
    }
    AbstractNode nd = new AbstractNode(childs, Lookup.EMPTY);
    nd.setName(key.first());
    nd.setDisplayName(key.first());
    nd.setIconBaseWithExtension(ICON_PHASE);
    return nd;
}
 
Example 11
Source File: ContextTreeViewTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
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();
    }
}
 
Example 12
Source File: RegistryNodeFactoryImpl.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Node getManagerNode(Lookup lookup) {
    AbstractNode an = new AbstractNode(Children.LEAF);
    an.setName("manager node");
    return an;
}
 
Example 13
Source File: ObjectListRendererTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Node createNodeDelegate() {
    AbstractNode n = new AbstractNode(Children.LEAF);
    n.setName("Ahoj");
    return n;
}
 
Example 14
Source File: ContextTreeViewModelTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static Node createNode(String name, boolean leaf) {
    AbstractNode n = new AbstractNode(leaf ? Children.LEAF : new Children.Array());
    n.setName(name);
    return n;
}
 
Example 15
Source File: RootContextTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void initTest () {
    
    // do init only once
    if (initialized) {
        return ;
    } else {
        initialized = true;
    }

    arr1 = new Node [3];
    arr1[0] = new AbstractNode (Children.LEAF);
    arr1[0].setName ("One");
    
    arr1[1] = new AbstractNode (Children.LEAF);
    arr1[1].setName ("Two");
    
    arr1[2] = new AbstractNode (Children.LEAF);
    arr1[2].setName ("Three");
    
    Array ch1 = new Array ();
    ch1.add (arr1);
    
    arr2 = new Node [3];
    arr2[0] = new AbstractNode (Children.LEAF);
    arr2[0].setName ("Aaa");
    
    arr2[1] = new AbstractNode (Children.LEAF);
    arr2[1].setName ("Bbb");
    
    arr2[2] = new AbstractNode (Children.LEAF);
    arr2[2].setName ("Ccc");

    Array ch2 = new Array ();
    ch2.add (arr2);
    
    root1 = new AbstractNode (ch1);
    root1.setName ("Root1");
    root2 = new AbstractNode (ch2);
    root2.setName ("Root2");
    
}
 
Example 16
Source File: SaasNodeChildren.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected static Node[] getWaitNode() {
    AbstractNode wait = new AbstractNode(Children.LEAF);
    wait.setName(NbBundle.getMessage(WsdlSaasNodeChildren.class, "NODE_LOAD_MSG")); // NOI18N
    wait.setIconBaseWithExtension("org/netbeans/modules/websvc/saas/ui/resources/wait.gif"); // NOI18N
    return new Node[] { wait };
}
 
Example 17
Source File: OutlineView152857Test.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Node[] createNodes (String key) {
    AbstractNode n = new TestNode (Children.LEAF, key);
    n.setName (key);
    return new Node[]{n};
}
 
Example 18
Source File: LayoutLaunchingPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@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);
}
 
Example 19
Source File: TreeTableView152857Test.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Node[] createNodes (String key) {
    AbstractNode n = new TestNode (Children.LEAF, key);
    n.setName (key);
    return new Node[]{n};
}
 
Example 20
Source File: Hk2ItemNode.java    From netbeans with Apache License 2.0 3 votes vote down vote up
/**
 * Creates and returns the instance of the node representing the status
 * 'WAIT' of the node.
 * <p/>
 * It is used when it spent more time to create elements hierarchy.
 * <p/>
 * @return The wait node.
 */
public static Node createWaitNode() {
    AbstractNode node = new AbstractNode(Children.LEAF);
    node.setName(NbBundle.getMessage(Hk2ItemNode.class,
            "LBL_WaitNode_DisplayName"));
    node.setIconBaseWithExtension("org/openide/src/resources/wait.gif");
    return node;
}