|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.zkoss.zk.ui.event.EventQueues
public class EventQueues
Utilities to access the event queue.
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.
Field Summary | |
---|---|
static java.lang.String |
APPLICATION
Represents the event queue in the application scope. |
static java.lang.String |
DESKTOP
Represents the event queue in the desktop scope. |
static java.lang.String |
GROUP
Represents a group of desktops that belongs to the same browser. |
static java.lang.String |
SESSION
Represents the event queue in the sessions cope. |
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
|
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
|
lookup(java.lang.String name,
boolean autoCreate)
Returns the desktop-level event queue with the specified name in the current desktop. |
|
static
|
lookup(java.lang.String name,
Session sess,
boolean autoCreate)
Returns the event queue with the specified name in the give session (i.e., the session scope). |
|
static
|
lookup(java.lang.String name,
java.lang.String scope,
boolean autoCreate)
Returns the event queue with the specified name in the specified scope. |
|
static
|
lookup(java.lang.String name,
WebApp wapp,
boolean autoCreate)
Returns the event queue with the specified name in the give application (i.e., the application scope). |
|
static boolean |
remove(java.lang.String name)
Removes the event queue. |
|
static boolean |
remove(java.lang.String name,
Session sess)
Removes the event queue of the specified session. |
|
static boolean |
remove(java.lang.String name,
java.lang.String scope)
Removes the event queue of the specified scope. |
|
static boolean |
remove(java.lang.String name,
WebApp wapp)
Removes the event queue of the specified application. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DESKTOP
public static final java.lang.String GROUP
Unlike APPLICATION
and SESSION
, it does NOT require
the server push, so there is no overhead.
However, it cannot communicate with desktops that belongs to other top
browser windows/tabs. Since there is no way to detect two desktops
(of the same session) belongs to the same top browser window, the developer
has to make sure of it by himself.
Some portal container, such as Liferay, also forms a group of desktops (they all belongs to the same browser window). Notice that org.zkoss.zkmax.zul.Portallayout is a component and it won't cause additional desktop to be created, unless iframe is used as the content.
Note: this feature requires ZK EE.
public static final java.lang.String APPLICATION
Notice that this feature will enable the server push
(ServerPush
.
Note: according to the ServletContext javadoc - http://docs.oracle.com/javaee/6/api/javax/servlet/ServletContext.html the application scope cannot support under cluster environment. When information needs to be shared between servlets running in a distributed environment, the information should be placed into a session scope.
public static final java.lang.String SESSION
Notice that this feature will enable the server push
(ServerPush
.
Constructor Detail |
---|
public EventQueues()
Method Detail |
---|
public static <T extends Event> EventQueue<T> lookup(java.lang.String name, java.lang.String scope, boolean autoCreate)
There are several kinds of event scopes: DESKTOP
,
GROUP
, SESSION
, and APPLICATION
.
If the DESKTOP
scope is specified, 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 SESSION
or GROUP
scope is specified,
the event queue is associated with the current session.
And, the event queue is gone if the session is invalidated,
or removed manually by remove(java.lang.String)
.
If the APPLICATION
scope is specified, 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 of SESSION
or APPLICATION
, the server push is enabled automatically.
On the other hand, DESKTOP
and GROUP
does NOT
require the server push -- they use the AU requests for communication.
Note:
Executions.getCurrent()
not null.
If you want to use it without an execution, please use
lookup(String, Session, boolean)
or lookup(String, WebApp, boolean)
instead (depending on your scope).
name
- the queue name.scope
- the scope of the event queue. Currently,
it supports DESKTOP
, GROUP
,
SESSION
, and APPLICATION
.
Note: GROUP
requires ZK EE.autoCreate
- whether to create the event queue if not found.
java.lang.IllegalStateException
- if not in an activated execution
java.lang.UnsupportedOperationException
- if the scope is not supportedlookup(String, Session, boolean)
,
lookup(String, WebApp, boolean)
public static <T extends Event> EventQueue<T> lookup(java.lang.String name, Session sess, boolean autoCreate)
Unlike lookup(String, String, boolean)
, this method
can be called without an activated execution.
sess
- the session that the event queue is located (i.e.,
the session scope)lookup(String, String, boolean)
,
lookup(String, WebApp, boolean)
public static <T extends Event> EventQueue<T> lookup(java.lang.String name, WebApp wapp, boolean autoCreate)
Unlike lookup(String, String, boolean)
, this method
can be called without an activated execution.
wapp
- the Web application that the event queue is located (i.e.,
the application scope)lookup(String, String, boolean)
,
lookup(String, Session, boolean)
public static <T extends Event> EventQueue<T> lookup(java.lang.String name, boolean autoCreate)
lookup(name, DESKTOP, autoCreate)
.
public static <T extends Event> EventQueue<T> lookup(java.lang.String name)
lookup(name, DESKTOP, true)
.
public static boolean exists(java.lang.String name, java.lang.String scope)
public static boolean exists(java.lang.String name)
exists(name, DESKTOP)
public static boolean remove(java.lang.String name)
remove(name, DESKTOP)
.
name
- the queue name.
public static boolean remove(java.lang.String name, java.lang.String scope)
name
- the queue name.scope
- the scope of the event queue. Currently,
it supports DESKTOP
, GROUP
,
SESSION
, and APPLICATION
.
Note: GROUP
requires ZK EE.
public static boolean remove(java.lang.String name, Session sess)
Unlike remove(String, String)
, this method
can be called without an activated execution.
name
- the queue name.sess
- the session that the event queue is located (i.e.,
the session scope)
public static boolean remove(java.lang.String name, WebApp wapp)
Unlike remove(String, String)
, this method
can be called without an activated execution.
name
- the queue name.wapp
- the Web application that the event queue is located (i.e.,
the application scope)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |