|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.jaret.util.ui.table.renderer.RendererBase de.jaret.util.ui.table.renderer.DefaultTableHeaderRenderer
public class DefaultTableHeaderRenderer
Default header renderer for the jaret table. The header renderer will render a simple header view. The renderer supports rotating the header text from 0 to 90 degrees anti-clock wise. If a rotation is set, the header is drawn using a white background. Several properties allow changing the drawing (always consider writing a specialized renderer!).
Nested Class Summary | |
---|---|
static class |
DefaultTableHeaderRenderer.Alignment
Alignment enumeration. |
class |
DefaultTableHeaderRenderer.LocalResourceImageDescriptor
|
Field Summary | |
---|---|
protected DefaultTableHeaderRenderer.Alignment |
_alignment
Alignment: default left. |
protected org.eclipse.swt.graphics.RGB |
_backgroundRGB
background rgb value. |
protected org.eclipse.swt.graphics.Color |
_bgColor
allocated background color. |
protected boolean |
_drawBox
true if the header box should be drawn. |
protected org.eclipse.swt.graphics.Font |
_font
font when aquired. |
protected org.eclipse.swt.graphics.FontData |
_fontData
FOntadat of the font to use. |
protected org.eclipse.jface.resource.ImageRegistry |
_imageRegistry
|
protected int |
_rotation
rotation of the header text. |
protected org.eclipse.swt.graphics.Transform |
_transform
Transformations for rotated text. |
protected org.eclipse.swt.graphics.Transform |
_transformInv
inverse transformation to reset gc. |
protected static java.lang.String |
DOWN
key for downwards arrow. |
protected static int |
SORTINGAREAINDICATORWIDTH
width reserved for the sorting area. |
protected static java.lang.String |
UP
key for uowards arrow. |
Fields inherited from class de.jaret.util.ui.table.renderer.RendererBase |
---|
_printer, _scaleX, _scaleY, SCREEN_DPI_X, SCREEN_DPI_Y |
Constructor Summary | |
---|---|
DefaultTableHeaderRenderer()
Construct header renderer for a display. |
|
DefaultTableHeaderRenderer(org.eclipse.swt.printing.Printer printer)
Construct a header renderer for printing. |
Method Summary | |
---|---|
boolean |
disableClipping()
If this method returns true the gc for drawing will not be limited by a clipping rect. |
void |
dispose()
Dispose any resources allocated. |
void |
draw(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle drawingArea,
IColumn column,
int sortingOrder,
boolean sortDir,
boolean printing)
Draw a table header. |
DefaultTableHeaderRenderer.Alignment |
getAlignment()
Retrieve the alignment for the header label (only when not rotated). |
org.eclipse.swt.graphics.RGB |
getBackgroundRGB()
Get the background RGB value of the header (non rotated only). |
boolean |
getDrawBox()
Retrieve whether the header is drawn boxed. |
org.eclipse.swt.graphics.FontData |
getFontData()
Get the fontdata for the font used to render the header label. |
ITableHeaderRenderer |
getPrintRenderer(org.eclipse.swt.printing.Printer printer)
Create a table header renderer for printing. |
boolean |
isSortingClick(org.eclipse.swt.graphics.Rectangle drawingArea,
IColumn column,
int x,
int y)
Check whether a click hits the area reserved for sorting indication. |
void |
setAlignment(DefaultTableHeaderRenderer.Alignment alignment)
Set the alignment for the header label (not used when rotated). |
void |
setBackgroundRGB(org.eclipse.swt.graphics.RGB backgroundRGB)
Set the background rgb value. |
void |
setDrawBox(boolean drawBox)
Set whether the header should be drawn boxed. |
void |
setFontData(org.eclipse.swt.graphics.FontData fontData)
Set the fontdata for the font to render the header. |
void |
setRotation(int rotation)
Set the rotation of the header text. |
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 |
Field Detail |
---|
protected DefaultTableHeaderRenderer.Alignment _alignment
protected boolean _drawBox
protected org.eclipse.swt.graphics.RGB _backgroundRGB
protected org.eclipse.swt.graphics.Color _bgColor
protected org.eclipse.swt.graphics.FontData _fontData
protected org.eclipse.swt.graphics.Font _font
protected int _rotation
protected org.eclipse.swt.graphics.Transform _transform
protected org.eclipse.swt.graphics.Transform _transformInv
protected org.eclipse.jface.resource.ImageRegistry _imageRegistry
protected static final java.lang.String UP
protected static final java.lang.String DOWN
protected static final int SORTINGAREAINDICATORWIDTH
Constructor Detail |
---|
public DefaultTableHeaderRenderer(org.eclipse.swt.printing.Printer printer)
printer
- printer devicepublic DefaultTableHeaderRenderer()
Method Detail |
---|
public void setRotation(int rotation)
redraw()
on the table
yourself if you change the rotation while the table is showing.
rotation
- rotation in degrees anti clockwise between 0 and 90 degrees.public void draw(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle drawingArea, IColumn column, int sortingOrder, boolean sortDir, boolean printing)
draw
in interface ITableHeaderRenderer
gc
- GC to be useddrawingArea
- rectangle to draw withincolumn
- the column for which the header is painted.sortingOrder
- if the column is part of the sorting set this indicates the sorting order position. A
value of 0 means no sorting.sortDir
- if sorting this indicates the sorting direction. true
means ascending.printing
- true if the draw operation is for a printerpublic boolean disableClipping()
true
the gc for drawing will not be limited by a clipping rect. This is
useful for slanted header texts but should be used with the appropriate care.
disableClipping
in interface ITableHeaderRenderer
public void dispose()
dispose
in interface ITableHeaderRenderer
public boolean isSortingClick(org.eclipse.swt.graphics.Rectangle drawingArea, IColumn column, int x, int y)
isSortingClick
in interface ITableHeaderRenderer
drawingArea
- drawing aea of the headercolumn
- columnx
- x coordinat of the clicky
- y coordinate of the click
public ITableHeaderRenderer getPrintRenderer(org.eclipse.swt.printing.Printer printer)
getPrintRenderer
in interface ITableHeaderRenderer
printer
- the printer that will be used
public DefaultTableHeaderRenderer.Alignment getAlignment()
public void setAlignment(DefaultTableHeaderRenderer.Alignment alignment)
alignment
- alignment to be usedpublic boolean getDrawBox()
public void setDrawBox(boolean drawBox)
drawBox
- true for boxed drawingpublic org.eclipse.swt.graphics.RGB getBackgroundRGB()
public void setBackgroundRGB(org.eclipse.swt.graphics.RGB backgroundRGB)
backgroundRGB
- the RGB valuepublic org.eclipse.swt.graphics.FontData getFontData()
public void setFontData(org.eclipse.swt.graphics.FontData fontData)
fontData
- fontdat ato use
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |