JIDE 3.5.15

com.jidesoft.grid
Interface TableHeaderCellDecorator

All Known Implementing Classes:
FilterableTableHeaderCellDecorator, SortableTableHeaderCellDecorator

public interface TableHeaderCellDecorator

TableHeaderCellDecorator provides a way for users to paint over the margin of any table header's cells. You can use it on any table headers that is a SortableTableHeader. You just need to CellStyleTableHeader.addCellDecorator(TableHeaderCellDecorator) to add your own cell decorator. The added order of the cell decorator matters. The first cell decorator that is added will paint first. Because each cell decorator will reserve a margin from the cell rect for its painting, the next cell decorator will get a smaller cell rect.

In releases later than 3.1.0, JIDE paints the sort and filter icon via this approach as well.

Since:
3.1.0

Method Summary
 Insets getInsets(Graphics g, JTableHeader header, int columnIndex, Rectangle cellRect)
          Gets the margin insets where this cell decorator will paint in.
 void paint(Graphics g, JTableHeader header, int columnIndex, Rectangle cellRect, boolean mouseOverPaintArea)
          Paints the table header cell.
 

Method Detail

getInsets

Insets getInsets(Graphics g,
                 JTableHeader header,
                 int columnIndex,
                 Rectangle cellRect)
Gets the margin insets where this cell decorator will paint in. Even though the table header could be in RTL or LTR orientation, we require you return the insets as in LTR orientation and we will properly adjust it based on the actual table header orientation.

Parameters:
g - the Graphics instance
header - the table header
columnIndex - the view column index to be painted
cellRect - the original cell rectangle for the column
Returns:
the margin area so the original header cell will not paint over this margin. Null if you don't need to restrict the painting of original header.

paint

void paint(Graphics g,
           JTableHeader header,
           int columnIndex,
           Rectangle cellRect,
           boolean mouseOverPaintArea)
Paints the table header cell. This paint method will be called after the original table header cell is painted. Theoretically, you can paint whatever you want but in most cases, you probably want to make sure the painting code is consistent with insets returned from getInsets(java.awt.Graphics, javax.swing.table.JTableHeader, int, java.awt.Rectangle), i.e., paint only in the area as specified in the insets. You do need to consider both RTL and LTR orientations in your code when doing the painting.

Parameters:
g - the Graphics instance
header - the table header
columnIndex - the view column index to be painted
cellRect - the original cell rectangle for the column
mouseOverPaintArea - the flag indicating if the mouse is over the paint area of this cell decorator

JIDE 3.5.15