de.kupzog.ktable.renderers
Class ImgCellRenderer

java.lang.Object
  extended by de.kupzog.ktable.renderers.DefaultCellRenderer
      extended by de.kupzog.ktable.renderers.ImgCellRenderer
All Implemented Interfaces:
KTableCellRenderer

public class ImgCellRenderer
extends DefaultCellRenderer

Author:
Lorenz Maierhofer

Field Summary
static java.lang.String IMG_ERR
           
static java.lang.String IMG_OK
           
static java.lang.String IMG_WARNING
           
static org.eclipse.jface.resource.ImageRegistry imgReg
           
 
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, m_alignment, m_bgColor, m_Display, m_fgColor, m_FixedRenderer, m_Style, m_TextRenderer, STYLE_FLAT, STYLE_PUSH
 
Fields inherited from interface de.kupzog.ktable.KTableCellRenderer
defaultRenderer
 
Constructor Summary
ImgCellRenderer(int 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)
          Draws icons that signal ok or not ok.
protected  org.eclipse.swt.graphics.Image getImageForContent(java.lang.Object content)
           
 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 de.kupzog.ktable.renderers.DefaultCellRenderer
drawCellContent, drawCommentSign, drawDefaultSolidCellLine, drawVerticalCellContent, getAlignment, getBackground, getForeground, getStyle, setAlignment, setBackground, setDefaultBackground, setDefaultForeground, setForeground, setStyle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imgReg

public static final org.eclipse.jface.resource.ImageRegistry imgReg

IMG_OK

public static final java.lang.String IMG_OK
See Also:
Constant Field Values

IMG_ERR

public static final java.lang.String IMG_ERR
See Also:
Constant Field Values

IMG_WARNING

public static final java.lang.String IMG_WARNING
See Also:
Constant Field Values
Constructor Detail

ImgCellRenderer

public ImgCellRenderer(int style)
Parameters:
style -
Method Detail

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
Overrides:
getOptimalWidth in class DefaultCellRenderer
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)
Draws icons that signal ok or not ok.

Specified by:
drawCell in interface KTableCellRenderer
Overrides:
drawCell in class DefaultCellRenderer
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)

getImageForContent

protected org.eclipse.swt.graphics.Image getImageForContent(java.lang.Object content)
Parameters:
content -
Returns: