de.kupzog.ktable.renderers
Class BarDiagramCellRenderer
java.lang.Object
de.kupzog.ktable.renderers.DefaultCellRenderer
de.kupzog.ktable.renderers.BarDiagramCellRenderer
- All Implemented Interfaces:
- KTableCellRenderer
public class BarDiagramCellRenderer
- extends DefaultCellRenderer
- Author:
- Lorenz Maierhofer
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)
A default implementation that paints cells in a way that is more or less
Excel-like. |
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 |
getAlignment, getBackground, 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 |
BarDiagramCellRenderer
public BarDiagramCellRenderer(int style)
- Parameters:
style
- The style bits to use.
Currently supported are:
- INDICATION_FOCUS
- INDICATION_FOCUS_ROW
- INDICATION_GRADIENT
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)
- Description copied from class:
DefaultCellRenderer
- A default implementation that paints cells in a way that is more or less
Excel-like. Only the cell with focus looks very different.
- Specified by:
drawCell
in interface KTableCellRenderer
- Overrides:
drawCell
in class DefaultCellRenderer
- Parameters:
content
- The content is expected to be a Float value between 0 and 1 that represents
the fraction of the cell width that should be used for the bar.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 rowfocus
- 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)