|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.kupzog.ktable.renderers.DefaultCellRenderer
public class DefaultCellRenderer
Class that provides additional facilities commonly used when writing custom renderers.
Field Summary | |
---|---|
org.eclipse.swt.graphics.Color |
COLOR_BACKGROUND
|
static org.eclipse.swt.graphics.Color |
COLOR_BGFOCUS
|
static org.eclipse.swt.graphics.Color |
COLOR_BGROWFOCUS
|
static org.eclipse.swt.graphics.Color |
COLOR_COMMENTSIGN
|
static org.eclipse.swt.graphics.Color |
COLOR_FGROWFOCUS
|
static org.eclipse.swt.graphics.Color |
COLOR_FIXEDHIGHLIGHT
|
static org.eclipse.swt.graphics.Color |
COLOR_LINE_DARKGRAY
|
static org.eclipse.swt.graphics.Color |
COLOR_LINE_LIGHTGRAY
|
org.eclipse.swt.graphics.Color |
COLOR_TEXT
|
static int |
INDICATION_CLICKED
Make the header column show a button-pressed behavior when clicked. |
static int |
INDICATION_COMMENT
Draws a little triangle in the upper right corner of the cell as an indication that additional information is available. |
static int |
INDICATION_FOCUS
Color fixed cells with focus in a different color. |
static int |
INDICATION_FOCUS_ROW
Color fixed cells with focus in a different color. |
static int |
INDICATION_GRADIENT
Draws a gradient in the figure representing the cell content. |
static int |
INDICATION_SORT
Shows a sort indicator in the fixed cell if sorting is active for the column. |
static int |
STYLE_FLAT
Makes a flat looking cell. |
static int |
STYLE_PUSH
Makes a button-like cell. |
Fields inherited from interface de.kupzog.ktable.KTableCellRenderer |
---|
defaultRenderer |
Constructor Summary | |
---|---|
DefaultCellRenderer(int style)
The constructor that sets the style bits given. |
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 |
getAlignment()
|
org.eclipse.swt.graphics.Color |
getBackground()
|
org.eclipse.swt.graphics.Font |
getFont()
|
org.eclipse.swt.graphics.Color |
getForeground()
|
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) |
int |
getStyle()
|
void |
setAlignment(int style)
Sets the alignment of the cell content. |
void |
setBackground(org.eclipse.swt.graphics.Color bgcolor)
Set the background color that should be used when painting the cell background. |
void |
setDefaultBackground(org.eclipse.swt.graphics.Color bgcolor)
Changes the default background color that will be used when no background color is set via setBackground(). |
void |
setDefaultForeground(org.eclipse.swt.graphics.Color fgcolor)
Changes the default foreground color that will be used when no other foreground color is set. |
void |
setFont(org.eclipse.swt.graphics.Font font)
Sets the font the renderer will use for drawing its content. |
void |
setForeground(org.eclipse.swt.graphics.Color fgcolor)
Set the foreground color used to paint text et al. |
void |
setStyle(int style)
Overwrites the style bits with the given one. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public org.eclipse.swt.graphics.Color COLOR_TEXT
public org.eclipse.swt.graphics.Color COLOR_BACKGROUND
public static final org.eclipse.swt.graphics.Color COLOR_LINE_LIGHTGRAY
public static final org.eclipse.swt.graphics.Color COLOR_LINE_DARKGRAY
public static final org.eclipse.swt.graphics.Color COLOR_BGFOCUS
public static final org.eclipse.swt.graphics.Color COLOR_COMMENTSIGN
public static final org.eclipse.swt.graphics.Color COLOR_FIXEDHIGHLIGHT
public static final org.eclipse.swt.graphics.Color COLOR_BGROWFOCUS
public static final org.eclipse.swt.graphics.Color COLOR_FGROWFOCUS
public static final int STYLE_PUSH
Used in:
- FixedCellRenderer
public static final int STYLE_FLAT
Used in:
- FixedCellRenderer
public static final int INDICATION_SORT
Has only an effect if the tablemodel is an instanceof KTableSortModel.
Used in:
- FixedCellRenderer
public static final int INDICATION_FOCUS
Has only an effect on fixed cells when
KTable.setHighlightSelectionInHeader(true)
was set.
Used in:
- CheckableCellRenderer
- FixedCellRenderer
- TextCellRenderer
public static final int INDICATION_FOCUS_ROW
Has only an effect when KTable.setHighlightSelectionInHeader(true)
was set.
Used in:
- CheckableCellRenderer
- FixedCellRenderer
- TextCellRenderer
public static final int INDICATION_CLICKED
Used in:
- FixedCellRenderer (Has only an effect when STYLE_PUSH is set.)
- CheckableCellRenderer
public static final int INDICATION_COMMENT
Used in:
- CheckableCellRenderer
- TextCellRenderer
public static final int INDICATION_GRADIENT
Constructor Detail |
---|
public DefaultCellRenderer(int style)
Method Detail |
---|
public void setStyle(int style)
style
- The styles to AND with the current style bits.for accessing the style bits.
public int getStyle()
public int getOptimalWidth(org.eclipse.swt.graphics.GC gc, int col, int row, java.lang.Object content, boolean fixed, KTableModel model)
KTableCellRenderer
getOptimalWidth
in interface KTableCellRenderer
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)
drawCell
in interface KTableCellRenderer
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.KTableCellRenderer.drawCell(GC, Rectangle, int, int, Object, boolean, boolean, boolean, KTableModel)
public void setAlignment(int style)
style
- The OR-ed alignment constants for
vertical and horizontal alignment as defined in
SWTX.SWTX.ALIGN_HORIZONTAL_CENTER
,
SWTX.ALIGN_HORIZONTAL_LEFT
,
SWTX.ALIGN_HORIZONTAL_RIGHT
,
SWTX.ALIGN_VERTICAL_CENTER
,
SWTX.ALIGN_VERTICAL_TOP
,
SWTX.ALIGN_VERTICAL_BOTTOM
public int getAlignment()
SWTX.ALIGN_HORIZONTAL_CENTER
,
SWTX.ALIGN_HORIZONTAL_LEFT
,
SWTX.ALIGN_HORIZONTAL_RIGHT
,
SWTX.ALIGN_VERTICAL_CENTER
,
SWTX.ALIGN_VERTICAL_TOP
,
SWTX.ALIGN_VERTICAL_BOTTOM
public void setForeground(org.eclipse.swt.graphics.Color fgcolor)
fgcolor
- The color or null
to
reset to default (black). Note that also the default color can be set using setDefaultForeground(Color)
setDefaultForeground(Color)
public void setDefaultForeground(org.eclipse.swt.graphics.Color fgcolor)
setForeground(null)
is called)
fgcolor
- The foreground color to use.setForeground(Color)
public void setBackground(org.eclipse.swt.graphics.Color bgcolor)
If the null
value is given, the default
color will be used. The default color is settable using
setDefaultBacktround(Color)
bgcolor
- The color or null
to
reset to default.setDefaultBackground(Color)
public void setDefaultBackground(org.eclipse.swt.graphics.Color bgcolor)
bgcolor
- The color for the background.setBackground(Color)
public org.eclipse.swt.graphics.Color getForeground()
public org.eclipse.swt.graphics.Color getBackground()
public void setFont(org.eclipse.swt.graphics.Font font)
font
- The font to use. Be aware that
you must dispose fonts you have created.public org.eclipse.swt.graphics.Font getFont()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |