Package org.zkoss.stateless.state

## Class ITabboxController<DataT>

- java.lang.Object
- - org.zkoss.stateless.state.ITabboxController<DataT>

- All Implemented Interfaces:
    `ItemController<DataT,​ListModel<DataT>,​ITabbox,​ITab>`

      public class ITabboxController<DataT>
      extends java.lang.Object
      implements ItemController<DataT,​ListModel<DataT>,​ITabbox,​ITab>

  An `ITabbox` 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
    --- | --- | ---
    `ITabbox` | `build()` | Returns the immutable instance that the controller to build with
    `void` | `clear()` | Clears all the rendered data.
    `void` | `doDataChange​(ListDataEvent event)` |
    `ListModel<DataT>` | `getModel()` | Returns the model, which is set through by `ItemController.setModel(Object)`, or null.
    `CheckedFunction2<DataT,​java.lang.Integer,​ITab>` | `getRenderer()` | Returns the renderer, which is set through by `ItemController.setRenderer(CheckedFunction2)`, or a default one which is depended on implementation.
    `int` | `getSelectedIndex()` | Returns the selected index.
    `DataT` | `getSelectedObject()` | Returns the data object which is selected or null.
    `CheckedFunction2<DataT,​java.lang.Integer,​ITabpanel>` | `getTabpanelRenderer()` | Returns the tabpanel renderer.
    `static <D> ITabboxController<D>` | `of​(ITabbox owner, ListModel<D> model)` | Returns the controller instance with the given `tabbox`, and `ListModel`.
    `static <D> ITabboxController<D>` | `of​(ITabbox owner, ListModel<D> model, CheckedFunction2<D,​java.lang.Integer,​ITab> tabRenderer, CheckedFunction2<D,​java.lang.Integer,​ITabpanel> tabpanelRenderer)` | Returns the controller instance with the given `tabbox`, `ListModel`, tabRenderer, and tabpanelRenderer.
    `static <D> ITabboxController<D>` | `ofTab​(ITabbox owner, ListModel<D> model, CheckedFunction2<D,​java.lang.Integer,​ITab> tabRenderer)` | Returns the controller instance with the given `tabbox`, `ListModel`, tabRenderer.
    `static <D> ITabboxController<D>` | `ofTabanel​(ITabbox owner, ListModel<D> model, CheckedFunction2<D,​java.lang.Integer,​ITabpanel> tabpanelRenderer)` | Returns the controller instance with the given `tabbox`, `ListModel`, and tabpanelRenderer.
    `void` | `setModel​(ListModel<DataT> model)` | Sets the given model to this controller.
    `void` | `setRenderer​(CheckedFunction2<DataT,​java.lang.Integer,​ITab> renderer)` | Sets the renderer which is used to render each data if `ItemController.getModel()` is not null.
    `void` | `setSelectedIndex​(int value)` | Sets the selected index.
    `void` | `setSelectedObject​(DataT data)` | Sets the selected data object, or deselects it by passing a null value.
    `void` | `setTabpanelRenderer​(CheckedFunction2<DataT,​java.lang.Integer,​ITabpanel> renderer)` | Sets the tabpanel renderer.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### of

          public static <D> ITabboxController<D> of​(ITabbox owner,
                                                    ListModel<D> model)

      Returns the controller instance with the given `tabbox`, and `ListModel`.
      Parameters:
        `owner` - The controller to control with
        `model` - The data model for the tabbox.

    - #### of

          public static <D> ITabboxController<D> of​(ITabbox owner,
                                                    ListModel<D> model,
                                                    CheckedFunction2<D,​java.lang.Integer,​ITab> tabRenderer,
                                                    CheckedFunction2<D,​java.lang.Integer,​ITabpanel> tabpanelRenderer)

      Returns the controller instance with the given `tabbox`, `ListModel`, tabRenderer, and tabpanelRenderer.
      Parameters:
        `owner` - The controller to control with
        `model` - The data model for the tabbox.
        `tabRenderer` - Tab data renderer
        `tabpanelRenderer` - Tabpanel data renderer.

    - #### ofTabanel

          public static <D> ITabboxController<D> ofTabanel​(ITabbox owner,
                                                           ListModel<D> model,
                                                           CheckedFunction2<D,​java.lang.Integer,​ITabpanel> tabpanelRenderer)

      Returns the controller instance with the given `tabbox`, `ListModel`, and tabpanelRenderer.
      Parameters:
        `owner` - The controller to control with
        `model` - The data model for the tabbox.
        `tabpanelRenderer` - Tabpanel data renderer.

    - #### ofTab

          public static <D> ITabboxController<D> ofTab​(ITabbox owner,
                                                       ListModel<D> model,
                                                       CheckedFunction2<D,​java.lang.Integer,​ITab> tabRenderer)

      Returns the controller instance with the given `tabbox`, `ListModel`, tabRenderer.
      Parameters:
        `owner` - The controller to control with
        `model` - The data model for the tabbox.
        `tabRenderer` - Tab data renderer

    - #### setModel

          public void setModel​(ListModel<DataT> model)

      Description copied from interface: `ItemController`
      Sets the given model to this controller.

      Note: calling this method after `ItemController.build()`, you should invoke `ItemController.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 interface `ItemController<DataT,​ListModel<DataT>,​ITabbox,​ITab>`

    - #### doDataChange

          public void doDataChange​(ListDataEvent event)

    - #### getModel

          public ListModel<DataT> getModel()

      Description copied from interface: `ItemController`
      Returns the model, which is set through by `ItemController.setModel(Object)`, or null.
      Specified by:
        `getModel` in interface `ItemController<DataT,​ListModel<DataT>,​ITabbox,​ITab>`

    - #### setRenderer

          public void setRenderer​(CheckedFunction2<DataT,​java.lang.Integer,​ITab> renderer)

      Description copied from interface: `ItemController`
      Sets the renderer which is used to render each data if `ItemController.getModel()` is not null.

      Note: calling this method after `ItemController.build()`, you should invoke `ItemController.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 interface `ItemController<DataT,​ListModel<DataT>,​ITabbox,​ITab>`

    - #### getRenderer

          public CheckedFunction2<DataT,​java.lang.Integer,​ITab> getRenderer()

      Description copied from interface: `ItemController`
      Returns the renderer, which is set through by `ItemController.setRenderer(CheckedFunction2)`, or a default one which is depended on implementation.
      Specified by:
        `getRenderer` in interface `ItemController<DataT,​ListModel<DataT>,​ITabbox,​ITab>`

    - #### setTabpanelRenderer

          public void setTabpanelRenderer​(CheckedFunction2<DataT,​java.lang.Integer,​ITabpanel> renderer)

      Sets the tabpanel renderer.

    - #### getTabpanelRenderer

          public CheckedFunction2<DataT,​java.lang.Integer,​ITabpanel> getTabpanelRenderer()

      Returns the tabpanel renderer.

    - #### build

          public ITabbox build()

      Description copied from interface: `ItemController`
      Returns the immutable instance that the controller to build with
      Specified by:
        `build` in interface `ItemController<DataT,​ListModel<DataT>,​ITabbox,​ITab>`

    - #### clear

          public void clear()

      Description copied from interface: `ItemController`
      Clears all the rendered data.
      Specified by:
        `clear` in interface `ItemController<DataT,​ListModel<DataT>,​ITabbox,​ITab>`

    - #### getSelectedIndex

          public int getSelectedIndex()

      Returns the selected index.

    - #### setSelectedIndex

          public void setSelectedIndex​(int value)

      Sets the selected index.

    - #### getSelectedObject

          public DataT getSelectedObject()

      Returns the data object which is selected or null.

      Default: `null`

    - #### setSelectedObject

          public void setSelectedObject​(DataT data)

      Sets the selected data object, or deselects it by passing a null value.
      Parameters:
        `data` - The data object that contains in the model.