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
(withOpenData
) 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 causesSelf
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.
-
-
-
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 forITreeitem
to open or close a treeitem to get its tree path.- Returns:
-
getReference
public Locator getReference()
Returns the reference that causesSelf
to be opened.It is
null
, if the open event is not caused by opening a context menu, a tooltip or a popup.
Note: theonOpen
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 testisOpen()
orgetReference()
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 othercombo-type
input don't send theonChange
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, forICombobox
andIBandbox
, the returned value is a non-null String instance.
-
-