Class TreeTable

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

public final class TreeTable extends JTable
This example shows how to create a simple TreeTable component, by using a JTree as a renderer (and editor) for the cells in a particular column in the JTable. Original Source Location
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      A unique serial version identifier.
      See Also:
    • tree

      private final TreeTableCellRenderer tree
      A subclass of JTree.
    • editor

      private JTextArea editor
      JTextArea editor.
    • xpathEditor

      private JTextArea xpathEditor
      JTextArea xpathEditor.
    • linePositionList

      private List<Integer> linePositionList
      Line position map.
  • Constructor Details

    • TreeTable

      public TreeTable(ParseTreeTableModel treeTableModel)
      Creates TreeTable base on TreeTableModel.
      Parameters:
      treeTableModel - Tree table model
  • Method Details

    • expandSelectedNode

      private void expandSelectedNode()
      Do expansion of a tree node.
    • makeCodeSelection

      private void makeCodeSelection()
      Make selection of code in a text area.
    • generateXpath

      private void generateXpath()
      Generate Xpath.
    • setColumnsInitialWidth

      private void setColumnsInitialWidth()
      Set initial value of width for columns in table.
    • search

      private static boolean search(DetailAST root, String xpath, Deque<DetailAST> nodes)
      Search node by Xpath.
      Parameters:
      root - DetailAST root ast element
      xpath - String xpath query
      nodes - Deque<DetailAST> stack of nodes in selection path
      Returns:
      boolean node found or not
    • selectNodeByXpath

      public void selectNodeByXpath()
      Select Node by Xpath.
    • updateUI

      public void updateUI()
      Overridden to message super and forward the method to the tree. Since the tree is not actually in the component hierarchy it will never receive this unless we forward it in this manner.
      Overrides:
      updateUI in class JTable
    • getEditingRow

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

      public void setRowHeight(int newRowHeight)
      Overridden to pass the new rowHeight to the tree.
      Overrides:
      setRowHeight in class JTable
    • getTree

      public JTree getTree()
      Returns tree.
      Returns:
      the tree that is being shared between the model.
    • setEditor

      public void setEditor(JTextArea textArea)
      Sets text area editor.
      Parameters:
      textArea - JTextArea component.
    • setXpathEditor

      public void setXpathEditor(JTextArea xpathTextArea)
      Sets text area xpathEditor.
      Parameters:
      xpathTextArea - JTextArea component.
    • setLinePositionList

      public void setLinePositionList(List<Integer> linePositionList)
      Sets line position list.
      Parameters:
      linePositionList - Line position list.