Package org.zkoss.stateless.state
Class ICascaderController<Data>
- java.lang.Object
-
- org.zkoss.stateless.state.ICascaderController<Data>
-
- All Implemented Interfaces:
ItemController<Data,TreeModel<Data>,ICascader,java.lang.String>
public class ICascaderController<Data> extends java.lang.Object implements ItemController<Data,TreeModel<Data>,ICascader,java.lang.String>
AnICascader
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 ICascader
build()
Returns the immutable instance that the controller to build withvoid
clear()
Clears all the rendered data.TreeModel<Data>
getModel()
Returns the model, which is set through byItemController.setModel(Object)
, or null.CheckedFunction2<Data,java.lang.Integer,java.lang.String>
getRenderer()
Returns the renderer, which is set through byItemController.setRenderer(CheckedFunction2)
, or a default one which is depended on implementation.Data
getSelectedObject()
Returns the selected object.java.util.Set<Data>
getSelectedObjects()
Returns all selected items.static <D> ICascaderController<D>
of(ICascader owner, TreeModel<D> model)
static <D> ICascaderController<D>
of(ICascader owner, TreeModel<D> model, CheckedFunction2<java.lang.Object,java.lang.Integer,java.lang.String> renderer)
void
setItemConverter(Converter<java.util.Collection<Data>,java.lang.String> converter)
Sets the converter that generates the label text shown in the cascader from selected items.void
setModel(TreeModel<Data> model)
Sets the given model to this controller.void
setRenderer(CheckedFunction2<Data,java.lang.Integer,java.lang.String> renderer)
Sets the renderer which is used to render each data ifItemController.getModel()
is not null.void
setSelectedObject(Data item)
Deselects selected object and selects the given object.
-
-
-
Method Detail
-
of
public static <D> ICascaderController<D> of(ICascader owner, TreeModel<D> model)
- Parameters:
owner
- The controller to control withmodel
- The data model for the cascader.
-
of
public static <D> ICascaderController<D> of(ICascader owner, TreeModel<D> model, CheckedFunction2<java.lang.Object,java.lang.Integer,java.lang.String> renderer)
- Parameters:
owner
- The controller to control withmodel
- The data model for the cascader.renderer
- The data renderer for the cascader.
-
setModel
public void setModel(TreeModel<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
-
getModel
public TreeModel<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,java.lang.String> 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,TreeModel<Data>,ICascader,java.lang.String>
-
getRenderer
public CheckedFunction2<Data,java.lang.Integer,java.lang.String> 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,TreeModel<Data>,ICascader,java.lang.String>
-
build
public ICascader 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.
-
setItemConverter
public void setItemConverter(Converter<java.util.Collection<Data>,java.lang.String> converter)
Sets the converter that generates the label text shown in the cascader from selected items.- Parameters:
converter
- the converter, or null to use the default implementation.
-
getSelectedObjects
public java.util.Set<Data> getSelectedObjects()
Returns all selected items.
-
getSelectedObject
public Data getSelectedObject()
Returns the selected object.
-
setSelectedObject
public void setSelectedObject(Data item)
Deselects selected object and selects the given object.
-
-