Search in sources :

Example 1 with TreeTableModelAdapter

use of org.mozilla.javascript.tools.debugger.treetable.TreeTableModelAdapter in project hackpad by dropbox.

the class RunProxy method resetTree.

/**
     * Initializes a tree for this tree table.
     */
public JTree resetTree(TreeTableModel treeTableModel) {
    tree = new TreeTableCellRenderer(treeTableModel);
    // Install a tableModel representing the visible rows in the tree.
    super.setModel(new TreeTableModelAdapter(treeTableModel, tree));
    // Force the JTable and JTree to share their row selection models.
    ListToTreeSelectionModelWrapper selectionWrapper = new ListToTreeSelectionModelWrapper();
    tree.setSelectionModel(selectionWrapper);
    setSelectionModel(selectionWrapper.getListSelectionModel());
    // Make the tree and table row heights the same.
    if (tree.getRowHeight() < 1) {
        // Metal looks better like this.
        setRowHeight(18);
    }
    // Install the tree editor renderer and editor.
    setDefaultRenderer(TreeTableModel.class, tree);
    setDefaultEditor(TreeTableModel.class, new TreeTableCellEditor());
    setShowGrid(true);
    setIntercellSpacing(new Dimension(1, 1));
    tree.setRootVisible(false);
    tree.setShowsRootHandles(true);
    DefaultTreeCellRenderer r = (DefaultTreeCellRenderer) tree.getCellRenderer();
    r.setOpenIcon(null);
    r.setClosedIcon(null);
    r.setLeafIcon(null);
    return tree;
}
Also used : Dimension(java.awt.Dimension) DefaultTreeCellRenderer(javax.swing.tree.DefaultTreeCellRenderer) TreeTableModelAdapter(org.mozilla.javascript.tools.debugger.treetable.TreeTableModelAdapter)

Aggregations

Dimension (java.awt.Dimension)1 DefaultTreeCellRenderer (javax.swing.tree.DefaultTreeCellRenderer)1 TreeTableModelAdapter (org.mozilla.javascript.tools.debugger.treetable.TreeTableModelAdapter)1