Package org.zkoss.stateless.action.data

## Class OpenData

- java.lang.Object
- - org.zkoss.stateless.action.data.OpenData

- All Implemented Interfaces:
    `java.io.Serializable`, `ActionData`

      public class OpenData
      extends java.lang.Object
      implements ActionData

  Represents an action data cause by user's opening or closing something at the client.

  Note: it is a bit confusing but `Events.ON_CLOSE` is sent when user clicks a close button. It is a request to ask the server to close a window, a tab or others. If the server ignores the action, nothing will happen at the client.

  On the other hand, `Events.ON_OPEN` (with `OpenData`) is a notification. It is sent to notify the server that the client has opened or closed something. And, the server cannot prevent the client from opening or closing.

  Author:
    jumperchen
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `OpenData()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Locator` | `getReference()` | Returns the reference that causes `Self` to be opened.
    `int[]` | `getReferencePath()` | Returns the reference path if any.
    `java.lang.Object` | `getValue()` | Returns the value of the target component, when the onOpen event is sent, or null if not applicable.
    `boolean` | `isOpen()` | Returns whether it causes open.

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

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

- - ### Constructor Detail

    - #### OpenData

          public OpenData()

  - ### Method Detail

    - #### isOpen

          public boolean isOpen()

      Returns whether it causes open.

    - #### getReferencePath

          public int[] getReferencePath()

      Returns the reference path if any. This method is used for `ITreeitem` to open or close a treeitem to get its tree path.
      Returns:

    - #### getReference

          public Locator getReference()

      Returns the reference that causes `Self` to be opened.

      It is `null`, if the open event is not caused by opening a context menu, a tooltip or a popup.
      Note: the `onOpen` action is also sent when closing the context menu (tooltip and popup), and this method returns null in this case. Thus, it is better to test `isOpen()` or `getReference()` before accessing the returned value. `if (event.isOpen()) doSome(event.getReference());`

    - #### getValue

          public java.lang.Object getValue()

      Returns the value of the target component, when the onOpen event is sent, or null if not applicable.

      Note: `ICombobox`, `IBandbox` and other `combo-type` input don't send the `onChange` action when the dropdown is opened (`onOpen`). Thus, if you want to do something depends on the value, use the value returned by this method. Furthermore, for `ICombobox` and `IBandbox`, the returned value is a non-null String instance.