de.jaret.util.ui.table.renderer
Interface ICellRenderer

All Known Subinterfaces:
IHierarchyRenderer
All Known Implementing Classes:
BarCellRenderer, BooleanCellRenderer, CellRendererBase, ClassImageRenderer, DateCellRenderer, DoubleCellRenderer, ImageCellRenderer, LabelProviderRenderer, ObjectImageRenderer, SmileyCellRenderer, TableHierarchyRenderer, TextCellRenderer

public interface ICellRenderer

Interface for a cell renderer for a jaret table.

Version:
$Id: ICellRenderer.java 179 2007-01-07 17:37:50Z olk $
Author:
Peter Kliem

Method Summary
 ICellRenderer createPrintRenderer(org.eclipse.swt.printing.Printer printer)
          Create a renderer connfigured for printing.
 void dispose()
          If there are resources to free - this is the place.
 void draw(org.eclipse.swt.graphics.GC gc, JaretTable jaretTable, ICellStyle cellStyle, org.eclipse.swt.graphics.Rectangle drawingArea, IRow row, IColumn column, boolean drawFocus, boolean selected, boolean printing)
          Draw a single cell.
 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.
 

Method Detail

draw

void draw(org.eclipse.swt.graphics.GC gc,
          JaretTable jaretTable,
          ICellStyle cellStyle,
          org.eclipse.swt.graphics.Rectangle drawingArea,
          IRow row,
          IColumn column,
          boolean drawFocus,
          boolean selected,
          boolean printing)
Draw a single cell. The draw method should be null safe (handling null as the cell value).

Parameters:
gc - GC to paint on
jaretTable - table the rendering is for
cellStyle - style of the cell
drawingArea - rectangle to draw within
row - row of the cell to paint
column - column of the cell to paint
drawFocus - true if a focus mark should be drawn
selected - true if the cell is currently selected
printing - true if the render operation is for a printer

getPreferredWidth

int getPreferredWidth(java.util.List<IRow> rows,
                      IColumn column)
Calculate the preferred width for the column.

Parameters:
rows - the rows currently displayed by the table
column - the column for which the preferred width is to be calculated
Returns:
the preferred width or -1 for no special preferred width.

getPreferredHeight

int getPreferredHeight(org.eclipse.swt.graphics.GC gc,
                       ICellStyle cellStyle,
                       int width,
                       IRow row,
                       IColumn column)
Calculate the preferred height of a specific cell.

Parameters:
gc - GC that will used
cellStyle - cell style of the cell
width - width of the column (thus of the cell)
row - row
column - column
Returns:
the preferred height or -1 for no special preferred height

getTooltip

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.

Parameters:
jaretTable - table that is asking
drawingArea - area of the cell rendering
row - row
column - column
x - mouse x coordinate (absolute within drawing area)
y - mouse y coordinate (abs within drawing area)
Returns:
tootip text or null if no tooltip is to be shown

createPrintRenderer

ICellRenderer createPrintRenderer(org.eclipse.swt.printing.Printer printer)
Create a renderer connfigured for printing.

Parameters:
printer - printer to use
Returns:
a configured renderer for printing

dispose

void dispose()
If there are resources to free - this is the place.



Copyright © 2012. All Rights Reserved.