de.matthiasmann.twl
Interface TableBase.CellRenderer

All Known Subinterfaces:
TableBase.CellWidgetCreator
All Known Implementing Classes:
TableBase.StringCellRenderer
Enclosing class:
TableBase

public static interface TableBase.CellRenderer

IMPORTANT: Widgets implementing CellRenderer should not call Widget.invalidateLayout() or Widget.invalidateLayoutLocally() . This means they need to override Widget.sizeChanged().


Method Summary
 void applyTheme(ThemeInfo themeInfo)
          Called when the CellRenderer is registered and a theme is applied.
 Widget getCellRenderWidget(int x, int y, int width, int height, boolean isSelected)
          Returns the widget used to render the cell or null if no rendering should happen.
 int getColumnSpan()
          Returns how many columns this cell spans.
 int getPreferredHeight()
          Returns the preferred cell height in variable row height mode.
 java.lang.String getTheme()
          The theme name for this CellRenderer.
 void setCellData(int row, int column, java.lang.Object data)
          This method sets the row, column and the cell data.
 

Method Detail

applyTheme

void applyTheme(ThemeInfo themeInfo)
Called when the CellRenderer is registered and a theme is applied.

Parameters:
themeInfo - the theme object

getTheme

java.lang.String getTheme()
The theme name for this CellRenderer. Must be relative to the Table.

Returns:
the theme name.

setCellData

void setCellData(int row,
                 int column,
                 java.lang.Object data)
This method sets the row, column and the cell data. It is called before any other cell related method is called.

Parameters:
row - the table row
column - the table column
data - the cell data

getColumnSpan

int getColumnSpan()
Returns how many columns this cell spans. Must be >= 1. Is called after setCellData.

Returns:
the column span.
See Also:
setCellData(int, int, java.lang.Object)

getPreferredHeight

int getPreferredHeight()
Returns the preferred cell height in variable row height mode. It is not called at all in fixed row height mode.

Returns:
the preferred cell height
See Also:
setCellData(int, int, java.lang.Object), TableBase.setVaribleRowHeight(boolean)

getCellRenderWidget

Widget getCellRenderWidget(int x,
                           int y,
                           int width,
                           int height,
                           boolean isSelected)
Returns the widget used to render the cell or null if no rendering should happen. This widget should not be added to any widget. It will be managed by the Table. TableBase uses a stamping approch for cell rendering. This method must not create a new widget each time. This method is responsible to call setPosition and setSize on the returned widget.

Parameters:
x - the left edge of the cell
y - the top edge of the cell
width - the width of the cell
height - the height of the cell
isSelected - the selected state of this cell
Returns:
the widget used for cell rendering or null.
See Also:
setCellData(int, int, java.lang.Object)