org.zkoss.zul
Interface RowRendererExt


public interface RowRendererExt

Provides additional control to RowRenderer.

Author:
tomyeh

Field Summary
static int DETACH_ON_RENDER
          Returned by getControls() to indicate to detach the cell adde by newCell(org.zkoss.zul.Row).
static int DETACH_ON_UNLOAD
          Returned by getControls() to indicate whether to detach a rendered row when unloading it.
 
Method Summary
 int getControls()
          Returns how a grid shall render the live data.
 org.zkoss.zk.ui.Component newCell(Row row)
          Create a component as the first cell of the row.
 Row newRow(Grid grid)
          Creates an instance of Row for rendering.
 

Field Detail

DETACH_ON_RENDER

static final int DETACH_ON_RENDER
Returned by getControls() to indicate to detach the cell adde by newCell(org.zkoss.zul.Row).

To simplify the implementation of RowRenderer.render(org.zkoss.zul.Row, java.lang.Object), Listbox, by default, detached the cell before calling RowRenderer.render(org.zkoss.zul.Row, java.lang.Object) -- as if this flag is returned.

If you don't specify this flag, the implementation of RowRenderer.render(org.zkoss.zul.Row, java.lang.Object) must be aware of the existence of the first cell (of the passed row).

See Also:
Constant Field Values

DETACH_ON_UNLOAD

static final int DETACH_ON_UNLOAD
Returned by getControls() to indicate whether to detach a rendered row when unloading it.

When a row has to be cleaned up (so it can be re-rendered again), the grid checks whether this flag is returned. For example, when a new data model is assigned, all rendered rows (i.e., generated by RowRenderer.render(org.zkoss.zul.Row, java.lang.Object)) will be cleaned up.

To have the best performance, the grid, by default, keep using the same row and the first cell (other cells, if any, are removed).

Sometimes it could be an issue. For example, you assign attributes or annotations to a rendered row. Then, you'd better to return this flag to indicate that. a new row shall be created (by calling newRow(org.zkoss.zul.Grid) and newCell(org.zkoss.zul.Row)) to replace the renderred row.

See Also:
Constant Field Values
Method Detail

newRow

Row newRow(Grid grid)
Creates an instance of Row for rendering. The created component will be passed to RowRenderer.render(org.zkoss.zul.Row, java.lang.Object).

Note: remember to invoke AbstractComponent.applyProperties() to initialize the properties, defined in the component definition, properly.

If null is returned, the default row is created as follow.


final Row row = new Row();
row.applyProperties();
return row;

Note: DO NOT call Row.setParent(org.zkoss.zk.ui.Component).

Returns:
the row if you'd like to create it differently, or null if you want Grid to create it for you

newCell

org.zkoss.zk.ui.Component newCell(Row row)
Create a component as the first cell of the row.

Note: remember to invoke Component.applyProperties() to initialize the properties, defined in the component definition, properly, if you create an instance instead of returning null.

Note: DO NOT call Row.setParent(org.zkoss.zk.ui.Component).

If null is returned, the default cell is created as follow.


final Label cell = new Label();
cell.applyProperties();
return cell;

Note: DO NOT call Component.setParent(org.zkoss.zk.ui.Component). Don't create cells for other columns.

Parameters:
row - the row. It is the same as that is returned by newRow(org.zkoss.zul.Grid)
Returns:
the cell if you'd like to create it differently, or null if you want Grid to create it for you

getControls

int getControls()
Returns how a grid shall render the live data.

Note: if this interface is not implemented, DETACH_ON_RENDER is assumed.

Returns:
a combination of DETACH_ON_RENDER and DETACH_ON_UNLOAD to indicate how to render the live data.


Copyright © 2005-2007 Potix Corporation. All Rights Reserved.