List of usage examples for javax.swing.tree DefaultTreeModel DefaultTreeModel
@ConstructorProperties({ "root" }) public DefaultTreeModel(TreeNode root)
From source file:org.apache.directory.fortress.web.panel.RoleListPanel.java
private DefaultTreeModel createTreeModel(List<T> roles) { DefaultTreeModel model;/* ww w . j a va 2 s .c o m*/ rootNode = new DefaultMutableTreeNode(null); model = new DefaultTreeModel(rootNode); if (roles == null) log.debug("no Roles found"); else { log.debug("Roles found:" + roles.size()); for (T role : roles) rootNode.add(new DefaultMutableTreeNode(role)); } return model; }
From source file:org.apache.directory.fortress.web.panel.SDListPanel.java
private DefaultTreeModel createTreeModel(List<SDSet> sdSets) { DefaultTreeModel model;//www . j ava 2 s . c o m rootNode = new DefaultMutableTreeNode(null); model = new DefaultTreeModel(rootNode); if (sdSets == null) log.debug("no SDSets found"); else { log.debug("SDSets found:" + sdSets.size()); for (SDSet sdSet : sdSets) rootNode.add(new DefaultMutableTreeNode(sdSet)); } return model; }
From source file:org.apache.directory.fortress.web.panel.UserListPanel.java
private DefaultTreeModel createTreeModel(List<T> users) { DefaultTreeModel model;//from w ww. ja v a2s . c o m rootNode = new DefaultMutableTreeNode(null); model = new DefaultTreeModel(rootNode); if (users == null) { LOG.debug("no Users found"); } else { LOG.debug(".createTreeModel Users found:" + users.size()); for (T user : users) { rootNode.add(new DefaultMutableTreeNode(user)); } } return model; }
From source file:org.apache.jackrabbit.oak.explorer.NodeStoreTree.java
private void refreshModel() { index = backend.getTarReaderIndex(); sizeCache = newHashMap();/*from w w w.j a v a2 s .c o m*/ DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode( new NamePathModel("/", "/", backend.getHead(), sizeCache, skipSizeCheck, backend), true); treeModel = new DefaultTreeModel(rootNode); addChildren(rootNode); tree.setModel(treeModel); }
From source file:org.apache.jetspeed.portlets.site.PortalSiteManager.java
private DefaultMutableTreeNode populateUserTree(String userName) { DefaultMutableTreeNode rootNode = null; rootNode = retrieveFolders("/_user/" + userName, rootNode); treeRoot = new DefaultTreeModel(rootNode); return rootNode; }
From source file:org.apache.jetspeed.portlets.site.PortalSiteManager.java
private DefaultMutableTreeNode populateTree() { DefaultMutableTreeNode rootNode = null; rootNode = retrieveFolders(determineRootFolder(), rootNode); treeRoot = new DefaultTreeModel(rootNode); return rootNode; }
From source file:org.apache.jetspeed.portlets.site.PortalSiteManager.java
private DefaultMutableTreeNode populateCopyTree() { DefaultMutableTreeNode rootNode = null; rootNode = retrieveCopyFolders("/", rootNode); treeRoot = new DefaultTreeModel(rootNode); return rootNode; }
From source file:org.apache.jetspeed.portlets.site.PortalSiteManager.java
private SiteTreeNode getInitSiteTreeNode() { SiteTreeNode siteTreeNode = null;//from ww w. j a v a 2s. com PortletRequest portletRequest = getPortletRequest(); String pathParam = portletRequest.getParameter(PORTAL_SITE_MANAGER_INIT_NODE_PATH_PARAM); if (pathParam == null) { pathParam = getPreference(PORTAL_SITE_MANAGER_INIT_NODE_PATH_PARAM); if (pathParam == null) { pathParam = getInitParam(PORTAL_SITE_MANAGER_INIT_NODE_PATH_PARAM); } } if (pathParam != null) { String type = PAGE_NODE_TYPE; String typeParam = null; if (typeParam == null) { typeParam = getPreference(PORTAL_SITE_MANAGER_INIT_NODE_TYPE_PARAM); if (typeParam == null) { typeParam = getInitParam(PORTAL_SITE_MANAGER_INIT_NODE_TYPE_PARAM); } } if (typeParam != null) { type = typeParam; } PageManager pageManager = getServiceLocator().getPageManager(); DefaultMutableTreeNode treeRootNode = null; try { if (PAGE_NODE_TYPE.equals(type)) { Page page = pageManager.getPage(pathParam); siteTreeNode = new SiteTreeNode(page.getName(), page.getPath(), SiteTreeNode.FileType.Page, true); treeRootNode = new DefaultMutableTreeNode(new SiteTreeNode(page)); } else if (FOLDER_NODE_TYPE.equals(type)) { Folder folder = pageManager.getFolder(pathParam); siteTreeNode = new SiteTreeNode(folder.getName(), folder.getPath(), SiteTreeNode.FileType.Folder, true); treeRootNode = new DefaultMutableTreeNode(new SiteTreeNode(folder, true)); } else if (LINK_NODE_TYPE.equals(type)) { Link link = pageManager.getLink(pathParam); siteTreeNode = new SiteTreeNode(link.getName(), link.getPath(), SiteTreeNode.FileType.Link, true); treeRootNode = new DefaultMutableTreeNode(new SiteTreeNode(link)); } } catch (Exception e) { log.error("Failed to retrieve the init site tree node on " + pathParam, e); } if (treeRootNode != null) { treeRoot = new DefaultTreeModel(treeRootNode); } } if (siteTreeNode == null) { siteTreeNode = new SiteTreeNode("ROOT", "/", SiteTreeNode.FileType.Folder, true); } return siteTreeNode; }
From source file:org.apache.jmeter.visualizers.ViewResultsFullVisualizer.java
private synchronized Component createLeftPanel() { SampleResult rootSampleResult = new SampleResult(); rootSampleResult.setSampleLabel("Root"); rootSampleResult.setSuccessful(true); root = new SearchableTreeNode(rootSampleResult, null); treeModel = new DefaultTreeModel(root); jTree = new JTree(treeModel); jTree.setCellRenderer(new ResultsNodeRenderer()); jTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); jTree.addTreeSelectionListener(this); jTree.setRootVisible(false);/* w ww.j av a 2 s .co m*/ jTree.setShowsRootHandles(true); JScrollPane treePane = new JScrollPane(jTree); treePane.setPreferredSize(new Dimension(200, 300)); VerticalPanel leftPane = new VerticalPanel(); leftPane.add(treePane, BorderLayout.CENTER); leftPane.add(createComboRender(), BorderLayout.NORTH); autoScrollCB = new JCheckBox(JMeterUtils.getResString("view_results_autoscroll")); // $NON-NLS-1$ autoScrollCB.setSelected(false); autoScrollCB.addItemListener(this); leftPane.add(autoScrollCB, BorderLayout.SOUTH); return leftPane; }
From source file:org.artifactory.webapp.wicket.actionable.tree.ActionableItemsTree.java
@Override public void setCompactAllowed(boolean compactAllowed) { HierarchicActionableItem root = this.itemsProvider.getRoot(); if (root != null) { root.setCompactAllowed(compactAllowed); }//from w w w. j a v a2 s . c o m ActionableItemTreeNode rootNode = new ActionableItemTreeNode(root); DefaultTreeModel treeModel = new DefaultTreeModel(rootNode); setDefaultModel(new Model<>(treeModel)); List<? extends ActionableItem> children = this.itemsProvider.getChildren(root); setChildren(rootNode, children); getTreeState().expandNode(rootNode); if (rootNode.getChildCount() > 0) { selectNode(rootNode.getFirstChild()); } }