Java Code Examples for org.openide.nodes.Children#create()

The following examples show how to use org.openide.nodes.Children#create() . 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: RankedSolutionsTreeRoot.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
public RankedSolutionsTreeRoot(McChaseResult chaseResult) {
    super(Children.create(new RankedSolutionsTreeFactory(chaseResult.getResult(), chaseResult.getLoadedScenario().getScenario()), true));
    this.result = chaseResult;
    if (chaseResult.getResult().getRankedSolutions() == null) {
        setDisplayName("Enable 'remove duplicates' in order to rank solutions");
    } else {
        setDisplayName("Solutions ordered by score (" + result.getLoadedScenario().getDataObject().getName() + ")");
        setIconBaseWithExtension("it/unibas/lunatic/icons/rank.png");
    }
}
 
Example 2
Source File: InternalNode.java    From jeddict with Apache License 2.0 5 votes vote down vote up
public InternalNode(T baseElementSpec, TreeChildFactory childFactory, CheckableAttributeNode checkableNode) {
    super(Children.create(childFactory, true), checkableNode==null?null:Lookups.singleton(checkableNode));
    this.checkableNode = checkableNode;
    this.classMembers = baseElementSpec;
    if (checkableNode != null) {
        checkableNode.setNode(this);
    }
    childFactory.setParentNode(this);
}
 
Example 3
Source File: AbstractItemNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
AbstractItemNode(final ChildFactory<?> childFactory, String name)
{
    super(Children.create(childFactory, true));
    this.childFactory = childFactory;
    setDisplayName(name);
    if(childFactory instanceof RefreshModulesCookie) {
        getCookieSet().add((RefreshModulesCookie)childFactory);
    }
}
 
Example 4
Source File: BuildScriptsNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages("LBL_Build_Scripts=Build Scripts")
public BuildScriptsNode(NbGradleProjectImpl prj) {
    super(Children.create(new ProjectFilesChildren(prj), true),
            Lookups.fixed(prj.getProjectDirectory()));
    setName("buildscripts"); //NOI18N
    setDisplayName(Bundle.LBL_Build_Scripts());
}
 
Example 5
Source File: AddDependencyUI.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public AddDependencyUI(String libDef) {
    initComponents();
    lblDescription.setText(NbBundle.getMessage(AddDependencyUI.class, "LBL_Description", libDef));//NOI18N
    addButton = new JButton(NbBundle.getMessage(AddDependencyUI.class, "BTN_Add"));//NOI18N
    addButton.setEnabled(false);
    Node openProjectsNode = new AbstractNode(Children.create(new ChildFactory<Project>() {
        protected @Override boolean createKeys(List<Project> toPopulate) {
            for (Project project : OpenProjects.getDefault().getOpenProjects()) {
                if (project.getLookup().lookup(NbMavenProject.class) != null) {
                    toPopulate.add(project);
                }
            }
            return true;
        }
        protected @Override Node createNodeForKey(Project key) {
            return new OpenProjectNode(key);
        }
    }, true));
    explorerManager.setRootContext(openProjectsNode);
    BeanTreeView beanTreeView = (BeanTreeView) jScrollPane1;
    beanTreeView.setPopupAllowed(false);
    beanTreeView.setRootVisible(false);
    explorerManager.addPropertyChangeListener(new PropertyChangeListener() {
        public @Override void propertyChange(PropertyChangeEvent event) {
            if (event.getPropertyName().equals("selectedNodes")) {//NOI18N
                Node[] selectedNodes = explorerManager.getSelectedNodes();
                boolean enable=false;
                for (Node node : selectedNodes) {
                    if (node instanceof OpenProjectNode) {
                      enable=true;
                      break;

                    }
                }
                addButton.setEnabled(enable);
               
            }
        }
    });
}
 
Example 6
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 7
Source File: RandomErrorNode.java    From BART with MIT License 5 votes vote down vote up
public RandomErrorNode(EGTask egt,EGTaskDataObjectDataObject dto)  {
    super(Children.create(new RandomErrorTableFactory(egt,dto), true),
            new ProxyLookup(Lookups.fixed(egt,dto),dto.getAbstractLookup()));
    setName(NodeResource.NODE_RandomErrorNode);
    setShortDescription(Bundle.HINT_RandomErrorNode());
    setIconBaseWithExtension(R.IMAGE_NODE_VIOs_PROB);       
}
 
Example 8
Source File: OverrideRootNode.java    From jeddict with Apache License 2.0 5 votes vote down vote up
public OverrideRootNode(EntityWidget entityWidget, OverrideChildFactory factory) {
    super(Children.create(factory, true));
    Entity entity = entityWidget.getBaseElementSpec();
    setDisplayName(entity.getClazz());
    setShortDescription(entity.getClazz());
    setIconBaseWithExtension(JPAModelerUtil.ENTITY_ICON_PATH);
}
 
Example 9
Source File: AdbNode.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
public AdbNode() {
    super(Children.create(new ADBChildren(), true));
    AndroidSdkProvider sdkProvider = AndroidSdkProvider.getDefault();
    sdkProvider.addPropertyChangeListener(WeakListeners.propertyChange(this, sdkProvider));
    updateDescription();
    setIconBaseWithExtension(ICON_PATH);
}
 
Example 10
Source File: DockerInstanceNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public DockerInstanceNode(StatefulDockerInstance instance, DockerInstanceChildFactory factory) {
    super(Children.create(factory, true),
            Lookups.fixed(instance.getInstance(), instance, factory));
    this.instance = instance;
    setIconBaseWithExtension(DOCKER_INSTANCE_ICON);
    setShortDescription(instance.getInstance().getUrl());

    instance.addChangeListener(WeakListeners.change(listener, instance));
    instance.refresh();
}
 
Example 11
Source File: RandomErrorTableNode.java    From BART with MIT License 5 votes vote down vote up
public RandomErrorTableNode(EGTask egt,EGTaskDataObjectDataObject dto,String tableName) {
    super(Children.create(new RandomErrorAttributeFactory(egt,dto,tableName), true),
            new ProxyLookup(Lookups.fixed(egt,dto),dto.getAbstractLookup()));
    this.tabName=tableName;
    setName(NodeResource.NODE_RandomErrorTableNode);
    setShortDescription(Bundle.HINT_RandomErrorTableNode());
    setIconBaseWithExtension(R.IMAGE_NODE_ARROW); 
}
 
Example 12
Source File: RestServicesNode.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public RestServicesNode(Project project, RestSupport restSupport) {
    //super(new RestServicesChildren(project), createLookup(project));
    super(Children.create( new RestServiceChildFactory(project, restSupport), true),
            createLookup(project));
    setDisplayName(NbBundle.getBundle(RestServicesNode.class).getString("LBL_RestServices"));
}
 
