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

The following examples show how to use org.openide.nodes.AbstractNode#setDisplayName() . 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: ShowExecutionPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private Node createNodeForExecutionEventTree(ExecutionEventObject.Tree item) {
    ExecutionEventObject se = item.getStartEvent();
    if (se != null) {
        //TODO
        AbstractNode nd = new AbstractNode(createChildren(item.getChildrenNodes()), Lookups.fixed(item));
        switch (se.type) {
            case ProjectStarted :
                return new ProjectNode(showPhases ? createPhasedChildren(item.getChildrenNodes()) : createChildren(item.getChildrenNodes()), Lookups.fixed(item));
            case MojoStarted :
                return new MojoNode(createChildren(item.getChildrenNodes()), Lookups.fixed(item, config));
            case ForkStarted :
            case ForkedProjectStarted :
            default :
                nd.setDisplayName(se.type.name());
                nd.setName(se.type.name());
                break;
        }
        
        return nd;
    }
    return new AbstractNode(createChildren(item.getChildrenNodes()), Lookups.fixed(item));
}
 
Example 2
Source File: TreeViewTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
TestTreeView() {
    super();
    tree.setAutoscrolls(true);

    setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    vertScrollBar = getVerticalScrollBar();
    
    rootNode = new AbstractNode(new TreeChildren());
    rootNode.setDisplayName("Root node");
    
    tree.setRowHeight(20);
    
    Dimension prefSize = new Dimension(200, 6 * tree.getRowHeight() + 8);
    prefSize.width = (int) (prefSize.width * 1.25f)
                     + vertScrollBar.getWidth();
    setPreferredSize(prefSize);
}
 
Example 3
Source File: ClassPathFileChooser.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 4
Source File: EntityChildFactory.java    From jeddict with Apache License 2.0 5 votes vote down vote up
@Override
    protected Node createNodeForKey(EntityWidget entityWidget) {
        AbstractNode node = new AttributeRootNode(Children.create(new AttributeChildFactory(entityWidget), true)) {

            @Override
            public Action[] getActions(boolean context) {
                Action[] result = new Action[]{
                    SystemAction.get(DeleteAction.class),
                    SystemAction.get(PropertiesAction.class)
                };
                return result;
            }

            @Override
            public boolean canDestroy() {
                EntityWidget customer = this.getLookup().lookup(EntityWidget.class);
                return customer != null;
            }

            @Override
            public void destroy() throws IOException {
//                if (deleteEntity(this.getLookup().lookup(Entity.class).getEntityId())) {
//                    super.destroy();
//                    EntityTopComponent.refreshNode();
//                }
            }

        };
        node.setDisplayName(entityWidget.getNodeName());
        node.setShortDescription(entityWidget.getNodeName());
        node.setIconBaseWithExtension(entityWidget.getIconPath());
        return node;
    }
 
Example 5
Source File: SuiteCustomizerLibraries.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void initNodes() {
    if (libChildren == null) {
        libChildren = new LibrariesChildren();
        realRoot = new AbstractNode(libChildren);
        realRoot.setName(getMessage("LBL_ModuleListClusters"));
        realRoot.setDisplayName(getMessage("LBL_ModuleListClustersModules"));
    }
}
 
Example 6
Source File: LazyProject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Collection<Node> initCollection() {
    AbstractNode n = new AbstractNode(Children.LEAF);
    n.setName("init"); // NOI18N
    n.setDisplayName(NbBundle.getMessage(ProjCh.class, "MSG_ProjChInit")); 
    n.setIconBaseWithExtension("org/netbeans/modules/project/ui/resources/wait.gif");
    return Collections.singletonList((Node)n);
}
 
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: GoalsPanel.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
@Messages("LBL_Wait=Please Wait...")
private static Node createWaitNode() {
    AbstractNode an = new AbstractNode(Children.LEAF);
    an.setIconBaseWithExtension(WAIT_GIF);
    an.setDisplayName(Bundle.LBL_Wait());
    return an;
}
 
Example 9
Source File: SectionNodeView.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * 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());
}
 
Example 10
Source File: OverrideAllChildFactory.java    From jeddict with Apache License 2.0 5 votes vote down vote up
@Override
protected Node createNodeForKey(final AttributeWidget attributeWidget) {
    Attribute attribute = (Attribute) attributeWidget.getBaseElementSpec();
    AbstractNode node;
    if (attributeWidget instanceof EmbeddedAttributeWidget) {
        EmbeddedAttributeWidget embeddedAttributeWidget = (EmbeddedAttributeWidget) attributeWidget;
        node = new OverrideEmbeddedRootNode(Children.create(new OverrideEmbeddedAllChildFactory(entityWidget, "", embeddedAttributeWidget, embeddedAttributeWidget.getEmbeddableFlowWidget().getTargetEmbeddableWidget()), true));
    } else {
        node = new PropertyNode<JPAModelerScene>(entityWidget.getModelerScene(), Children.LEAF) {
            @Override
            public void createPropertySet(ElementPropertySet set) {

                if (attributeWidget instanceof RelationAttributeWidget && entityWidget.getBaseElementSpec() instanceof AssociationOverrideHandler) {
                    Attribute attributeSpec = (Attribute) attributeWidget.getBaseElementSpec();
                    AssociationOverrideHandler associationOverrideHandler = (AssociationOverrideHandler) entityWidget.getBaseElementSpec();
                    AssociationOverride associationOverride = associationOverrideHandler.getAssociationOverride(attributeSpec.getName());
                    if (attributeSpec instanceof JoinColumnHandler) {
                        set.put("JOIN_COLUMN_PROP", PropertiesHandler.getJoinColumnsProperty("JoinColumns", "Join Columns", "", this.getModelerScene(), associationOverride.getJoinColumn()));
                    }

                    set.createPropertySet(attributeWidget, associationOverride.getJoinTable());
                    set.put("JOIN_TABLE_PROP", PropertiesHandler.getJoinColumnsProperty("JoinTable_JoinColumns", "Join Columns", "", this.getModelerScene(), associationOverride.getJoinTable().getJoinColumn()));
                    set.put("JOIN_TABLE_PROP", PropertiesHandler.getJoinColumnsProperty("JoinTable_InverseJoinColumns", "Inverse Join Columns", "", this.getModelerScene(), associationOverride.getJoinTable().getInverseJoinColumn()));

                } else if (entityWidget.getBaseElementSpec() instanceof AttributeOverrideHandler) {
                    Attribute attributeSpec = (Attribute) attributeWidget.getBaseElementSpec();
                    AttributeOverrideHandler attributeOverrideHandler = (AttributeOverrideHandler) entityWidget.getBaseElementSpec();
                    AttributeOverride attributeOverride = attributeOverrideHandler.getAttributeOverride(attributeSpec.getName());
                    set.createPropertySet(attributeWidget, attributeOverride.getColumn(), attributeWidget.getPropertyChangeListeners(), attributeWidget.getPropertyVisibilityHandlers());
                }
            }

        };
    }
    node.setDisplayName(attribute.getName());
    node.setShortDescription(attribute.getName());
    node.setIconBaseWithExtension(attributeWidget.getIconPath());
    return node;
}
 
Example 11
Source File: OverrideAttributeChildFactory.java    From jeddict with Apache License 2.0 5 votes vote down vote up
@Override
protected Node createNodeForKey(final AttributeWidget attributeWidget) {
    Attribute attribute = (Attribute) attributeWidget.getBaseElementSpec();
    AbstractNode node;
    if (attributeWidget instanceof EmbeddedAttributeWidget) {
        EmbeddedAttributeWidget embeddedAttributeWidget = (EmbeddedAttributeWidget) attributeWidget;
        node = new OverrideEmbeddedRootNode(Children.create(new OverrideEmbeddedAttributeChildFactory(entityWidget, "", embeddedAttributeWidget, embeddedAttributeWidget.getEmbeddableFlowWidget().getTargetEmbeddableWidget()), true));
    } else {
        node = new PropertyNode(entityWidget.getModelerScene(), Children.LEAF) {

            @Override
            public void createPropertySet(ElementPropertySet set) {

                if (entityWidget.getBaseElementSpec() instanceof AttributeOverrideHandler) {
                    Attribute attributeSpec = (Attribute) attributeWidget.getBaseElementSpec();
                    AttributeOverrideHandler attributeOverrideHandler = (AttributeOverrideHandler) entityWidget.getBaseElementSpec();
                    AttributeOverride attributeOverride = attributeOverrideHandler.getAttributeOverride(attributeSpec.getName());
                    set.createPropertySet(attributeWidget, attributeOverride.getColumn(), attributeWidget.getPropertyChangeListeners(), attributeWidget.getPropertyVisibilityHandlers());
                }
            }

        };
    }
    node.setDisplayName(attribute.getName());
    node.setShortDescription(attribute.getName());
    node.setIconBaseWithExtension(attributeWidget.getIconPath());
    return node;
}
 
Example 12
Source File: Nodes.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages("LBL_Wait=Please Wait...")
public static Node createWaitNode() {
    AbstractNode an = new AbstractNode(Children.LEAF);
    an.setIconBaseWithExtension(WAIT_GIF);
    an.setDisplayName(Bundle.LBL_Wait());
    return an;
}
 
Example 13
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 14
Source File: OverrideAssociationChildFactory.java    From jeddict with Apache License 2.0 5 votes vote down vote up
@Override
protected Node createNodeForKey(final AttributeWidget attributeWidget) {
    Attribute attribute = (Attribute) attributeWidget.getBaseElementSpec();
    AbstractNode node;
    if (attributeWidget instanceof EmbeddedAttributeWidget) {
        EmbeddedAttributeWidget embeddedAttributeWidget = (EmbeddedAttributeWidget) attributeWidget;
        node = new OverrideEmbeddedRootNode(Children.create(new OverrideEmbeddedAssociationChildFactory(entityWidget, "", embeddedAttributeWidget, embeddedAttributeWidget.getEmbeddableFlowWidget().getTargetEmbeddableWidget()), true));
    } else {
        node = new PropertyNode<JPAModelerScene>(entityWidget.getModelerScene(), Children.LEAF) {

            @Override
            public void createPropertySet(ElementPropertySet set) {

                if (entityWidget.getBaseElementSpec() instanceof AssociationOverrideHandler) {
                    Attribute attributeSpec = (Attribute) attributeWidget.getBaseElementSpec();
                    AssociationOverrideHandler associationOverrideHandler = (AssociationOverrideHandler) entityWidget.getBaseElementSpec();
                    AssociationOverride associationOverride = associationOverrideHandler.getAssociationOverride(attributeSpec.getName());
                    if (attributeSpec instanceof JoinColumnHandler) {
                        set.put("JOIN_COLUMN_PROP", PropertiesHandler.getJoinColumnsProperty("JoinColumns", "Join Columns", "", this.getModelerScene(), associationOverride.getJoinColumn()));
                    }

                    set.createPropertySet(attributeWidget, associationOverride.getJoinTable());
                    set.put("JOIN_TABLE_PROP", PropertiesHandler.getJoinColumnsProperty("JoinTable_JoinColumns", "Join Columns", "", this.getModelerScene(), associationOverride.getJoinTable().getJoinColumn()));
                    set.put("JOIN_TABLE_PROP", PropertiesHandler.getJoinColumnsProperty("JoinTable_InverseJoinColumns", "Inverse Join Columns", "", this.getModelerScene(), associationOverride.getJoinTable().getInverseJoinColumn()));

                }
            }

        };
    }
    node.setDisplayName(attribute.getName());
    node.setShortDescription(attribute.getName());
    node.setIconBaseWithExtension(attributeWidget.getIconPath());
    return node;
}
 
Example 15
Source File: MoveToDependencyManagementPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static Node createWaitNode() {
    AbstractNode an = new AbstractNode(Children.LEAF);
    an.setIconBaseWithExtension(WAIT);
    an.setDisplayName(NbBundle.getMessage(MoveToDependencyManagementPanel.class, "LBL_Wait"));
    return an;
}
 
Example 16
Source File: POMModelPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static Node createWaitNode() {
    AbstractNode an = new AbstractNode(Children.LEAF);
    an.setIconBaseWithExtension("org/netbeans/modules/maven/navigator/wait.gif"); //NOI18N
    an.setDisplayName(NbBundle.getMessage(POMInheritancePanel.class, "LBL_Wait"));
    return an;
}
 
Example 17
Source File: POMInheritancePanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static Node createWaitNode() {
    AbstractNode an = new AbstractNode(Children.LEAF);
    an.setIconBaseWithExtension("org/netbeans/modules/maven/navigator/wait.gif");
    an.setDisplayName(NbBundle.getMessage(POMInheritancePanel.class, "LBL_Wait"));
    return an;
}
 
Example 18
Source File: NodeFactorySupport.java    From netbeans with Apache License 2.0 4 votes vote down vote up
static Node createWaitNode() {
    AbstractNode n = new AbstractNode(Children.LEAF);
    n.setIconBaseWithExtension("org/openide/nodes/wait.gif"); //NOI18N
    n.setDisplayName(NbBundle.getMessage(ChildFactory.class, "LBL_WAIT")); //NOI18N
    return n;
}
 
Example 19
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 20
Source File: OverrideEmbeddedAssociationChildFactory.java    From jeddict with Apache License 2.0 4 votes vote down vote up
@Override
protected Node createNodeForKey(final AttributeWidget attributeWidget) {
    Attribute attribute = (Attribute) attributeWidget.getBaseElementSpec();
    AbstractNode node = null;
    if (attributeWidget instanceof EmbeddedAttributeWidget) {
        EmbeddedAttributeWidget embeddedAttributeWidget = (EmbeddedAttributeWidget) attributeWidget;
        Attribute attributeSpec = (Attribute) embeddedAttributeWidget.getBaseElementSpec(); //May be Embedded or ElementCollection ( for multi Embedded )
        String prefixAttributePath_Tmp;
        if (prefixAttributePath == null || prefixAttributePath.trim().isEmpty()) {
            prefixAttributePath_Tmp = attributeSpec.getName();
        } else {
            prefixAttributePath_Tmp = prefixAttributePath + "." + attributeSpec.getName();
        }
        node = new OverrideEmbeddedRootNode(Children.create(new OverrideEmbeddedAssociationChildFactory(entityWidget, prefixAttributePath_Tmp, initialAttributeWidget, embeddedAttributeWidget.getEmbeddableFlowWidget().getTargetEmbeddableWidget()), true));
    } else {
        node = new PropertyNode<JPAModelerScene>(entityWidget.getModelerScene(), Children.LEAF) {

            @Override
            public void createPropertySet(ElementPropertySet set) {
                if (initialAttributeWidget.getBaseElementSpec() instanceof AssociationOverrideHandler) {
                    Attribute attributeSpec = (Attribute) attributeWidget.getBaseElementSpec();
                    AssociationOverrideHandler associationOverrideHandler = (AssociationOverrideHandler) initialAttributeWidget.getBaseElementSpec();
                    AssociationOverride associationOverride = null;
                    if (prefixAttributePath == null || prefixAttributePath.trim().isEmpty()) {
                        associationOverride = associationOverrideHandler.getAssociationOverride(attributeSpec.getName());
                    } else {
                        associationOverride = associationOverrideHandler.getAssociationOverride(prefixAttributePath + "." + attributeSpec.getName());
                    }

                    if (attributeSpec instanceof JoinColumnHandler) {
                        set.put("JOIN_COLUMN_PROP", PropertiesHandler.getJoinColumnsProperty("JoinColumns", "Join Columns", "", this.getModelerScene(), associationOverride.getJoinColumn()));
                    }

                    set.createPropertySet(attributeWidget, associationOverride.getJoinTable());
                    set.put("JOIN_TABLE_PROP", PropertiesHandler.getJoinColumnsProperty("JoinTable_JoinColumns", "Join Columns", "", this.getModelerScene(), associationOverride.getJoinTable().getJoinColumn()));
                    set.put("JOIN_TABLE_PROP", PropertiesHandler.getJoinColumnsProperty("JoinTable_InverseJoinColumns", "Inverse Join Columns", "", this.getModelerScene(), associationOverride.getJoinTable().getInverseJoinColumn()));
                }
            }

        };
    }
    node.setDisplayName(attribute.getName());
    node.setShortDescription(attribute.getName());
    node.setIconBaseWithExtension(attributeWidget.getIconPath());
    return node;
}