Package org.zkoss.stateless.state
Class IStepbarController<Data>
- java.lang.Object
-
- org.zkoss.stateless.state.IStepbarController<Data>
-
- All Implemented Interfaces:
ItemController<Data,StepModel<Data>,IStepbar,IStep>
public class IStepbarController<Data> extends java.lang.Object implements ItemController<Data,StepModel<Data>,IStepbar,IStep>
AnIStepbar
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 void
back()
Activate previous step if possible.IStepbar
build()
Returns the immutable instance that the controller to build withvoid
clear()
Clears all the rendered data.int
getActiveIndex()
Return the index of the active step.StepModel<Data>
getModel()
Returns the model, which is set through byItemController.setModel(Object)
, or null.CheckedFunction2<Data,java.lang.Integer,IStep>
getRenderer()
Returns the renderer, which is set through byItemController.setRenderer(CheckedFunction2)
, or a default one which is depended on implementation.void
next()
Activate next step if possible.static <D> IStepbarController<D>
of(IStepbar owner, StepModel<D> model)
Returns the controller instance with the givenstepbar
static <D> IStepbarController<D>
of(IStepbar owner, StepModel<D> model, CheckedFunction2<D,java.lang.Integer,IStep> renderer)
Returns the controller instance with the givenstepbar
void
setActiveIndex(int activeIndex)
Sets the index of the active step.void
setModel(StepModel<Data> model)
Sets the given model to this controller.void
setRenderer(CheckedFunction2<Data,java.lang.Integer,IStep> renderer)
Sets the renderer which is used to render each data ifItemController.getModel()
is not null.
-
-
-
Method Detail
-
of
public static <D> IStepbarController<D> of(IStepbar owner, StepModel<D> model)
Returns the controller instance with the givenstepbar
- Parameters:
owner
- The controller to control withmodel
- The step model to associate with the stepbar.
-
of
public static <D> IStepbarController<D> of(IStepbar owner, StepModel<D> model, CheckedFunction2<D,java.lang.Integer,IStep> renderer)
Returns the controller instance with the givenstepbar
- Parameters:
owner
- The controller to control withmodel
- The step model to associate with the stepbar.renderer
- The renderer of the step model.
-
setModel
public void setModel(StepModel<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 StepModel<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,IStep> 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,StepModel<Data>,IStepbar,IStep>
-
getRenderer
public CheckedFunction2<Data,java.lang.Integer,IStep> 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,StepModel<Data>,IStepbar,IStep>
-
build
public IStepbar 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.
-
getActiveIndex
public int getActiveIndex()
Return the index of the active step.Default:
0
.
-
setActiveIndex
public void setActiveIndex(int activeIndex)
Sets the index of the active step.
-
next
public void next()
Activate next step if possible.
-
back
public void back()
Activate previous step if possible.
-
-