de.kupzog.ktable.renderers
Class FixedCheckableCellRenderer
java.lang.Object
de.kupzog.ktable.renderers.DefaultCellRenderer
de.kupzog.ktable.renderers.CheckableCellRenderer
de.kupzog.ktable.renderers.FixedCheckableCellRenderer
- All Implemented Interfaces:
- KTableCellRenderer
public class FixedCheckableCellRenderer
- extends CheckableCellRenderer
Renderer that paints cells as fixed (respecting all the flags used in
FixedCellRenderer
). Instead of painting text and images,
it paings checked/unchecked signs representing boolean values.
- Author:
- Lorenz Maierhofer
- See Also:
FixedCellRenderer
Fields inherited from class de.kupzog.ktable.renderers.DefaultCellRenderer |
COLOR_BACKGROUND, COLOR_BGFOCUS, COLOR_BGROWFOCUS, COLOR_COMMENTSIGN, COLOR_FGROWFOCUS, COLOR_FIXEDHIGHLIGHT, COLOR_LINE_DARKGRAY, COLOR_LINE_LIGHTGRAY, COLOR_TEXT, INDICATION_CLICKED, INDICATION_COMMENT, INDICATION_FOCUS, INDICATION_FOCUS_ROW, INDICATION_GRADIENT, INDICATION_SORT, STYLE_FLAT, STYLE_PUSH |
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)
Paint a box with or without a checked symbol. |
org.eclipse.swt.graphics.Color |
getBackground()
|
Methods inherited from class de.kupzog.ktable.renderers.DefaultCellRenderer |
getAlignment, getFont, getForeground, getStyle, setAlignment, setBackground, setDefaultBackground, setDefaultForeground, setFont, setForeground, setStyle |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IMAGE_ARROWDOWN
public static final org.eclipse.swt.graphics.Image IMAGE_ARROWDOWN
- Small arrow pointing down. Can be used when displaying a sorting indicator.
IMAGE_ARROWUP
public static final org.eclipse.swt.graphics.Image IMAGE_ARROWUP
- Small arrow pointing up. Can be used when displaying a sorting indicator
COLOR_FIXEDBACKGROUND
public static final org.eclipse.swt.graphics.Color COLOR_FIXEDBACKGROUND
FixedCheckableCellRenderer
public FixedCheckableCellRenderer(int style)
- A constructor that lets the caller specify the style.
- Parameters:
style
- The style that should be used to paint.
- Use SWT.FLAT for a flat look.
- Use SWT.PUSH for a button-like look. (default)
The following additional indications can be activated:
- INDICATION_FOCUS changes the background color if the fixed cell has focus.
- INDICATION_FOCUS_ROW changes the background color so that it machtes with normal cells in rowselection mode.
- INDICATION_SORT shows the sort direction when using a KTableSortedModel.
- INDICATION_CLICKED shows a click feedback, if STYLE_PUSH is specified.
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)
- Paint a box with or without a checked symbol.
- Specified by:
drawCell
in interface KTableCellRenderer
- Overrides:
drawCell
in class CheckableCellRenderer
- 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.- See Also:
KTableCellRenderer.drawCell(GC, Rectangle, int, int, Object, boolean, boolean, boolean, KTableModel)
getBackground
public org.eclipse.swt.graphics.Color getBackground()
- Overrides:
getBackground
in class DefaultCellRenderer
- Returns:
- returns the currently set background color.
If none was set, the default value is returned.