|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.jaret.util.ui.table.renderer.RendererBase
de.jaret.util.ui.table.renderer.CellRendererBase
public abstract class CellRendererBase
Base implementation for cell renderers that support both screen and printer rendering. This base implementation contains some useful methods so that it is highly recommended to base all renderer implementations on this base.
| Field Summary | |
|---|---|
protected int |
_inset
cell inset used by the convenience methods. |
protected static org.eclipse.swt.graphics.RGB |
BLACKRGB
default foreground color. |
protected static int |
FOCUSINSETS
insets used when drawing the focus. |
protected static org.eclipse.swt.graphics.Color |
SELECTIONCOLOR
selection color for overlay (non printing only). |
protected static org.eclipse.swt.graphics.RGB |
WHITERGB
default background color. |
| Fields inherited from class de.jaret.util.ui.table.renderer.RendererBase |
|---|
_printer, _scaleX, _scaleY, SCREEN_DPI_X, SCREEN_DPI_Y |
| Constructor Summary | |
|---|---|
CellRendererBase(org.eclipse.swt.printing.Printer printer)
May be constructed without printer (supplying null). |
|
| Method Summary | |
|---|---|
protected org.eclipse.swt.graphics.Rectangle |
applyInsets(org.eclipse.swt.graphics.Rectangle rect)
Calculate the resulting rectangle after applying the insets. |
protected void |
drawBackground(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle area,
ICellStyle style,
boolean selected,
boolean printing)
Draw the cell background. |
protected org.eclipse.swt.graphics.Rectangle |
drawBorder(org.eclipse.swt.graphics.GC gc,
ICellStyle cellStyle,
org.eclipse.swt.graphics.Rectangle drawingArea,
boolean printing)
Draw the border for the cell according to the cell style. |
protected void |
drawCommentMarker(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle area,
org.eclipse.swt.graphics.Color color,
int size)
Draw a marker in upper left corner for indicating a cell comment. |
protected void |
drawFocus(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle drawingArea)
Draw focus marking. |
protected void |
drawSelection(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle area,
ICellStyle style,
boolean selected,
boolean printing)
Draws a cell selection by overlaying alpha blended area using SELECTIONCOLOR. |
protected org.eclipse.swt.graphics.Color |
getBackgroundColor(ICellStyle style,
boolean printing)
Get the background color according to a cell style. |
protected org.eclipse.swt.graphics.Color |
getBorderColor(ICellStyle style,
boolean printing)
Get the border color according to the cell style. |
protected org.eclipse.swt.graphics.Font |
getFont(ICellStyle style,
boolean printing,
org.eclipse.swt.graphics.Font defaultFont)
Retrieve the font accrding to the cell style. |
protected org.eclipse.swt.graphics.Color |
getForegroundColor(ICellStyle style,
boolean printing)
Get the foreground color according to the cell style. |
protected int |
getInnerWidth(int width,
ICellStyle cellStyle)
Target inner width (width - borders - insets). |
int |
getPreferredHeight(org.eclipse.swt.graphics.GC gc,
ICellStyle cellStyle,
int width,
IRow row,
IColumn column)
Calculate the preferred height of a specific cell. |
int |
getPreferredWidth(java.util.List<IRow> rows,
IColumn column)
Calculate the preferred width for the column. |
java.lang.String |
getTooltip(JaretTable jaretTable,
org.eclipse.swt.graphics.Rectangle drawingArea,
IRow row,
IColumn column,
int x,
int y)
Provide a tooltip text for display. |
protected int |
getVerticalSpacesSum(ICellStyle cellStyle)
Calculate the sum of all vertical spaces that could be spplied. |
protected boolean |
isInCommentMarkerArea(org.eclipse.swt.graphics.Rectangle area,
int size,
int x,
int y)
Check whether a position is in the area of the commetn marker. |
| Methods inherited from class de.jaret.util.ui.table.renderer.RendererBase |
|---|
getPrinter, getScaleX, getScaleY, restoreGCAttributes, saveGCAttributes, scaleX, scaleY |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface de.jaret.util.ui.table.renderer.ICellRenderer |
|---|
createPrintRenderer, dispose, draw |
| Field Detail |
|---|
protected static final org.eclipse.swt.graphics.Color SELECTIONCOLOR
protected static final int FOCUSINSETS
protected static final org.eclipse.swt.graphics.RGB WHITERGB
protected static final org.eclipse.swt.graphics.RGB BLACKRGB
protected int _inset
| Constructor Detail |
|---|
public CellRendererBase(org.eclipse.swt.printing.Printer printer)
printer - or null| Method Detail |
|---|
public int getPreferredWidth(java.util.List<IRow> rows,
IColumn column)
getPreferredWidth in interface ICellRendererrows - the rows currently displayed by the tablecolumn - the column for which the preferred width is to be calculated
public int getPreferredHeight(org.eclipse.swt.graphics.GC gc,
ICellStyle cellStyle,
int width,
IRow row,
IColumn column)
getPreferredHeight in interface ICellRenderergc - GC that will usedcellStyle - cell style of the cellwidth - width of the column (thus of the cell)row - rowcolumn - column
public java.lang.String getTooltip(JaretTable jaretTable,
org.eclipse.swt.graphics.Rectangle drawingArea,
IRow row,
IColumn column,
int x,
int y)
getTooltip in interface ICellRendererjaretTable - table that is askingdrawingArea - area of the cell renderingrow - rowcolumn - columnx - mouse x coordinate (absolute within drawing area)y - mouse y coordinate (abs within drawing area)
null if no tooltip is to be shown
protected int getInnerWidth(int width,
ICellStyle cellStyle)
width - widthcellStyle - cell style
protected int getVerticalSpacesSum(ICellStyle cellStyle)
cellStyle - cell style
protected void drawFocus(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle drawingArea)
gc - GCdrawingArea - corrected drawing areaprotected org.eclipse.swt.graphics.Rectangle applyInsets(org.eclipse.swt.graphics.Rectangle rect)
rect - cell drawing area
protected org.eclipse.swt.graphics.Rectangle drawBorder(org.eclipse.swt.graphics.GC gc,
ICellStyle cellStyle,
org.eclipse.swt.graphics.Rectangle drawingArea,
boolean printing)
gc - GCcellStyle - th styledrawingArea - the drawing area of the cellprinting - true marks operation for a printer
protected void drawBackground(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle area,
ICellStyle style,
boolean selected,
boolean printing)
gc - GCarea - cell drawing areastyle - cell styleselected - true for selectedprinting - true if printing
protected void drawSelection(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle area,
ICellStyle style,
boolean selected,
boolean printing)
gc - GCarea - area of the cellstyle - cellstyleselected - true if selecetdprinting - true if printing - no selection will be drawn when printing
protected void drawCommentMarker(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle area,
org.eclipse.swt.graphics.Color color,
int size)
gc - GCarea - drawing areacolor - color of the markersize - size of the marker
protected boolean isInCommentMarkerArea(org.eclipse.swt.graphics.Rectangle area,
int size,
int x,
int y)
area - drawing area of the cellsize - size of the markerx - x coordinate to checky - y coordinate to check
protected org.eclipse.swt.graphics.Color getBackgroundColor(ICellStyle style,
boolean printing)
style - cell styleprinting - true for printing
protected org.eclipse.swt.graphics.Color getForegroundColor(ICellStyle style,
boolean printing)
style - cell styleprinting - true for printing
protected org.eclipse.swt.graphics.Color getBorderColor(ICellStyle style,
boolean printing)
style - cell styleprinting - true for printing
protected org.eclipse.swt.graphics.Font getFont(ICellStyle style,
boolean printing,
org.eclipse.swt.graphics.Font defaultFont)
style - cell styleprinting - true for printingdefaultFont - a default font used if no font can be retrieved
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||