Example 13
Source File: OverrideEmbeddedAllChildFactory.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 OverrideEmbeddedAllChildFactory(entityWidget, prefixAttributePath_Tmp, initialAttributeWidget, embeddedAttributeWidget.getEmbeddableFlowWidget().getTargetEmbeddableWidget()), true));
    } else {
        node = new PropertyNode<JPAModelerScene>(entityWidget.getModelerScene(), Children.LEAF) {

            @Override
            public void createPropertySet(ElementPropertySet set) {

                if (attributeWidget instanceof RelationAttributeWidget && 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()));
                } else if (initialAttributeWidget.getBaseElementSpec() instanceof AttributeOverrideHandler) {
                    Attribute attributeSpec = (Attribute) attributeWidget.getBaseElementSpec();
                    AttributeOverrideHandler attributeOverrideHandler = (AttributeOverrideHandler) initialAttributeWidget.getBaseElementSpec();
                    AttributeOverride attributeOverride = null;
                    if (prefixAttributePath == null || prefixAttributePath.trim().isEmpty()) {
                        attributeOverride = attributeOverrideHandler.getAttributeOverride(attributeSpec.getName());
                    } else {
                        attributeOverride = attributeOverrideHandler.getAttributeOverride(prefixAttributePath + "." + 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 14
Source File: JustificationRootNode.java    From Llunatic with GNU General Public License v3.0 4 votes vote down vote up
public JustificationRootNode(StepCellGroupNode stepCellGroupNode) {
    super(Children.create(new JustificationTupleFactory(stepCellGroupNode,stepCellGroupNode.getCellGroup().getJustifications()), true));
}
 
Example 15
Source File: KnockoutPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * Updates the panel (according to the current selection).
 * 
 * @param documentUpdated {@code true} when the document was updated,
 * {@code false} otherwise.
 */
@NbBundle.Messages({
    "KnockoutPanel.messageLabel.noKnockout=<Knockout Not Found (Yet?)>",
    "KnockoutPanel.messageLabel.noSelection=<No Element Selected>",
    "KnockoutPanel.messageLabel.noSingleSelection=<Multiple Elements Selected>"
})
final void update(final boolean documentUpdated) {
    if (!EventQueue.isDispatchThread()) {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                update(documentUpdated);
            }
        });
        return;
    }
    selectedNode = null;
    if (documentUpdated) {
        knockoutFound = false;
        unusedBindingsPanel.setKnockoutVersion(null);
    }
    JComponent componentToShow;
    if (knockoutFound) {
        List<? extends Node> selection = pageModel.getSelectedNodes();
        if (selection.isEmpty()) {
            messageLabel.setText(Bundle.KnockoutPanel_messageLabel_noSelection());
            bindingContextComponent = messageLabel;
        } else if (selection.size() > 1) {
            messageLabel.setText(Bundle.KnockoutPanel_messageLabel_noSingleSelection());
            bindingContextComponent = messageLabel;
        } else {
            selectedNode = selection.get(0);
            org.netbeans.modules.web.webkit.debugging.api.dom.Node webKitNode =
                selectedNode.getLookup().lookup(org.netbeans.modules.web.webkit.debugging.api.dom.Node.class);
            WebKitDebugging webKit = pageModel.getWebKit();
            Node rootNode = new AbstractNode(Children.create(new KnockoutChildFactory(webKit, webKitNode), true));
            getExplorerManager().setRootContext(rootNode);
            bindingContextComponent = contextView;
            expandDataNode();
        }
        if (bindingContextButton.isSelected()) {
            showInContentPanel(bindingContextComponent);
        }
        componentToShow = mainPanel;
    } else {
        messageLabel.setText(Bundle.KnockoutPanel_messageLabel_noKnockout());
        componentToShow = messageLabel;
    }
    
    if (componentToShow.getParent() == null) {
        removeAll();
        add(componentToShow);
    }
    revalidate();
    repaint();
}
 
Example 16
Source File: UserStepCellGroupsRootNode.java    From Llunatic with GNU General Public License v3.0 4 votes vote down vote up
public UserStepCellGroupsRootNode(ChaseStepNode chaseStepNode, ICellGroupValueFilter valueFilter) {
    super(Children.create(new StepCellGroupsLoaderFactory(chaseStepNode, valueFilter), true));
    setName("cellGroupsRoot");
}
 
Example 17
Source File: ProjectWebServiceNodeFactory.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public WSRootNode(WSChildrenFactory factory, Lookup lookup) {
    super(Children.create(factory, true), lookup);
    this.factory = factory;
}
 
Example 18
Source File: TemplateChooserPanelGUI.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override protected Node createNodeForKey(TemplateKey k) {
    return new FilterNode(k.d.getNodeDelegate(), k.leaf ? Children.LEAF : Children.create(new TemplateChildren((DataFolder) k.d, false, filterText), true));
}
 
Example 19
Source File: ProjectFilesNode.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public ProjectFilesNode(GrailsProject project) {
    super( Children.create( new ProjectFilesChildren(project), true),
           Lookups.fixed( project.getProjectDirectory() )
    );
}
 
Example 20
Source File: DepListNode.java    From Llunatic with GNU General Public License v3.0 4 votes vote down vote up
public DepListNode(List<Dependency> depList, String name, boolean async) {
    super(Children.create(new DepListChildFactory(depList), async));
    setName(name);
    setDisplayName(name);
}