Class JXTreeTable.TreeTableCellRenderer

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable, TableCellRenderer
Enclosing class:
JXTreeTable

public static class JXTreeTable.TreeTableCellRenderer extends JXTree implements TableCellRenderer
See Also:
  • Field Details

    • highlightBorder

      protected Border highlightBorder
      Border to draw around the tree, if this is non-null, it will be painted.
    • treeTable

      protected JXTreeTable treeTable
    • visibleRow

      protected int visibleRow
  • Constructor Details

    • TreeTableCellRenderer

      public TreeTableCellRenderer(TreeTableModel model)
  • Method Details

    • setRolloverEnabled

      public void setRolloverEnabled(boolean rolloverEnabled)
      Description copied from class: JXTree
      Sets the property to enable/disable rollover support. If enabled, the tree fires property changes on per-cell mouse rollover state, i.e. when the mouse enters/leaves a tree cell.

      This can be enabled to show "live" rollover behaviour, f.i. the cursor over a cell rendered by a JXHyperlink.

      The default value is false.

      Overrides:
      setRolloverEnabled in class JXTree
      Parameters:
      rolloverEnabled - a boolean indicating whether or not the rollover functionality should be enabled.
      See Also:
    • addPropertyChangeListener

      public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
      Overrides:
      addPropertyChangeListener in class Container
    • isVisible

      public boolean isVisible()

      Overridden to hack around #766-swingx: cursor flickering in DnD when dragging over tree column. This is a core bug (#6700748) related to painting the rendering component on a CellRendererPane. A trick around is to let this return false.

      This implementation applies the trick, that is returns false always. The hack can be disabled by setting the treeTable's client property DROP_HACK_FLAG_KEY to Boolean.FALSE.

      Overrides:
      isVisible in class Component
    • shouldApplyDropHack

      protected boolean shouldApplyDropHack()
      Returns a boolean indicating whether the drop hack should be applied.
      Returns:
      a boolean indicating whether the drop hack should be applied.
    • setToolTipText

      public void setToolTipText(String text)

      Overridden to not automatically de/register itself from/to the ToolTipManager. As rendering component it is not considered to be active in any way, so the manager must not listen.

      Overrides:
      setToolTipText in class JComponent
    • bind

      public final void bind(JXTreeTable treeTable)
      Immutably binds this TreeTableModelAdapter to the specified JXTreeTable. For internal use by JXTreeTable only.
      Parameters:
      treeTable - the JXTreeTable instance that this renderer is bound to
    • createRolloverProducer

      protected RolloverProducer createRolloverProducer()
      Description copied from class: JXTree
      Creates and returns the RolloverProducer to use with this tree.

      Overrides:
      createRolloverProducer in class JXTree
      Returns:
      RolloverProducer to use with this tree
      See Also:
    • scrollRectToVisible

      public void scrollRectToVisible(Rectangle aRect)
      Overrides:
      scrollRectToVisible in class JComponent
    • setExpandedState

      protected void setExpandedState(TreePath path, boolean state)
      Overrides:
      setExpandedState in class JTree
    • updateUI

      public void updateUI()
      updateUI is overridden to set the colors of the Tree's renderer to match that of the table.
      Overrides:
      updateUI in class JXTree
    • setRowHeight

      public void setRowHeight(int rowHeight)
      Sets the row height of the tree, and forwards the row height to the table.
      Overrides:
      setRowHeight in class JTree
    • setBounds

      public void setBounds(int x, int y, int w, int h)
      This is overridden to set the location to (0, 0) and set the dimension to exactly fill the bounds of the hierarchical column.

      Overrides:
      setBounds in class Component
    • paint

      public void paint(Graphics g)
      Sublcassed to translate the graphics such that the last visible row will be drawn at 0,0.
      Overrides:
      paint in class JComponent
    • setBorder

      public void setBorder(Border border)

      Overridden to fix #swingx-1525: BorderHighlighter fills tree column.

      Basically, the reason was that the border is set on the tree as a whole instead of on the cell level. The fix is to bypass super completely, keep a reference to the cell border and manually paint it around the cell in the overridden paint.

      Note: in the paint we need to paint either the focus border or the cellBorder, the former taking precedence.

      Overrides:
      setBorder in class JComponent
    • doClick

      public void doClick()
    • isRowSelected

      public boolean isRowSelected(int row)
      Overrides:
      isRowSelected in class JTree
    • getTableCellRendererComponent

      public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
      Specified by:
      getTableCellRendererComponent in interface TableCellRenderer