List of usage examples for javax.swing.tree DefaultMutableTreeNode DefaultMutableTreeNode
public DefaultMutableTreeNode(Object userObject)
From source file:edu.ku.brc.specify.tasks.subpane.security.SecurityAdminPane.java
/** * @param session/*from ww w . java 2 s. c o m*/ * @param divNode * @param division */ @SuppressWarnings("unused") private void addDisciplinesRecursively(final DataProviderSessionIFace session, final DefaultMutableTreeNode divNode, final Division division) { // sort disciplines TreeSet<Discipline> disciplines = new TreeSet<Discipline>(division.getDisciplines()); for (Discipline discipline : disciplines) { log.debug(" Adding Discipline " + discipline.getName()); DefaultMutableTreeNode discNode = new DefaultMutableTreeNode(new DataModelObjBaseWrapper(discipline)); divNode.add(discNode); addCollectionsRecursively(session, discNode, discipline); addGroup(session, discNode, discipline); } }
From source file:lcmc.gui.ClusterBrowser.java
/** Adds VMs node. */ void addVMSNode() { /* VMs *//*from w ww.j av a 2 s . co m*/ if (vmsNode == null) { vmsNode = new DefaultMutableTreeNode(new VMSInfo(Tools.getString("ClusterBrowser.VMs"), this)); setNode(vmsNode); topAdd(vmsNode); reload(getTreeTop(), true); } }
From source file:edu.ucla.stat.SOCR.chart.ChartTree.java
private MutableTreeNode createMultipleAxisChartsNode() { DefaultMutableTreeNode root = new DefaultMutableTreeNode("Multiple Axis Charts"); DefaultMutableTreeNode n1 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.DualAxisDemo1", "DualAxisDemo1")); DefaultMutableTreeNode n2 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.DualAxisDemo2", "DualAxisDemo2")); DefaultMutableTreeNode n3 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.DualAxisDemo3", "DualAxisDemo3")); DefaultMutableTreeNode n4 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.DualAxisDemo4", "DualAxisDemo4")); DefaultMutableTreeNode n5 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.DualAxisDemo5", "DualAxisDemo5")); DefaultMutableTreeNode n6 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.MultipleAxisDemo1", "MultipleAxisDemo1")); root.add(n1);//from ww w. j av a 2 s .c o m root.add(n2); root.add(n3); root.add(n4); root.add(n5); root.add(n6); return root; }
From source file:lcmc.gui.ClusterBrowser.java
/** Initializes cluster resources for cluster view. */ void initClusterBrowser() { /* hosts *///from w ww . j a v a 2s . c o m clusterHostsInfo = new ClusterHostsInfo(Tools.getString("ClusterBrowser.ClusterHosts"), this); clusterHostsNode = new DefaultMutableTreeNode(clusterHostsInfo); setNode(clusterHostsNode); topAdd(clusterHostsNode); /* networks */ networksNode = new DefaultMutableTreeNode( new CategoryInfo(Tools.getString("ClusterBrowser.Networks"), this)); setNode(networksNode); topAdd(networksNode); /* drbd */ drbdNode = new DefaultMutableTreeNode(new DrbdInfo(Tools.getString("ClusterBrowser.Drbd"), this)); setNode(drbdNode); topAdd(drbdNode); /* CRM */ final CRMInfo crmInfo = new CRMInfo(Tools.getString("ClusterBrowser.ClusterManager"), this); crmNode = new DefaultMutableTreeNode(crmInfo); setNode(crmNode); topAdd(crmNode); /* available services */ availableServicesNode = new DefaultMutableTreeNode( new AvailableServicesInfo(Tools.getString("ClusterBrowser.availableServices"), this)); setNode(availableServicesNode); addNode(crmNode, availableServicesNode); /* block devices / shared disks, TODO: */ commonBlockDevicesNode = new DefaultMutableTreeNode( new HbCategoryInfo(Tools.getString("ClusterBrowser.CommonBlockDevices"), this)); setNode(commonBlockDevicesNode); /* addNode(crmNode, commonBlockDevicesNode); */ /* resource defaults */ rscDefaultsInfo = new RscDefaultsInfo("rsc_defaults", this); /* services */ servicesInfo = new ServicesInfo(Tools.getString("ClusterBrowser.Services"), this); servicesNode = new DefaultMutableTreeNode(servicesInfo); setNode(servicesNode); addNode(crmNode, servicesNode); addVMSNode(); selectPath(new Object[] { getTreeTop(), crmNode }); }
From source file:de.erdesignerng.visual.common.OutlineComponent.java
private void buildSubjectAreasChildren(Model aModel, DefaultMutableTreeNode aParent, List<SubjectArea> aList) { DefaultMutableTreeNode theSANode = new DefaultMutableTreeNode(TreeGroupingElement.SUBJECTAREAS); aList.stream().filter(theArea -> isVisible(theArea)).forEach(theArea -> { DefaultMutableTreeNode theAreaNode = new DefaultMutableTreeNode(theArea); theSANode.add(theAreaNode);/*from www. j a va2s . com*/ registerUserObject(theArea, theAreaNode); List<Table> theSATables = new ArrayList<>(); theSATables.addAll(theArea.getTables()); Collections.sort(theSATables, new BeanComparator("name")); buildTablesChildren(aModel, theAreaNode, theSATables); List<View> theSAViews = new ArrayList<>(); theSAViews.addAll(theArea.getViews()); Collections.sort(theSAViews, new BeanComparator("name")); buildViewsChildren(aModel, theAreaNode, theSAViews); }); aParent.add(theSANode); }
From source file:edu.ku.brc.specify.tasks.subpane.security.SecurityAdminPane.java
/** * @param session/* ww w .ja va2 s . c om*/ * @param discNode * @param discipline */ private void addCollectionsRecursively(final DataProviderSessionIFace session, final DefaultMutableTreeNode discNode, final Discipline discipline) { // sort collections TreeSet<Collection> collections = new TreeSet<Collection>(discipline.getCollections()); for (Collection collection : collections) { log.debug(" Adding Collection " + collection.getCollectionName()); DefaultMutableTreeNode collNode = new DefaultMutableTreeNode(new DataModelObjBaseWrapper(collection)); discNode.add(collNode); addGroup(session, collNode, collection); } }
From source file:ai.aitia.meme.paramsweep.intellisweepPlugin.JgapGAPlugin.java
protected DefaultMutableTreeNode getAlteredParameterTreeRootNode(final IIntelliContext ctx) { genotype = generateInitialPopulation(ctx); final Population descendants = genotype.getPopulation(); final DefaultMutableTreeNode root = new DefaultMutableTreeNode("Parameter file"); paramList = ctx.getParameters();/*from w ww .ja v a 2 s. co m*/ for (int i = 0; i < paramList.size(); ++i) { final ParameterInfo paramInfo = paramList.get(i); paramInfo.setRuns(1); // Run is always 1 final List<Object> values = new ArrayList<Object>(); final int genIdx = whichGene(paramInfo.getName()); if (genIdx >= 0) { for (int j = 0; j < populationSize; ++j) { final String strValue = String .valueOf(descendants.getChromosome(j).getGene(genIdx).getAllele()); values.add(ParameterInfo.getValue(strValue, paramInfo.getJavaType())); paramInfo.setDefinitionType(ParameterInfo.LIST_DEF); } } else { values.add(paramInfo.getValue()); paramInfo.setDefinitionType(ParameterInfo.CONST_DEF); } paramInfo.setValues(values); // add the node root.add(new DefaultMutableTreeNode(paramInfo)); } return root; }
From source file:edu.ku.brc.af.tasks.subpane.formeditor.ViewSetSelectorPanel.java
/** * Adds a new row in the right position (above). *///from w w w .j a v a 2 s .c o m protected void addRow() { DefaultTreeModel model = (DefaultTreeModel) tree.getModel(); FormRow newRow = new FormRow(); DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(newRow); newNode.setUserObject(newRow); DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) tree.getSelectionModel().getSelectionPath() .getLastPathComponent(); DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) selectedNode.getParent(); if (parentNode == null) { parentNode = (DefaultMutableTreeNode) model.getRoot(); selectedNode = null; } int position; if (selectedRow == null || parentNode.getUserObject() instanceof String) { formViewDef.getRows().add(newRow); position = formViewDef.getRows().size() - 1; } else { position = formViewDef.getRows().indexOf(selectedRow); formViewDef.getRows().insertElementAt(newRow, (byte) position); } model.insertNodeInto(newNode, parentNode, position); renumberRows(formViewDef.getRows()); updateTreeNodes((DefaultMutableTreeNode) model.getRoot(), model, false); Object[] newPath = new Object[2]; newPath[0] = parentNode; newPath[1] = newNode; final TreePath newTreePath = new TreePath(newPath); SwingUtilities.invokeLater(new Runnable() { public void run() { tree.setSelectionPath(newTreePath); } }); previewPanel.rebuild(false); }
From source file:edu.ucla.stat.SOCR.chart.ChartTree.java
private MutableTreeNode createCombinedAxisChartsNode() { DefaultMutableTreeNode root = new DefaultMutableTreeNode("Combined Axis Charts"); DefaultMutableTreeNode n1 = new DefaultMutableTreeNode(new DemoDescription( "edu.ucla.stat.SOCR.chart.demo.CombinedCategoryPlotDemo1", "CombinedCategoryPlotDemo1")); DefaultMutableTreeNode n2 = new DefaultMutableTreeNode(new DemoDescription( "edu.ucla.stat.SOCR.chart.demo.CombinedCategoryPlotDemo2", "CombinedCategoryPlotDemo2")); DefaultMutableTreeNode n3 = new DefaultMutableTreeNode(new DemoDescription( "edu.ucla.stat.SOCR.chart.demo.CombinedTimeSeriesDemo1", "CombinedTimeSeriesDemo1")); DefaultMutableTreeNode n4 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.CombinedXYPlotDemo1", "CombinedXYPlotDemo1")); DefaultMutableTreeNode n5 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.CombinedXYPlotDemo2", "CombinedXYPlotDemo2")); DefaultMutableTreeNode n6 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.CombinedXYPlotDemo3", "CombinedXYPlotDemo3")); DefaultMutableTreeNode n7 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.CombinedXYPlotDemo4", "CombinedXYPlotDemo4")); root.add(n1);/* w w w . j a v a2 s .co m*/ root.add(n2); root.add(n3); root.add(n4); root.add(n5); root.add(n6); root.add(n7); return root; }
From source file:de.erdesignerng.visual.common.OutlineComponent.java
private void buildViewsChildren(Model aModel, DefaultMutableTreeNode aParent, List<View> aViews) { DefaultMutableTreeNode theViewsNode = new DefaultMutableTreeNode(TreeGroupingElement.VIEWS); aViews.stream().filter(theView -> isVisible(theView)).forEach(theView -> { DefaultMutableTreeNode theViewNode = new DefaultMutableTreeNode(theView); theViewsNode.add(theViewNode);/* w ww. j a va 2 s . co m*/ registerUserObject(theView, theViewNode); updateViewTreeNode(aModel, theView, theViewNode); }); aParent.add(theViewsNode); }