Useful Java Utilities"

From Documentation
Line 7: Line 7:
 
=Executions=
 
=Executions=
 
[http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Executions.html org.zkoss.zk.ui.Executions]
 
[http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Executions.html org.zkoss.zk.ui.Executions]
 +
 +
===getCurrent===
 +
[http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Executions.html#getCurrent() Executions.getCurrent()]
 +
 +
Retrieves the current execution (request/response).
 +
 +
===createComponents===
 +
[http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Executions.html#createComponents%28java.lang.String,%20org.zkoss.zk.ui.Component,%20java.util.Map%29 Executions.createComponents()]
 +
 +
With this method, you can create components defined in another zul file and attach them to the current page.
 +
 +
===sendRedirect===
 +
[http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Executions.html#sendRedirect%28java.lang.String%29 Executions.sendRedirect()]
 +
 +
Redirects to another URL. If the parameter is left null, it will redirect to the current page.
  
 
=Sessions=
 
=Sessions=
 
[http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Sessions.html org.zkoss.zk.ui.Sessions]
 
[http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Sessions.html org.zkoss.zk.ui.Sessions]
 +
 +
===getCurrent===
 +
[http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Sessions.html#getCurrent() Sessions.getCurrent()]
 +
 +
Retrieves the current session.
  
 
=Clients=
 
=Clients=
Line 45: Line 65:
 
===showNotification===
 
===showNotification===
 
[http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/util/Clients.html#showNotification(java.lang.String) Clients.showNotification()]
 
[http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/util/Clients.html#showNotification(java.lang.String) Clients.showNotification()]
 +
 +
Show a notification box, which is dismissed upon left click (like Popup). You can either display a global notification (bigger) or one specific to another component (smaller with arrow pointing to it). You can also specify its position, style, and duration (for auto-dismiss).
 +
 +
<source lang="java">
 +
Clients.showNotification(msg);
 +
</source>
 +
 +
// TODO
  
 
=Version History=
 
=Version History=

Revision as of 04:46, 29 March 2012


Useful Java Utilities


In this section we introduce some of the most commonly used Java utility classes.

Executions

org.zkoss.zk.ui.Executions

getCurrent

Executions.getCurrent()

Retrieves the current execution (request/response).

createComponents

Executions.createComponents()

With this method, you can create components defined in another zul file and attach them to the current page.

sendRedirect

Executions.sendRedirect()

Redirects to another URL. If the parameter is left null, it will redirect to the current page.

Sessions

org.zkoss.zk.ui.Sessions

getCurrent

Sessions.getCurrent()

Retrieves the current session.

Clients

org.zkoss.zk.ui.util.Clients

This class offers a collection of methods which manipulate client side via AU Response.

evalJavaScript

Clients.evalJavaScript()

This method sends an AU Response to execute the given JavaScript on client side, which is the standard way of calling JavaScript from server side in ZK. For example,

Clients.evalJavaScript("zk.log('Hi.');");

scrollIntoView

Clients.scrollIntoView()

Scrolls the parent of the given component, so the given one become visible in the view.

showBusy/clearBusy

Clients.showBusy()

Clients.clearBusy()

Display/dismiss a busy icon, so user knows server is working or has finished working on something. For example,

Clients.showBusy(window, "Waiting for server...");

ZKDevRef UIPattern UsefulJavaUtil Clients showBusy.png

showNotification

Clients.showNotification()

Show a notification box, which is dismissed upon left click (like Popup). You can either display a global notification (bigger) or one specific to another component (smaller with arrow pointing to it). You can also specify its position, style, and duration (for auto-dismiss).

Clients.showNotification(msg);

// TODO

Version History

Last Update : 2012/03/29


Version Date Content
     


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