JIDE 3.5.15

com.jidesoft.grid
Class SortableTableHeaderCellDecorator

java.lang.Object
  extended by com.jidesoft.grid.SortableTableHeaderCellDecorator
All Implemented Interfaces:
TableHeaderCellDecorator

public class SortableTableHeaderCellDecorator
extends Object
implements TableHeaderCellDecorator

This class is to paint sort icon and sort index.

Since:
3.1.0

Nested Class Summary
protected  class SortableTableHeaderCellDecorator.SortInfo
          Sort information of a particular column.
 
Constructor Summary
SortableTableHeaderCellDecorator()
           
 
Method Summary
protected  TableCellRenderer getHeaderRenderer(JTableHeader header, int columnIndex)
           
 Insets getInsets(Graphics g, JTableHeader header, int columnIndex, Rectangle cellRect)
          Gets the margin insets where this cell decorator will paint in.
protected  SortableTableHeaderCellDecorator.SortInfo getSortInfo(JTableHeader header, int columnIndex)
          Gets the sort information of the specified column.
 void paint(Graphics g, JTableHeader header, int columnIndex, Rectangle cellRect, boolean mouseOverPaintArea)
          Paints the table header cell.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SortableTableHeaderCellDecorator

public SortableTableHeaderCellDecorator()
Method Detail

getHeaderRenderer

protected TableCellRenderer getHeaderRenderer(JTableHeader header,
                                              int columnIndex)

getInsets

public Insets getInsets(Graphics g,
                        JTableHeader header,
                        int columnIndex,
                        Rectangle cellRect)
Description copied from interface: TableHeaderCellDecorator
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.

Specified by:
getInsets in interface TableHeaderCellDecorator
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

public void paint(Graphics g,
                  JTableHeader header,
                  int columnIndex,
                  Rectangle cellRect,
                  boolean mouseOverPaintArea)
Description copied from interface: TableHeaderCellDecorator
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 TableHeaderCellDecorator.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.

Specified by:
paint in interface TableHeaderCellDecorator
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

getSortInfo

protected SortableTableHeaderCellDecorator.SortInfo getSortInfo(JTableHeader header,
                                                                int columnIndex)
Gets the sort information of the specified column.

Parameters:
header - the header
columnIndex - the column index
Returns:
SortInfo.

JIDE 3.5.15