de.kupzog.ktable.renderers
Class FixedCheckableCellRenderer

java.lang.Object
  extended by de.kupzog.ktable.renderers.DefaultCellRenderer
      extended by de.kupzog.ktable.renderers.CheckableCellRenderer
          extended by 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

Field Summary
static org.eclipse.swt.graphics.Color COLOR_FIXEDBACKGROUND
           
static org.eclipse.swt.graphics.Image IMAGE_ARROWDOWN
          Small arrow pointing down.
static org.eclipse.swt.graphics.Image IMAGE_ARROWUP
          Small arrow pointing up.
 
Fields inherited from class de.kupzog.ktable.renderers.CheckableCellRenderer
BORDER_DARK, BORDER_LIGHT, COLOR_FILL, IMAGE_CHECKED, IMAGE_CHECKED_CLICKED, IMAGE_UNCHECKED, IMAGE_UNCHECKED_CLICKED, SIGN_CHECK, SIGN_IMAGE, SIGN_X
 
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
 
Fields inherited from interface de.kupzog.ktable.KTableCellRenderer
defaultRenderer
 
Constructor Summary
FixedCheckableCellRenderer(int style)
          A constructor that lets the caller specify the style.
 
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.CheckableCellRenderer
getOptimalWidth, setCommentIndication
 
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
 

Field Detail

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
Constructor Detail

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.

Method Detail

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 on
rect - The coordinates and size of the cell (add 1 to width and hight to include the borders)
col - The column
row - The row
content - The content of the cell (as given by the table model)
focus - True if the cell is selected
fixed - 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.