List of usage examples for javax.swing.tree DefaultMutableTreeNode DefaultMutableTreeNode
public DefaultMutableTreeNode(Object userObject)
From source file:com.pironet.tda.SunJDKParser.java
private void addHistogramToDump(DefaultMutableTreeNode threadDump, HistogramTableModel classHistogram) { final HistogramInfo hi = new HistogramInfo("Class Histogram of Dump", classHistogram); final DefaultMutableTreeNode catHistogram = new DefaultMutableTreeNode(hi); threadDump.add(catHistogram);//from w ww. jav a 2s . co m }
From source file:de.erdesignerng.visual.common.OutlineComponent.java
private void buildCustomTypesChildren(Model aModel, DefaultMutableTreeNode aParent, List<CustomType> aCustomTypesList) { DefaultMutableTreeNode theCustomTypesNode = new DefaultMutableTreeNode(TreeGroupingElement.CUSTOMTYPES); aCustomTypesList.stream().filter(theCustomType -> isVisible(theCustomType)).forEach(theCustomType -> { DefaultMutableTreeNode theCustomTypeNode = new DefaultMutableTreeNode(theCustomType); theCustomTypesNode.add(theCustomTypeNode); registerUserObject(theCustomType, theCustomTypeNode); updateCustomTypeTreeNode(aModel, theCustomType, theCustomTypeNode); });// w w w. j av a2 s . co m aParent.add(theCustomTypesNode); }
From source file:edu.ku.brc.specify.tasks.subpane.security.SecurityAdminPane.java
/** * @param session//from w w w . j ava 2s . c o m * @param node * @param scope */ private void addGroup(final DataProviderSessionIFace session, final DefaultMutableTreeNode node, final UserGroupScope scope) { String userPrin = UserPrincipal.class.getName(); // sort groups Vector<SpPrincipal> groups = new Vector<SpPrincipal>(); for (SpPrincipal group : scope.getUserGroups()) { String subClass = group.getGroupSubClass(); if (group.getGroupType() == null && StringUtils.isNotEmpty(subClass) && subClass.equals(userPrin)) continue; groups.add(group); } Collections.sort(groups, new Comparator<SpPrincipal>() { @Override public int compare(SpPrincipal obj1, SpPrincipal obj2) { if (obj1 != null && obj1.getPriority() != null && obj2 != null && obj2.getPriority() != null) { return obj2.getPriority().compareTo(obj1.getPriority()); } return 100; // shouldn't happen } }); for (SpPrincipal group : groups) { //log.debug(scope.getId()+" "+scope.getTableId()); //log.debug(" Group: "+group.getName()+" "+ group.getGroupType()+" "+ group.getGroupSubClass()+" "+ group.getId()); String subClass = group.getGroupSubClass(); if (group.getGroupType() == null && StringUtils.isNotEmpty(subClass) && subClass.equals(userPrin)) continue; //if (UserPrincipal.class.getCanonicalName().equals(group.getGroupSubClass())) continue; DefaultMutableTreeNode groupNode = new DefaultMutableTreeNode(new DataModelObjBaseWrapper(group)); node.add(groupNode); // sort users TreeSet<SpecifyUser> users = new TreeSet<SpecifyUser>(group.getSpecifyUsers()); for (SpecifyUser user : users) { // save user into user list spUsers.add(user); user.getSpPrincipals().size(); DefaultMutableTreeNode userNode = new DefaultMutableTreeNode(new DataModelObjBaseWrapper(user)); groupNode.add(userNode); //log.debug(" SpUser: "+user.getName()); } } }
From source file:gdt.jgui.entity.index.JIndexPanel.java
/** * Create a new facet renderer./*ww w . ja va2 s .co m*/ * @param console the main console. * @param locator$ the locator string. * @return the fields editor. */ @Override public JContext instantiate(JMainConsole console, String locator$) { try { // System.out.println("IndexPanel.instantiate:locator="+locator$); this.console = console; Properties locator = Locator.toProperties(locator$); entihome$ = locator.getProperty(Entigrator.ENTIHOME); entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY); Entigrator entigrator = console.getEntigrator(entihome$); requesterResponseLocator$ = locator.getProperty(JRequester.REQUESTER_RESPONSE_LOCATOR); index = entigrator.getEntityAtKey(entityKey$); entityLabel$ = index.getProperty("label"); rootNode = new DefaultMutableTreeNode(entityLabel$); locator = new Properties(); locator.setProperty(Locator.LOCATOR_TITLE, INDEX); String icon$ = Support.readHandlerIcon(null, JEntitiesPanel.class, "index.png"); locator.setProperty(Locator.LOCATOR_ICON, icon$); locator.setProperty(NODE_TYPE, NODE_TYPE_ROOT); rootNode.setUserObject(Locator.toString(locator)); parentNode = new DefaultMutableTreeNode(entityLabel$); rootNode.add(parentNode); Properties parentLocator = new Properties(); parentLocator.setProperty(Locator.LOCATOR_TITLE, index.getProperty("label")); parentLocator.setProperty(Locator.LOCATOR_ICON, entigrator.readEntityIcon(index)); parentLocator.setProperty(NODE_TYPE, NODE_TYPE_GROUP); parentLocator.setProperty(NODE_KEY, "parent"); parentLocator.setProperty(Entigrator.ENTIHOME, entihome$); parentLocator.setProperty(EntityHandler.ENTITY_KEY, entityKey$); parentNode.setUserObject(Locator.toString(parentLocator)); //String[] sa=listGroupMembers(index,"parent"); String[] sa = listOrderedGroupMembers(index, "parent"); DefaultMutableTreeNode child; if (sa != null) for (String aSa : sa) { child = instantiateNode(index, aSa); if (child != null) parentNode.add(child); } tree = new JTree(rootNode); tree.addTreeSelectionListener(new SelectionListener()); tree.setShowsRootHandles(true); tree.setCellRenderer(new NodeRenderer()); tree.addMouseListener(new MousePopupListener()); scrollPane.getViewport().add(tree); String selectedNodeKey$ = index.getElementItemAt("index.selection", "selection"); if (selectedNodeKey$ != null) select(selectedNodeKey$); } catch (Exception e) { Logger.getLogger(getClass().getName()).severe(e.toString()); } return this; }
From source file:de.erdesignerng.visual.common.OutlineComponent.java
private void buildDomainsChildren(Model aModel, DefaultMutableTreeNode aParent, List<Domain> aDomainList) { DefaultMutableTreeNode theDomainsNode = new DefaultMutableTreeNode(TreeGroupingElement.DOMAINS); aDomainList.stream().filter(theDomain -> isVisible(theDomain)).forEach(theDomain -> { DefaultMutableTreeNode theDomainNode = new DefaultMutableTreeNode(theDomain); theDomainsNode.add(theDomainNode); registerUserObject(theDomain, theDomainNode); updateDomainTreeNode(aModel, theDomain, theDomainNode); });/*from ww w . j a v a 2s . co m*/ aParent.add(theDomainsNode); }
From source file:edu.ucla.stat.SOCR.chart.ChartTree.java
private MutableTreeNode createGanttChartsNode() { DefaultMutableTreeNode root = new DefaultMutableTreeNode("Gantt Charts"); DefaultMutableTreeNode n1 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.GanttDemo1", "GanttDemo1")); DefaultMutableTreeNode n2 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.GanttDemo2", "GanttDemo2")); root.add(n1);/*from w ww . ja va 2 s. c o m*/ root.add(n2); return root; }
From source file:edu.harvard.i2b2.previousquery.ui.QueryPreviousRunsPanel.java
/** * This method is called from within the constructor to initialize the form. *//*from w ww . j av a 2s. c om*/ private void initComponents() { System.setProperty("PQSortByTimeCheckBox", "true"); System.setProperty("QueryToolMaxQueryNumber", "20"); System.setProperty("PQMaxPatientsNumber", "200"); System.setProperty("PQSortByNameCheckBox", "false"); jScrollPane1 = new javax.swing.JScrollPane(); jTree1 = new javax.swing.JTree(); setLayout(new java.awt.BorderLayout()); QueryMasterData tmpData = new QueryMasterData(); tmpData.name("Queries by " + UserInfoBean.getInstance().getUserName()); tmpData.tooltip("Previous query runs"); tmpData.visualAttribute("CA"); top = new DefaultMutableTreeNode(tmpData); // top = new DefaultMutableTreeNode("Root Node"); treeModel = new DefaultTreeModel(top); // treeModel.addTreeModelListener(new MyTreeModelListener()); jTree1 = new JTree(treeModel); jTree1.setEditable(false); // jTree1.getSelectionModel().setSelectionMode // (TreeSelectionModel.SINGLE_TREE_SELECTION); jTree1.setShowsRootHandles(true); // JScrollPane treeView = new JScrollPane(jTree1); jTree1.setRootVisible(false); jTree1.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); jTree1.setCellRenderer(new MyRenderer()); ToolTipManager.sharedInstance().registerComponent(jTree1); if (cellStatus.equalsIgnoreCase("CellDown")) { DefaultMutableTreeNode childNode = new DefaultMutableTreeNode("Data Repository Cell is unavailable"); treeModel.insertNodeInto(childNode, top, top.getChildCount()); // Make sure the user can see the lovely new node. jTree1.expandPath(new TreePath(top.getPath())); } ArrayList<QueryMasterData> queries = previousQueries; if (queries != null) { for (int i = 0; i < queries.size(); i++) { addNode(queries.get(i)); } } jScrollPane1.setViewportView(jTree1); add(jScrollPane1, java.awt.BorderLayout.CENTER); jTree1.setTransferHandler(new NodeCopyTransferHandler()); jTree1.addTreeExpansionListener(this); jTree1.addTreeWillExpandListener(this); }
From source file:de.erdesignerng.visual.common.OutlineComponent.java
private void buildTablesChildren(Model aModel, DefaultMutableTreeNode aParentNode, List<Table> aTableList) { DefaultMutableTreeNode theTablesNode = new DefaultMutableTreeNode(TreeGroupingElement.TABLES); aTableList.stream().filter(theTable -> isVisible(theTable)).forEach(theTable -> { DefaultMutableTreeNode theTableNode = new DefaultMutableTreeNode(theTable); theTablesNode.add(theTableNode); registerUserObject(theTable, theTableNode); updateTableTreeNode(aModel, theTable, theTableNode); });// w w w . j ava2 s .co m aParentNode.add(theTablesNode); }
From source file:edu.ucla.stat.SOCR.chart.ChartTree.java
/** * Creates the subtree containing the miscellaneous chart types. * // w w w . j a v a 2 s . c o m * @return A subtree. */ private MutableTreeNode createMiscellaneousChartsNode() { DefaultMutableTreeNode root = new DefaultMutableTreeNode("Miscellaneous"); DefaultMutableTreeNode n0 = new DefaultMutableTreeNode(new DemoDescription( "edu.ucla.stat.SOCR.chart.demo.BoxAndWhiskerChartDemo1", "BoxAndWhiskerChartDemo1")); DefaultMutableTreeNode n1 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.BubbleChartDemo1", "BubbleChartDemo1")); DefaultMutableTreeNode n2 = new DefaultMutableTreeNode(new DemoDescription( "edu.ucla.stat.SOCR.chart.demo.CategoryStepChartDemo1", "CategoryStepChartDemo1")); DefaultMutableTreeNode n3 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.CompassDemo1", "CompassDemo1")); DefaultMutableTreeNode n4 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.CompassFormatDemo1", "CompassFormatDemo1")); DefaultMutableTreeNode n5 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.CompassFormatDemo2", "CompassFormatDemo2")); DefaultMutableTreeNode n6 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.DifferenceChartDemo1", "DifferenceChartDemo1")); DefaultMutableTreeNode n7 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.DifferenceChartDemo2", "DifferenceChartDemo2")); DefaultMutableTreeNode n8 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.EventFrequencyDemo1", "EventFrequencyDemo1")); DefaultMutableTreeNode n9 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.HideSeriesDemo1", "HideSeriesDemo1")); DefaultMutableTreeNode n10 = new DefaultMutableTreeNode(new DemoDescription( "edu.ucla.stat.SOCR.chart.demo.OverlaidBarChartDemo1", "OverlaidBarChartDemo1")); DefaultMutableTreeNode n11 = new DefaultMutableTreeNode(new DemoDescription( "edu.ucla.stat.SOCR.chart.demo.OverlaidBarChartDemo2", "OverlaidBarChartDemo2")); DefaultMutableTreeNode n12 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.SpiderWebChartDemo1", "SpiderWebChartDemo1")); DefaultMutableTreeNode n13 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.SymbolAxisDemo1", "SymbolAxisDemo1")); DefaultMutableTreeNode n14 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.PolarChartDemo1", "PolarChartDemo1")); DefaultMutableTreeNode n15 = new DefaultMutableTreeNode( new DemoDescription("edu.ucla.stat.SOCR.chart.demo.YIntervalChartDemo1", "YIntervalChartDemo1")); root.add(createCrosshairChartsNode()); // root.add(createItemLabelsNode()); // root.add(createLegendNode()); // root.add(createMarkersNode()); // root.add(createOrientationNode()); root.add(n0); root.add(n1); root.add(n2); root.add(n3); // root.add(n4); // root.add(n5); root.add(n6); // root.add(n7); root.add(n8); // root.add(n9); // root.add(n10); // root.add(n11); root.add(n12); root.add(n13); root.add(n14); root.add(n15); return root; }
From source file:org.jfree.chart.demo.SuperDemo.java
private MutableTreeNode createXYBarChartsNode() { DefaultMutableTreeNode defaultmutabletreenode = new DefaultMutableTreeNode("XYPlot"); DefaultMutableTreeNode defaultmutabletreenode1 = new DefaultMutableTreeNode( new DemoDescription("XYBarChartDemo1", "XYBarChartDemo1.java")); DefaultMutableTreeNode defaultmutabletreenode2 = new DefaultMutableTreeNode( new DemoDescription("XYBarChartDemo2", "XYBarChartDemo2.java")); DefaultMutableTreeNode defaultmutabletreenode3 = new DefaultMutableTreeNode( new DemoDescription("XYBarChartDemo3", "XYBarChartDemo3.java")); DefaultMutableTreeNode defaultmutabletreenode4 = new DefaultMutableTreeNode( new DemoDescription("XYBarChartDemo4", "XYBarChartDemo4.java")); DefaultMutableTreeNode defaultmutabletreenode5 = new DefaultMutableTreeNode( new DemoDescription("XYBarChartDemo5", "XYBarChartDemo5.java")); DefaultMutableTreeNode defaultmutabletreenode6 = new DefaultMutableTreeNode( new DemoDescription("XYBarChartDemo6", "XYBarChartDemo6.java")); DefaultMutableTreeNode defaultmutabletreenode7 = new DefaultMutableTreeNode( new DemoDescription("XYBarChartDemo7", "XYBarChartDemo7.java")); DefaultMutableTreeNode defaultmutabletreenode8 = new DefaultMutableTreeNode( new DemoDescription("ClusteredXYBarRendererDemo1", "ClusteredXYBarRendererDemo1.java")); DefaultMutableTreeNode defaultmutabletreenode9 = new DefaultMutableTreeNode( new DemoDescription("StackedXYBarChartDemo1", "StackedXYBarChartDemo1.java")); DefaultMutableTreeNode defaultmutabletreenode10 = new DefaultMutableTreeNode( new DemoDescription("StackedXYBarChartDemo2", "StackedXYBarChartDemo2.java")); DefaultMutableTreeNode defaultmutabletreenode11 = new DefaultMutableTreeNode( new DemoDescription("StackedXYBarChartDemo3", "StackedXYBarChartDemo3.java")); DefaultMutableTreeNode defaultmutabletreenode12 = new DefaultMutableTreeNode( new DemoDescription("RelativeDateFormatDemo1", "RelativeDateFormatDemo1.java")); DefaultMutableTreeNode defaultmutabletreenode13 = new DefaultMutableTreeNode( new DemoDescription("RelativeDateFormatDemo2", "RelativeDateFormatDemo2.java")); defaultmutabletreenode.add(defaultmutabletreenode1); defaultmutabletreenode.add(defaultmutabletreenode2); defaultmutabletreenode.add(defaultmutabletreenode3); defaultmutabletreenode.add(defaultmutabletreenode4); defaultmutabletreenode.add(defaultmutabletreenode5); defaultmutabletreenode.add(defaultmutabletreenode6); defaultmutabletreenode.add(defaultmutabletreenode7); defaultmutabletreenode.add(defaultmutabletreenode8); defaultmutabletreenode.add(defaultmutabletreenode9); defaultmutabletreenode.add(defaultmutabletreenode10); defaultmutabletreenode.add(defaultmutabletreenode11); defaultmutabletreenode.add(defaultmutabletreenode12); defaultmutabletreenode.add(defaultmutabletreenode13); return defaultmutabletreenode; }