Package org.zkoss.zul

## Interface RowRendererExt

-     public interface RowRendererExt

  Provides additional control to `RowRenderer`.
  Author:
    tomyeh

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `DETACH_ON_RENDER` | Returned by `getControls()` to indicate that the list cells added by `newCell(org.zkoss.zul.Row)` must be detached before calling `RowRenderer.render(org.zkoss.zul.Row, T, int)`.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `getControls()` | Returns how a grid shall render the live data.
    `Component` | `newCell​(Row row)` | Create a component that will be attached to the unloaded row.
    `Row` | `newRow​(Grid grid)` | Creates an instance of `Row` that will be attached to grid.

- - ### Field Detail

    - #### DETACH_ON_RENDER

          static final int DETACH_ON_RENDER

      Returned by `getControls()` to indicate that the list cells added by `newCell(org.zkoss.zul.Row)` must be detached before calling `RowRenderer.render(org.zkoss.zul.Row, T, int)`.

      Default: true.
      If this interface is not specified, this flag is assumed to be specified.

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

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### newRow

          Row newRow​(Grid grid)

      Creates an instance of `Row` that will be attached to grid. The created component will be passed to `RowRenderer.render(org.zkoss.zul.Row, T, int)` to append the required information to show a row of the data.

      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 `AbstractComponent.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

          Component newCell​(Row row)

      Create a component that will be attached to the unloaded row. By unloaded row we mean the row that is not loaded with the data retreived from the model. That is, `RowRenderer.render(org.zkoss.zul.Row, T, int)` is not called yet.

      Notice that this callback shall generate an empty cell, rather than showing the data retrieved from the model. The showing of the data from model shall be done in `RowRenderer.render(org.zkoss.zul.Row, T, int)`.

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

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

      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 `AbstractComponent.setParent(org.zkoss.zk.ui.Component)`.

      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` or 0 to indicate how to render the live data.