de.kupzog.ktable
Interface KTableCellRenderer
- All Known Implementing Classes:
- BarDiagramCellRenderer, CheckableCellRenderer, DefaultCellRenderer, FixedCellRenderer, FixedCheckableCellRenderer, FixedVerticalCellRenderer, PaletteExampleRenderer, TextCellRenderer, TownExampleRenderer
public interface KTableCellRenderer
- Author:
- Friederich Kupzog
Method Summary |
void |
drawCell(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle rect,
int col,
int row,
java.lang.Object content,
boolean focus,
boolean header,
boolean clicked,
KTableModel model)
This method is called from KTable to draw a table cell. |
int |
getOptimalWidth(org.eclipse.swt.graphics.GC gc,
int col,
int row,
java.lang.Object content,
boolean fixed,
KTableModel model)
Returns the optimal width of the given cell (used by column resizing) |
defaultRenderer
static final KTableCellRenderer defaultRenderer
getOptimalWidth
int getOptimalWidth(org.eclipse.swt.graphics.GC gc,
int col,
int row,
java.lang.Object content,
boolean fixed,
KTableModel model)
- Returns the optimal width of the given cell (used by column resizing)
- Parameters:
col
- row
- content
- fixed
-
- Returns:
- int
drawCell
void drawCell(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle rect,
int col,
int row,
java.lang.Object content,
boolean focus,
boolean header,
boolean clicked,
KTableModel model)
- This method is called from KTable to draw a table cell.
Note that there are several helper methods that can do specified things
for you.
- Parameters:
gc
- The gc to draw onrect
- The coordinates and size of the cell (add 1 to width and hight
to include the borders)col
- The columnrow
- The rowcontent
- The content of the cell (as given by the table model)focus
- True if the cell is selectedheader
- True if the cell is an unscrollable header cell (not an unscrollable body cell!)clicked
- True if the cell is currently clicked (useful e.g. to paint a
pressed button)
the case when fixed row and column elements should be highlighted because a cell in that
row and column has focus.model
- The KTableModel that holds the data for the cell. Note that this is only included
into the parameter list to allow more flexible cell renderers. Models might provide additional
information that can be requested when rendering.