Client Activity Watches"

From Documentation
m
Line 10: Line 10:
  
 
=Listen and Unlisten=
 
=Listen and Unlisten=
 +
 +
To add a watch (i.e., listen to a client activity), you could use <javadoc method="listen(_global_.Map)" directory="jsdoc">_global_.zWatch</javadoc> as follows:
 +
 +
<source lang="java">
 +
zWatch.listen({
 +
    onSize: this,
 +
    onShow: this,
 +
    onHide: [this, this._onHide]
 +
});
 +
</source>
 +
 +
As shown, the key of each entry in the given map is the name of the client activity (aka., the watch name), and the value could be one of the following:
 +
 +
* An object that has a method with the same name. In the above case, '''this''' must have the <tt>onSize</tt> and <tt>onSHow</tt> methods
 +
* A two-element array, where the first element is the target, and the second is the method
 +
 +
The signature of the method is as follows.
 +
 +
<source lang="java">
 +
function onWhatever(ctl, arg0, arg1...) {
 +
}
 +
</source>
 +
 +
where <tt>ctl</tt> is a controller allowing you to have better control of the invocation sequence of the listeners, and <tt>arg0</tt> and others are the arguments that passed to <javadoc method="fire(_global_.String, java.lang.Object, _global_.Map, java.lang.Object...)" directory="jsdoc">_global_.zWatch</javadoc> or <javadoc method="fireDown(_global_.String, java.lang.Object, _global_.Map, java.lang.Object...)" directory="jsdoc">_global_.zWatch</javadoc>.
 +
 +
To unlisten, you could use <javadoc method="unlisten(_global_.Map)" directory="jsdoc">_global_.zWatch</javadoc> as follows:
 +
 +
<source lang="java">
 +
zWatch.unlisten({
 +
    onSize: this,
 +
    onShow: this,
 +
    onHide: [this, this._onHide]
 +
});
 +
</source>
 +
 
=Client Activities=
 
=Client Activities=
 
== beforeSize ==
 
== beforeSize ==

Revision as of 11:51, 1 December 2010


Client Activity Watches


In most cases, a widget or an application needs only to listen Event as described in the Client-side Event listening section. However, there are some activities not available as a DOM event (Event) or a ZK event (Event)[1], such as when a widget is becoming invisible, or a window is brought to top. This kind of activity can be listened by so-called watch (zWatch)


  1. A ZK event is a wrapper of a DOM event to provide more functionality. A DOM event is caused by the browser, and is actually a wrapper class from jQuery to encapsulate the browser's incompatibility.

Listen and Unlisten

To add a watch (i.e., listen to a client activity), you could use zWatch.listen(Map) as follows:

zWatch.listen({
    onSize: this,
    onShow: this,
    onHide: [this, this._onHide]
});

As shown, the key of each entry in the given map is the name of the client activity (aka., the watch name), and the value could be one of the following:

  • An object that has a method with the same name. In the above case, this must have the onSize and onSHow methods
  • A two-element array, where the first element is the target, and the second is the method

The signature of the method is as follows.

function onWhatever(ctl, arg0, arg1...) {
}

where ctl is a controller allowing you to have better control of the invocation sequence of the listeners, and arg0 and others are the arguments that passed to zWatch.fire(String, Object, Map) or zWatch.fireDown(String, Object, Map).

To unlisten, you could use zWatch.unlisten(Map) as follows:

zWatch.unlisten({
    onSize: this,
    onShow: this,
    onHide: [this, this._onHide]
});

Client Activities

beforeSize

onBindLevelChange

onHide

onFloatUp

onResponse

onScroll

onSend

onSize

onShow

Version History

Last Update : 2010/12/01


Version Date Content
     



Last Update : 2010/12/01

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.