Package org.zkoss.stateless.state
Class IOrganigramController<Data>
- java.lang.Object
-
- org.zkoss.stateless.state.IOrganigramController<Data>
-
- All Implemented Interfaces:
ItemController<Data,TreeModel<Data>,IOrganigram,IOrgitem>
public class IOrganigramController<Data> extends java.lang.Object implements ItemController<Data,TreeModel<Data>,IOrganigram,IOrgitem>
AnIOrganigram
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 IOrganigram
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,IOrgitem>
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.static <D> IOrganigramController<D>
of(IOrganigram owner, TreeModel<D> model)
Returns the controller instance with the givenorganigram
static <D> IOrganigramController<D>
of(IOrganigram owner, TreeModel<D> model, CheckedFunction2<D,java.lang.Integer,IOrgitem> renderer)
Returns the controller instance with the givenorganigram
void
setModel(TreeModel<Data> model)
Sets the given model to this controller.void
setRenderer(CheckedFunction2<Data,java.lang.Integer,IOrgitem> renderer)
Sets the renderer which is used to render each data ifItemController.getModel()
is not null.void
setSelectedObject(Data data)
Sets the selected data object, or deselects it by passing a null value.
-
-
-
Method Detail
-
of
public static <D> IOrganigramController<D> of(IOrganigram owner, TreeModel<D> model)
Returns the controller instance with the givenorganigram
- Parameters:
owner
- The controller to control withmodel
- The tree model to associate with the organigram.
-
of
public static <D> IOrganigramController<D> of(IOrganigram owner, TreeModel<D> model, CheckedFunction2<D,java.lang.Integer,IOrgitem> renderer)
Returns the controller instance with the givenorganigram
- Parameters:
owner
- The controller to control withmodel
- The tree model to associate with the organigram.renderer
- The renderer of the tree model.
-
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
- Specified by:
setModel
in interfaceItemController<Data,TreeModel<Data>,IOrganigram,IOrgitem>
-
getModel
public TreeModel<Data> getModel()
Description copied from interface:ItemController
Returns the model, which is set through byItemController.setModel(Object)
, or null.- Specified by:
getModel
in interfaceItemController<Data,TreeModel<Data>,IOrganigram,IOrgitem>
-
setRenderer
public void setRenderer(CheckedFunction2<Data,java.lang.Integer,IOrgitem> 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>,IOrganigram,IOrgitem>
-
getRenderer
public CheckedFunction2<Data,java.lang.Integer,IOrgitem> 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>,IOrganigram,IOrgitem>
-
build
public IOrganigram build()
Description copied from interface:ItemController
Returns the immutable instance that the controller to build with- Specified by:
build
in interfaceItemController<Data,TreeModel<Data>,IOrganigram,IOrgitem>
-
clear
public void clear()
Description copied from interface:ItemController
Clears all the rendered data.- Specified by:
clear
in interfaceItemController<Data,TreeModel<Data>,IOrganigram,IOrgitem>
-
getSelectedObject
public Data getSelectedObject()
Returns the selected object.
-
setSelectedObject
public void setSelectedObject(Data data)
Sets the selected data object, or deselects it by passing a null value.- Parameters:
data
- The data object that contains in the model.
-
-