Class OpenEvent
- All Implemented Interfaces:
Serializable
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 event,
nothing will happen at the client. By default, the component is
detached when receiving this event.
On the other hand, Events.ON_OPEN (with OpenEvent) is
a notification. It is sent to notify the server that the client has
opened or closed something.
And, the server can not prevent the client from opening or closing.
- Author:
- tomyeh
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an onOpen event.Constructs an onOpen event for a context menu, a tooltip or a popup.Constructs an onOpen event. -
Method Summary
Modifier and TypeMethodDescriptionstatic final OpenEventgetOpenEvent(AuRequest request) Converts an AU request to an open event.Returns the reference that causesEvent.getTarget()to be opened.getValue()Returns the value of the target component, when the onOpen event is sent, or null if not applicable.booleanisOpen()Returns whether it causes open.Methods inherited from class org.zkoss.zk.ui.event.Event
getData, getEvent, getName, getPage, getTarget, isPropagatable, stopPropagation, toString
-
Constructor Details
-
OpenEvent
Constructs an onOpen event.- Parameters:
open- whether the new status is open
-
OpenEvent
Constructs an onOpen event for a context menu, a tooltip or a popup.- Parameters:
target- the component being openedref- the component that causes target to be opened.
-
OpenEvent
Constructs an onOpen event.- Parameters:
open- whether the new status is openvalue- the current value of the target component if applicable.- Since:
- 3.5.0
- See Also:
-
-
Method Details
-
getOpenEvent
Converts an AU request to an open event.- Since:
- 5.0.0
-
getReference
Returns the reference that causesEvent.getTarget()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 event 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()orgetReference()before accessing the returned value.if (event.isOpen()) doSome(event.getReference()); -
isOpen
public boolean isOpen()Returns whether it causes open. -
getValue
Returns the value of the target component, when the onOpen event is sent, or null if not applicable.Note: combobox, bandbox and other combo-type input don't send the onChange event 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 combobox and bandbox, the return value is a non-null String instance.
- Since:
- 3.5.0
-