Class OpenData

java.lang.Object
org.zkoss.stateless.action.data.OpenData
All Implemented Interfaces:
Serializable, ActionData

public class OpenData extends 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:
  • Constructor Details

    • OpenData

      public OpenData()
  • Method Details

    • 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 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.