de.kupzog.examples
Class TownExampleRenderer
java.lang.Object
de.kupzog.examples.TownExampleRenderer
- All Implemented Interfaces:
- KTableCellRenderer
public class TownExampleRenderer
- extends java.lang.Object
- implements 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 fixed,
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) |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TownExampleRenderer
public TownExampleRenderer()
getOptimalWidth
public int getOptimalWidth(org.eclipse.swt.graphics.GC gc,
int col,
int row,
java.lang.Object content,
boolean fixed,
KTableModel model)
- Description copied from interface:
KTableCellRenderer
- Returns the optimal width of the given cell (used by column resizing)
- Specified by:
getOptimalWidth
in interface KTableCellRenderer
- Returns:
- int
drawCell
public 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 fixed,
boolean clicked,
KTableModel model)
- Description copied from interface:
KTableCellRenderer
- 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.
- Specified by:
drawCell
in interface KTableCellRenderer
- 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 selectedfixed
- 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.