private Node createRootNode(List<NBVersionInfo> infos) { Node node = null; Map<String, List<NBVersionInfo>> map = new HashMap<String, List<NBVersionInfo>>(); for (NBVersionInfo nbvi : infos) { String key = nbvi.getGroupId() + " : " + nbvi.getArtifactId(); List<NBVersionInfo> get = map.get(key); if (get == null) { get = new ArrayList<NBVersionInfo>(); map.put(key, get); } get.add(nbvi); } Set<String> keySet = map.keySet(); if (keySet.size() > 0) { Children.Array array = new Children.Array(); List<String> keyList = new ArrayList<String>(keySet); Collections.sort(keyList); node = new AbstractNode(array); for (String key : keyList) { array.add(new Node[]{new ArtifactNode(key, map.get(key))}); } } else { Node empty = createEmptyNode(); Children.Array array = new Children.Array(); array.add(new Node[]{empty}); node = new AbstractNode(array); } return node; }
/** * Creates a new {@code MatchedPropertiesNode}. * * @param project owning project of the inspected page. * @param matchedStyles rules matching a node. * @param propertyInfos information about the supported properties. */ MatchedPropertiesNode(Project project, MatchedStyles matchedStyles, Map<String,PropertyInfo> propertyInfos) { super(new Children.Array()); this.project = project; this.matchedStyles = matchedStyles; this.propertyInfos = propertyInfos; initChildren(); setDisplayName(NbBundle.getMessage(MatchedPropertiesNode.class, "MatchedPropertiesNode.displayName")); // NOI18N }
protected Node[] createNodes(Object key) { if (key == WaitNode.WAIT_KEY) { return WaitNode.createNode(); } else if (key instanceof String) { List<FileObject> fobjs = nsFilesMap.get(key); if (fobjs != null && !fobjs.isEmpty()) { Node[] filterNodes = new Node[fobjs.size()]; int i = 0; for (FileObject fobj:fobjs) { try { Node node = DataObject.find(fobj).getNodeDelegate(); filterNodes[i++] = decorator.createExternalReferenceNode(node); } catch (DataObjectNotFoundException donfe) { } } Children.Array children = new Children.Array(); children.add(filterNodes); Node node = new NamespaceNode(children, (String) key, decorator); return new Node[] { node }; } } return new Node[] { }; }
private Node getTemplatesRootNode() { try { FileObject shellFolder = FileUtil.getConfigFile("org-netbeans-modules-swingapp/appshells"); // NOI18N DataObject dobj = DataObject.find(shellFolder); return new FilterNode(dobj.getNodeDelegate(), new FilterNode.Children(dobj.getNodeDelegate()) { @Override protected Node[] createNodes(Node key) { try { String className = (String)fileFromNode(key).getAttribute("requiredClass"); // NOI18N if (className != null) { ClassLoader classLoader = Lookup.getDefault().lookup(ClassLoader.class); classLoader.loadClass(className); } return new Node[] { copyNode(key) }; } catch (ClassNotFoundException ex) { Logger.getLogger(getClass().getName()).log(Level.INFO, ex.getLocalizedMessage(), ex); } return new Node[0]; } }); } catch (Exception ex) { // should not happen, but... ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex); return new AbstractNode(new Children.Array()); } }
protected NamedBeanNode(final SectionNodeView sectionNodeView, final DDBinding binding, final String beanNameProperty, final String beanTitle, final String iconBase, final ASDDVersion version) { super(sectionNodeView, new Children.Array(), binding.getSunBean(), version, beanTitle, iconBase); this.binding = binding; this.beanNameProperty = beanNameProperty; binding.getSunBean().addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { String oldDisplayName = getDisplayName(); String newDisplayName = generateTitle(); if (!oldDisplayName.equals(newDisplayName)) { setDisplayName(newDisplayName); setName(newDisplayName); firePropertyChange(Node.PROP_DISPLAY_NAME, oldDisplayName, newDisplayName); } } }); setName(beanTitle); helpProvider = true; }
ReferencesNode(SectionNodeView sectionNodeView, Ejb ejb, final ASDDVersion version) { super(sectionNodeView, new Children.Array(), ejb, version, NbBundle.getMessage(ReferencesNode.class, "LBL_ReferencesHeader"), ICON_BASE_REFERENCES_NODE); this.helpProvider = true; // References addChild(new EjbRefGroupNode(sectionNodeView, ejb, version)); addChild(new ResourceRefGroupNode(sectionNodeView, ejb, version)); addChild(new ResourceEnvRefGroupNode(sectionNodeView, ejb, version)); if(ASDDVersion.SUN_APPSERVER_8_0.compareTo(version) <= 0) { SunDescriptorDataObject dataObject = (SunDescriptorDataObject) sectionNodeView.getDataObject(); J2EEBaseVersion j2eeVersion = dataObject.getJ2eeModuleVersion(); if(j2eeVersion == null || j2eeVersion.compareSpecification(J2EEVersion.J2EE_1_4) >= 0) { addChild(new ServiceRefGroupNode(sectionNodeView, ejb, version)); if(ASDDVersion.SUN_APPSERVER_9_0.compareTo(version) <= 0) { if(j2eeVersion == null || j2eeVersion.compareSpecification(J2EEVersion.JAVAEE_5_0) >= 0) { addChild(new MessageDestinationRefGroupNode(sectionNodeView, ejb, version)); } } } } }
/** * Creates a new {@code MatchedRulesNode}. * * @param project owning project of the inspected page. * @param node node that was matched by the displayed rules. * @param matchedStyles rules matching the selected element. */ MatchedRulesNode(Project project, Node node, MatchedStyles matchedStyles) { super(new Children.Array()); this.project = project; this.node = node; this.matchedStyles = matchedStyles; if (matchedStyles != null) { initChildren(); } setDisplayName(NbBundle.getMessage(MatchedRulesNode.class, "MatchedRulesNode.displayName")); // NOI18N }
public static Children createBuildPlanChildren(final BuildPlanView view, final List<MavenProject> mps) { final Children.Array array = new Children.Array(); try { ReactorManager rm = new ReactorManager(mps, ReactorManager.FAIL_FAST); List<MavenProject> sortedProjects = rm.getSortedProjects(); for (MavenProject mp : sortedProjects) { array.add(new Node[]{new LifecycleNode(view, mp) }); } } catch (Exception e) { Exceptions.printStackTrace(e); } return array; }
@NbBundle.Messages({ "CTL_FoundModes=Found modes", "LBL_LayoutingWizardTitle=Define Your Modes" }) public LayoutLaunchingPanel(final WizardDescriptor setting, final NewTCIterator.DataModel data) { super(setting); this.data = data; Node root = new AbstractNode(new Children.Array()); this.em = new ExplorerManager(); this.em.setRootContext(root); initComponents(); initAccessibility(); putClientProperty("NewFileWizard_Title", Bundle.LBL_LayoutingWizardTitle()); // NOI18N }
void find(final List<QueryField> fields) { Node loadingNode = GroupListChildren.createLoadingNode(); Children.Array array = new Children.Array(); array.add(new Node[]{loadingNode}); manager.setRootContext(new AbstractNode(array)); RequestProcessor.getDefault().post(new Runnable() { public void run() { final List<NBVersionInfo> infos = RepositoryQueries.find(fields); SwingUtilities.invokeLater(new Runnable() { public void run() { manager.setRootContext(createRootNode(infos)); } }); } }); }
/** * Adds a sub-node to this node. This method is called on nodes that * represent a short-hand property only. * * @param subNode sub-node that represents a property that belongs under * a short-hand property represented by this node. */ void addSubNode(MatchedPropertyNode subNode) { if (isLeaf()) { setChildren(new Children.Array()); } Children.Array children = (Children.Array)getChildren(); children.add(new Node[] { subNode }); }
public GSTargetNode(Lookup lookup) { super(new Children.Array()); }
private void populateTree(){ LogicalViewProvider lvp = project.getLookup().lookup(LogicalViewProvider.class); Node projectView = lvp.createLogicalView(); Children.Array children = new Children.Array(); FilterNode filter = new UnmodifiableFilterNode(projectView, new SourceListViewChildren()); children.add(new FilterNode[] {filter}); manager.setRootContext(filter); }
private Node createWaitNode() { AbstractNode node = new AbstractNode(Children.LEAF); node.setName(NbBundle.getMessage(InstanceTargetXNode.class, "LBL_WaitNode_DisplayName")); node.setIconBaseWithExtension("org/netbeans/modules/j2ee/deployment/impl/ui/resources/wait.gif"); // NOI18N Children.Array children = new Children.Array(); children.add(new Node[]{node}); return new AbstractNode(children); } }
public JBTargetNode(Lookup lookup) { super(new Children.Array()); getChildren().add(new Node[] {new JBItemNode(new JBApplicationsChildren(lookup), NbBundle.getMessage(JBTargetNode.class, "LBL_Apps"))}); }
private Node createRootNode() { Children.Array array = new Children.Array(); List<RepositoryInfo> infos = RepositoryPreferences.getInstance().getRepositoryInfos(); for (RepositoryInfo ri : infos) { if (ri.isRemoteDownloadable() || ri.isLocal()) { array.add(new Node[]{new RepositoryNode(ri)}); } } return new AbstractNode(array); }
public EntityContainerNode() { super(new Children.Array()); // SortedArray setName("Entities"); }
public static Children createChildren(BuildPlanView view, MavenProject nmp, MojoBinding mb) { Children.Array array = new Children.Array(); Node[] nodes = new Node[mb.getConfiguration()==null? 1:2]; nodes[0] = new ExecutionNode(mb); if (mb.getConfiguration()!=null) { nodes[1] = new ConfigurationNode(mb); } array.add(nodes); return array; }
public KenaiInstanceNode(final Kenai instance) { super(new Children.Array(), Lookups.singleton(instance)); this.kenaiInstance=instance; setName(kenaiInstance.getUrl().toString()); instance.addPropertyChangeListener(Kenai.PROP_URL_CHANGED, this); setDisplayName(instance.getName()); setShortDescription(instance.getName() + " (" + instance.getUrl() + ")"); // NOI18N properties = new KenaiInstanceProperties(instance.getName(),instance.getUrl().toString()); }
LazyNode(Map<String,?> map) { this(new AbstractNode(new Children.Array()), map); } private LazyNode(AbstractNode an, Map<String,?> map) {