Package org.zkoss.stateless.state

## Class ICardlayoutController

- java.lang.Object
- - org.zkoss.stateless.state.ICardlayoutController

-     public class ICardlayoutController
      extends java.lang.Object

  An `ICardlayout` controller to control card navigation.

  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
    --- | --- | ---
    `ICardlayout` | `build()` | Returns the immutable cardlayout instance that the controller to build with.
    `int` | `getSelectedIndex()` | Returns the index of the component in viewport.
    `boolean` | `next()` | Navigates to next component if possible.
    `static ICardlayoutController` | `of​(ICardlayout owner)` | Returns the controller instance with the given `cardlayout`
    `boolean` | `previous()` | Navigates to previous component if possible.
    `void` | `setSelectedIndex​(int selectedIndex)` | Sets the selected index with the given selectedIndex.

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

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

- - ### Method Detail

    - #### previous

          public boolean previous()

      Navigates to previous component if possible.

    - #### next

          public boolean next()

      Navigates to next component if possible.

    - #### of

          public static ICardlayoutController of​(ICardlayout owner)

      Returns the controller instance with the given `cardlayout`
      Parameters:
        `owner` - The controller to control with

    - #### build

          public ICardlayout build()

      Returns the immutable cardlayout instance that the controller to build with.

    - #### getSelectedIndex

          public int getSelectedIndex()

      Returns the index of the component in viewport.

    - #### setSelectedIndex

          public void setSelectedIndex​(int selectedIndex)

      Sets the selected index with the given selectedIndex.

      Note: Unlike other component, "deselect" is unnecessary in Cardlayout. So the index value can't be negative, if do so, it will occur an UiException.

      Parameters:
        `selectedIndex` - The index of the component to be displayed in the viewport