Class TreeTable

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, CellEditorListener, ListSelectionListener, RowSorterListener, TableColumnModelListener, TableModelListener, Scrollable

public class TreeTable extends JTable
The TreeTable class provides a widget that is not native to the standard Swing UI library - the Tree Table. The realization of a tree-table widget is a JTable with a JTree inside of it. To the user, it looks like a multi- columned JTree.

Due to the complexity of the Swing interfaces, the TreeTable is not a straightforward implementation. It requires a JTable to have a custom cell renderer that is, in fact, a JTree. The JTree itself also has custom renderers to handle the display of the checkboxed nodes that typically are available on tree-table implementations. All of this needs to be backed with a back-end model representation of the likelihood detection module parameters, which completes the Swing's MVC implementation.

The TreeTable class is not meant to be a general-purpose component. In many ways it is written to be very specific to the job at hand. A more reusable TreeTable implementation would have been outside the effort available at the time of writing.
See Also:
  • Field Details Link icon

  • Constructor Details Link icon

    • TreeTable Link icon

      public TreeTable(TreeTableModel treeTableModel)
      Instantiates a new tree table.
      Parameters:
      treeTableModel - the tree table model
      See Also:
  • Method Details Link icon

    • setValueAt Link icon

      public void setValueAt(Object value, int row, int column)
      Overrides:
      setValueAt in class JTable
    • columnMarginChanged Link icon

      public void columnMarginChanged(ChangeEvent e)
      Specified by:
      columnMarginChanged in interface TableColumnModelListener
      Overrides:
      columnMarginChanged in class JTable
    • prepareRenderer Link icon

      public Component prepareRenderer(TableCellRenderer renderer, int row, int col)
      Overrides:
      prepareRenderer in class JTable
    • getToolTipText Link icon

      public String getToolTipText(MouseEvent e)
      Overrides:
      getToolTipText in class JTable
    • updateUI Link icon

      public void updateUI()
      Overridden to send a message to the super class then and forward the call to the internal tree renderer. Since the tree is not actually in the component hierarchy of the JTable (TreeTable) it will never receive this unless we forward it in this manner.
      Overrides:
      updateUI in class JTable
    • getEditingRow Link icon

      public int getEditingRow()
      Overrides:
      getEditingRow in class JTable
    • setRowHeight Link icon

      public void setRowHeight(int rowHeight)
      Overridden to pass the new rowHeight to the tree.
      Overrides:
      setRowHeight in class JTable
      Parameters:
      rowHeight - the row height
    • getTree Link icon

      public JTree getTree()
      Gets the tree.
      Returns:
      the tree
    • getCellRenderer Link icon

      public TableCellRenderer getCellRenderer(int row, int column)
      Overrides:
      getCellRenderer in class JTable
    • getCellEditor Link icon

      public TableCellEditor getCellEditor(int row, int column)
      Overrides:
      getCellEditor in class JTable
    • restoreExpanded Link icon

      public void restoreExpanded(String s)
      This method accepts a comma-delimited string returned from the preserveExpanded() method and attempts to change the internal JTree's expanded state to match it.
      Parameters:
      s - the s
      See Also:
      • preserveExpanded()