public class OpenEvent extends Event
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.
Constructor and Description |
---|
OpenEvent(java.lang.String name,
Component target,
boolean open)
Constructs an onOpen event.
|
OpenEvent(java.lang.String name,
Component target,
boolean open,
Component ref)
Constructs an onOpen event for a context menu, a tooltip or a popup.
|
OpenEvent(java.lang.String name,
Component target,
boolean open,
Component ref,
java.lang.Object value)
Constructs an onOpen event.
|
Modifier and Type | Method and Description |
---|---|
static OpenEvent |
getOpenEvent(AuRequest request)
Converts an AU request to an open event.
|
Component |
getReference()
Returns the reference that causes
Event.getTarget()
to be opened. |
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.
|
getData, getEvent, getName, getPage, getTarget, isPropagatable, stopPropagation, toString
public OpenEvent(java.lang.String name, Component target, boolean open)
open
- whether the new status is openpublic OpenEvent(java.lang.String name, Component target, boolean open, Component ref)
target
- the component being openedref
- the component that causes target to be opened.public OpenEvent(java.lang.String name, Component target, boolean open, Component ref, java.lang.Object value)
open
- whether the new status is openvalue
- the current value of the target component if applicable.getValue()
public static final OpenEvent getOpenEvent(AuRequest request)
public Component getReference()
Event.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()
or getReference()
before accessing the returned value.
if (event.isOpen()) doSome(event.getReference());
public boolean isOpen()
public java.lang.Object getValue()
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.
Copyright © 2005-2023 Potix Corporation. All Rights Reserved.