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

  • 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.
    • selectNodeByXpath

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

      private void updateTreeTable(String xpath, Deque<DetailAST> nodes)
      Updates the Treetable by expanding paths in the tree and highlighting associated code.
      Parameters:
      xpath - the XPath query to show in case of no match
      nodes - the deque of DetailAST nodes to match in TreeTable and XPath editor
    • expandTreeTableByPath

      private void expandTreeTableByPath(DetailAST node)
      Expands path in tree table to given node so that user can see the node.
      Parameters:
      node - node to expand table by
    • getAllMatchingXpathQueriesText

      Generates a String with all matching XPath queries separated by newlines.
      Parameters:
      nodes - deque of nodes to generate queries for
      Returns:
      complete text of all XPath expressions separated by newlines.
    • 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(Collection<Integer> linePositionList)
      Sets line positions.
      Parameters:
      linePositionList - positions of lines.