org.zkoss.zk.ui.event
Class OpenEvent

java.lang.Object
  extended by org.zkoss.zk.ui.event.Event
      extended by org.zkoss.zk.ui.event.OpenEvent

public class OpenEvent
extends Event

Represents an event cause by user's openning 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 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:
Openable

Constructor Summary
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.
 
Method Summary
 Component getReference()
          Returns the reference that is the component causing Event.getTarget() to be opened.
 boolean isOpen()
          Returns whether it causes open.
 
Methods inherited from class org.zkoss.zk.ui.event.Event
getData, getName, getPage, getTarget, isPropagatable, stopPropagation, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OpenEvent

public OpenEvent(java.lang.String name,
                 Component target,
                 boolean open)
Constructs an onOpen event.

Parameters:
open - whether the new status is open

OpenEvent

public OpenEvent(java.lang.String name,
                 Component target,
                 boolean open,
                 Component ref)
Constructs an onOpen event for a context menu, a tooltip or a popup.

Parameters:
target - the component being opened
ref - the component that causes target to be opened.
Method Detail

getReference

public Component getReference()
Returns the reference that is the component causing 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());


isOpen

public final boolean isOpen()
Returns whether it causes open.



Copyright © 2005-2007 Potix Corporation. All Rights Reserved.