Package org.zkoss.stateless.state
Class ITreeController<Data>
- java.lang.Object
-
- org.zkoss.stateless.state.ITreeController<Data>
-
- All Implemented Interfaces:
ItemController<Data,TreeModel<Data>,ITree,ITreeitem>
public class ITreeController<Data> extends java.lang.Object implements ItemController<Data,TreeModel<Data>,ITree,ITreeitem>
AnITreecontroller 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:
- jumperchen
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ITreebuild()Returns the immutable instance that the controller to build withvoidclear()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,ITreeitem>getRenderer()Returns the renderer, which is set through byItemController.setRenderer(CheckedFunction2), or a default one which is depended on implementation.DatagetSelectedObject()Returns the selected object.static <D> ITreeController<D>of(ITree owner, TreeModel<D> model)Returns the controller instance with the giventreestatic <D> ITreeController<D>of(ITree owner, TreeModel<D> model, CheckedFunction2<D,java.lang.Integer,ITreeitem> renderer)Returns the controller instance with the giventreevoidsetModel(TreeModel<Data> model)Sets the given model to this controller.voidsetRenderer(CheckedFunction2<Data,java.lang.Integer,ITreeitem> renderer)Sets the renderer which is used to render each data ifItemController.getModel()is not null.voidsetSelectedObject(Data item)Deselects selected object and selects the given object.
-
-
-
Method Detail
-
of
public static <D> ITreeController<D> of(ITree owner, TreeModel<D> model)
Returns the controller instance with the giventree- Parameters:
owner- The controller to control withmodel- The tree model to associate with the tree.
-
of
public static <D> ITreeController<D> of(ITree owner, TreeModel<D> model, CheckedFunction2<D,java.lang.Integer,ITreeitem> renderer)
Returns the controller instance with the giventree- Parameters:
owner- The controller to control withmodel- The tree model to associate with the tree.renderer- The renderer of the tree model.
-
setModel
public void setModel(TreeModel<Data> model)
Description copied from interface:ItemControllerSets 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:ItemControllerReturns the model, which is set through byItemController.setModel(Object), or null.
-
setRenderer
public void setRenderer(CheckedFunction2<Data,java.lang.Integer,ITreeitem> renderer)
Description copied from interface:ItemControllerSets 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:
setRendererin interfaceItemController<Data,TreeModel<Data>,ITree,ITreeitem>
-
getRenderer
public CheckedFunction2<Data,java.lang.Integer,ITreeitem> getRenderer()
Description copied from interface:ItemControllerReturns the renderer, which is set through byItemController.setRenderer(CheckedFunction2), or a default one which is depended on implementation.- Specified by:
getRendererin interfaceItemController<Data,TreeModel<Data>,ITree,ITreeitem>
-
build
public ITree build()
Description copied from interface:ItemControllerReturns the immutable instance that the controller to build with
-
getSelectedObject
public Data getSelectedObject()
Returns the selected object.
-
setSelectedObject
public void setSelectedObject(Data item)
Deselects selected object and selects the given object.
-
clear
public void clear()
Description copied from interface:ItemControllerClears all the rendered data.
-
-