Search in sources :

Example 1 with PropTreeModel

use of net.sourceforge.processdash.hier.ui.PropTreeModel in project processdash by dtuma.

the class TimeLogEditor method constructTreePanel.

private JScrollPane constructTreePanel() {
    /* Create the JTreeModel. */
    treeModel = new PropTreeModel(new DefaultMutableTreeNode("root"), null);
    /* Create the tree. */
    tree = new JTree(treeModel);
    treeModel.fill(useProps);
    tree.expandRow(0);
    tree.setShowsRootHandles(true);
    tree.setEditable(false);
    tree.addTreeSelectionListener(this);
    tree.setRootVisible(false);
    // Make tree ask for the height of each row.
    tree.setRowHeight(-1);
    /* Put the Tree in a scroller. */
    JScrollPane scrollPane = new JScrollPane(tree, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    scrollPane.setPreferredSize(new Dimension(300, 300));
    return scrollPane;
}
Also used : JScrollPane(javax.swing.JScrollPane) JTree(javax.swing.JTree) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) PropTreeModel(net.sourceforge.processdash.hier.ui.PropTreeModel) Dimension(java.awt.Dimension)

Example 2 with PropTreeModel

use of net.sourceforge.processdash.hier.ui.PropTreeModel in project processdash by dtuma.

the class TeamProjectBrowser method buildTree.

private void buildTree() {
    treeModel = new PropTreeModel(new DefaultMutableTreeNode("root"), null);
    tree = new JTree(treeModel);
    reloadHierarchy();
    tree.setEditable(false);
    tree.setRootVisible(false);
    tree.setShowsRootHandles(true);
    tree.setExpandsSelectedPaths(true);
    tree.setCellRenderer(new ProjectTreeCellRenderer());
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.addTreeSelectionListener(handler);
    filterReloadIndicator = new JProgressBar();
    filterReloadIndicator.setIndeterminate(true);
    filterReloadIndicator.setVisible(false);
    ToolTipTimingCustomizer.INSTANCE.install(filterReloadIndicator);
    JPanel leftPanel = new JPanel(new BorderLayout());
    leftPanel.add(new JScrollPane(tree), BorderLayout.CENTER);
    leftPanel.add(filterReloadIndicator, BorderLayout.SOUTH);
    setLeftComponent(leftPanel);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JTree(javax.swing.JTree) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) BorderLayout(java.awt.BorderLayout) JProgressBar(javax.swing.JProgressBar) PropTreeModel(net.sourceforge.processdash.hier.ui.PropTreeModel)

Aggregations

JScrollPane (javax.swing.JScrollPane)2 JTree (javax.swing.JTree)2 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 PropTreeModel (net.sourceforge.processdash.hier.ui.PropTreeModel)2 BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 JPanel (javax.swing.JPanel)1 JProgressBar (javax.swing.JProgressBar)1