org.zkoss.zk.ui.event
Class EventQueues

java.lang.Object
  extended by org.zkoss.zk.ui.event.EventQueues

public class EventQueues
extends java.lang.Object

Utilities to access the event queue.

Customization:

The implementation of EventQueue and even the scope are customizable. To customize, specify the name of a class implementing EventQueueProvider in the library property called "org.zkoss.zk.ui.event.EventQueueProvider.class". For example, you can use JMS to extend the queue to be able to communicate with applications running in different JVM.

Since:
5.0.0
Author:
tomyeh

Field Summary
static java.lang.String APPLICATION
          Represenets the event queue in the application scope.
static java.lang.String DESKTOP
          Represents the event queue in the desktop scope.
static java.lang.String SESSION
          Represenets the event queue in the sessionscope.
 
Constructor Summary
EventQueues()
           
 
Method Summary
static boolean exists(java.lang.String name)
          Tests if the specified event queue has been created in the current desktop.
static boolean exists(java.lang.String name, java.lang.String scope)
          Tests if the specified event queue has been created.
static EventQueue lookup(java.lang.String name)
          Returns the desktop-level event queue with the specified name in the current desktop, or if no such event queue, create one.
static EventQueue lookup(java.lang.String name, boolean autoCreate)
          Returns the desktop-level event queue with the specified name in the current desktop.
static EventQueue lookup(java.lang.String name, java.lang.String scope, boolean autoCreate)
          Returns the event queue with the specified name in the specified scope.
static boolean remove(java.lang.String name)
          Removes the event queue.
static boolean remove(java.lang.String name, java.lang.String scope)
          Removes the event queue of the specified scope
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DESKTOP

public static final java.lang.String DESKTOP
Represents the event queue in the desktop scope. In other words, the events published to this kind of queues can be passed around only in the same desktop.

See Also:
Constant Field Values

APPLICATION

public static final java.lang.String APPLICATION
Represenets the event queue in the application scope. In other words, the events published to this kind of queues can be passed around to any desktops of the same application.

Notice that this feature requires ZK PE or EE, or you have to provide your own implementation.

See Also:
Constant Field Values

SESSION

public static final java.lang.String SESSION
Represenets the event queue in the sessionscope. In other words, the events published to this kind of queues can be passed around to any desktops of the same session.

Notice that this feature requires ZK PE or EE, or you have to provide your own implementation.

See Also:
Constant Field Values
Constructor Detail

EventQueues

public EventQueues()
Method Detail

lookup

public static EventQueue lookup(java.lang.String name,
                                java.lang.String scope,
                                boolean autoCreate)
Returns the event queue with the specified name in the specified scope.

There are two kinds of event scopes: DESKTOP and APPLICATION.

If the desktop scope is selected, the event queue is associated with the desktop of the current execution. And, the event queue is gone if the desktop is removed, or removed manually by remove(java.lang.String).

If the application scope is selected, the event queue is associated with the application, and remains until the application stops or removed manually by remove(java.lang.String). When an execution subscribes an event queue, the server push is enabled automatically.

Note:

Parameters:
name - the queue name.
scope - the scope fo the event queue. Currently, it supports DESKTOP and APPLICATION.
autoCreate - whether to create the event queue if not found.
Returns:
the event queue with the associated name, or null if not found and autoCreate is false
Throws:
java.lang.IllegalStateException - if not in an activated execution
java.lang.UnsupportedOperationException - if the scope is not supported

lookup

public static EventQueue lookup(java.lang.String name,
                                boolean autoCreate)
Returns the desktop-level event queue with the specified name in the current desktop. It is a shortcut of lookup(name, DESKTOP, autoCreate).


lookup

public static EventQueue lookup(java.lang.String name)
Returns the desktop-level event queue with the specified name in the current desktop, or if no such event queue, create one. It is a shortcut of lookup(name, DESKTOP, true).


exists

public static boolean exists(java.lang.String name,
                             java.lang.String scope)
Tests if the specified event queue has been created.


exists

public static boolean exists(java.lang.String name)
Tests if the specified event queue has been created in the current desktop. It is a shortcut of exists(name, DESKTOP)


remove

public static boolean remove(java.lang.String name)
Removes the event queue. It is the same as remove(name, DESKTOP).

Parameters:
name - the queue name.
Returns:
true if it is removed successfully

remove

public static boolean remove(java.lang.String name,
                             java.lang.String scope)
Removes the event queue of the specified scope

Parameters:
name - the queue name.
scope - the scope fo the event queue. Currently, it supports DESKTOP and APPLICATION.
Returns:
true if it is removed successfully


Copyright © 2005-2009 Potix Corporation. All Rights Reserved. SourceForge.net Logo