Package org.zkoss.stateless.state
Class IGridController<Data,Row extends IRowBase>
- java.lang.Object
-
- org.zkoss.stateless.state.IGridController<Data,Row>
-
- All Implemented Interfaces:
ItemController<Data,ListModel<Data>,IGrid,Row>
public class IGridController<Data,Row extends IRowBase> extends java.lang.Object implements ItemController<Data,ListModel<Data>,IGrid,Row>
AnIGrid
controller to control any operation on the given model.Note: this class is not thread-safe, so when it's used in multi-threading environment, the developer should handle the threading issue.
- Author:
- katherine
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IGrid
build()
Returns the immutable instance that the controller to build withvoid
clear()
Clears all the rendered data.CheckedFunction3<Data,java.lang.Integer,GroupingInfo,Row>
getGroupsRenderer()
Returns the groups renderer.ListModel<Data>
getModel()
Returns the model, which is set through byItemController.setModel(Object)
, or null.CheckedFunction2<Data,java.lang.Integer,Row>
getRenderer()
Returns the renderer, which is set through byItemController.setRenderer(CheckedFunction2)
, or a default one which is depended on implementation.static <D,G,F,R extends IRowBase>
IGridController<D,R>of(IGrid owner, GroupsModel<D,G,F> model)
Returns the controller instance with the givengrid
static <D,G,F,R extends IRowBase>
IGridController<D,R>of(IGrid owner, GroupsModel<D,G,F> model, CheckedFunction3<D,java.lang.Integer,GroupingInfo,R> renderer)
Returns the controller instance with the givengrid
static <D,R extends IRowBase>
IGridController<D,R>of(IGrid owner, ListModel<D> model)
Returns the controller instance with the givengrid
static <D,R extends IRowBase>
IGridController<D,R>of(IGrid owner, ListModel<D> model, CheckedFunction2<D,java.lang.Integer,R> renderer)
Returns the controller instance with the givengrid
void
setGroupsRenderer(CheckedFunction3<Data,java.lang.Integer,GroupingInfo,Row> renderer)
Sets the groups renderer forGroupsModel
void
setModel(GroupsModel<?,?,?> model)
Sets the groups model for this controller to render.void
setModel(ListModel<Data> model)
Sets the given model to this controller.void
setRenderer(CheckedFunction2<Data,java.lang.Integer,Row> renderer)
Sets the renderer which is used to render each data ifItemController.getModel()
is not null.
-
-
-
Method Detail
-
of
public static <D,R extends IRowBase> IGridController<D,R> of(IGrid owner, ListModel<D> model)
Returns the controller instance with the givengrid
- Parameters:
owner
- The controller to control withmodel
- The list model to associate with the grid.
-
of
public static <D,R extends IRowBase> IGridController<D,R> of(IGrid owner, ListModel<D> model, CheckedFunction2<D,java.lang.Integer,R> renderer)
Returns the controller instance with the givengrid
- Parameters:
owner
- The controller to control withmodel
- The list model to associate with the grid.renderer
- The renderer of the list model.
-
of
public static <D,G,F,R extends IRowBase> IGridController<D,R> of(IGrid owner, GroupsModel<D,G,F> model)
Returns the controller instance with the givengrid
- Parameters:
owner
- The controller to control withmodel
- The groups model to associate with the grid.
-
of
public static <D,G,F,R extends IRowBase> IGridController<D,R> of(IGrid owner, GroupsModel<D,G,F> model, CheckedFunction3<D,java.lang.Integer,GroupingInfo,R> renderer)
Returns the controller instance with the givengrid
- Parameters:
owner
- The controller to control withmodel
- The groups model to associate with the grid.renderer
- The renderer of the groups model.
-
setModel
public void setModel(ListModel<Data> model)
Description copied from interface:ItemController
Sets the given model to this controller.Note: calling this method after
ItemController.build()
, you should invokeItemController.build()
again to take effect to replace the current one at client.
For example,uiAgent.replaceWith(locator, itemController.build());
Default:
null
-
setModel
public void setModel(GroupsModel<?,?,?> model)
Sets the groups model for this controller to render.- Parameters:
model
- The groups model.
-
getModel
public ListModel<Data> getModel()
Description copied from interface:ItemController
Returns the model, which is set through byItemController.setModel(Object)
, or null.
-
setRenderer
public void setRenderer(CheckedFunction2<Data,java.lang.Integer,Row> renderer)
Description copied from interface:ItemController
Sets the renderer which is used to render each data ifItemController.getModel()
is not null.Note: calling this method after
ItemController.build()
, you should invokeItemController.build()
again to take effect to replace the current one at client.
For example,uiAgent.replaceWith(locator, itemController.build());
Default:
null
, or depended on the implementation- Specified by:
setRenderer
in interfaceItemController<Data,ListModel<Data>,IGrid,Row extends IRowBase>
-
setGroupsRenderer
public void setGroupsRenderer(CheckedFunction3<Data,java.lang.Integer,GroupingInfo,Row> renderer)
Sets the groups renderer forGroupsModel
- Parameters:
renderer
- The renderer for GroupsModel.
-
getRenderer
public CheckedFunction2<Data,java.lang.Integer,Row> getRenderer()
Description copied from interface:ItemController
Returns the renderer, which is set through byItemController.setRenderer(CheckedFunction2)
, or a default one which is depended on implementation.- Specified by:
getRenderer
in interfaceItemController<Data,ListModel<Data>,IGrid,Row extends IRowBase>
-
getGroupsRenderer
public CheckedFunction3<Data,java.lang.Integer,GroupingInfo,Row> getGroupsRenderer()
Returns the groups renderer.Default:
null
-
build
public IGrid build()
Description copied from interface:ItemController
Returns the immutable instance that the controller to build with
-
clear
public void clear()
Description copied from interface:ItemController
Clears all the rendered data.
-
-