New Features of ZK 6.5.1"

From Documentation
m
Line 30: Line 30:
 
In ZK 6.5.1, the API with onVisibilityChange event was implemented which provides the ability to find out when a page is visible or hidden. This has a lot of benefit as it enables saving of CPU cycles as well as bandwidth. The following is a very simple example:
 
In ZK 6.5.1, the API with onVisibilityChange event was implemented which provides the ability to find out when a page is visible or hidden. This has a lot of benefit as it enables saving of CPU cycles as well as bandwidth. The following is a very simple example:
  
<pre lang="xml">
+
<source lang="xml">
 
<window title="window" border="normal">
 
<window title="window" border="normal">
 
     <attribute name="onVisibilityChange">
 
     <attribute name="onVisibilityChange">
Line 38: Line 38:
 
     <label id="lbl"></label>
 
     <label id="lbl"></label>
 
</window>
 
</window>
</pre>
+
</source>
  
 
For more information please check the blog post [http://blog.zkoss.org/index.php/2012/12/02/control-page-visibility-with-html5-api-in-zk/ here].
 
For more information please check the blog post [http://blog.zkoss.org/index.php/2012/12/02/control-page-visibility-with-html5-api-in-zk/ here].

Revision as of 06:26, 3 December 2012

DocumentationSmall Talks2012DecemberNew Features of ZK 6.5.1
New Features of ZK 6.5.1

Author
Timothy Clare, Potix Corporation
Date
December 4, 2012
Version
ZK 6.5.1

The Default Command for MVVM

ZK 6.5.1 brings a default command for MVVM. When a binder receives a command, it starts to find ViewModel's command methods by matching its name. If the binder cannot find a matched method, it invokes default command method.

Assume that there are only two command methos in the below ViewModel. If we trigger a command "exit", a binder invokes the default command method defaultAction() because it cannot find a command method named "exit".

public class OrderVM {

    @Command
    public void newOrder(){
    ...
    }
  
    @DefaultCommand
    public void defaultAction(){
    ...
    }
}

Control Page visibility with HTML 5 API in ZK

In ZK 6.5.1, the API with onVisibilityChange event was implemented which provides the ability to find out when a page is visible or hidden. This has a lot of benefit as it enables saving of CPU cycles as well as bandwidth. The following is a very simple example:

<window title="window" border="normal">
    <attribute name="onVisibilityChange">
        if (!event.isHidden())
            lbl.setValue("Welcome back");
    </attribute>
    <label id="lbl"></label>
</window>

For more information please check the blog post here.


Download & other resources


Comments



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