ZK framework
- 2. Why ZK?
- Web based, cross browser
- Java OS
- Active and large community
- New releases every two months
- Easy to learn
- Uses Ajax for synchronisation client/server
- Desktop metaphore within browser
- Event driven model
- Component based
- Uses XML user interface markup language (XUL)
- Integration with Spring/Hibernate
- 5. ZK scripting
- Supports EL, Java(script), Ruby, Groovy, Python
- Uses BeanShell
- Within zul file
- Within separate zscript file
- Within Java package
- 6. ZK scripting in zul file
<?xml version="1.0" encoding="UTF-8"?>
<?init zscript="login.zs"?>
<zk>
<button label="${c:l('login.form.button.login')} onClick="MessageBox.show("Message");"/>
<button label="${c:l('login.form.button.login')}">
<attribute name="onClick">
Executions.getCurrent().sendRedirect(“show_roles.zul");
</attribute>
</button>
<button use="CLoginBtn" label="${c:l('login.form.button.login')}"/>
<button use="nl.surf.emergo.control.CLoginBtn" label="${c:l('login.form.button.login')}"/>
</zk>
- 7. ZK scripting in zscript file
import org.zkoss.zul.Button;
import org.zkoss.zk.ui.Executions;
public class CLoginBtn extends Button {
public void onClick() {
Executions.getCurrent().sendRedirect(“show_roles.zul");
}
}
- 11. ZK (dis)advantages
- Extensive set UI components
- Quick prototyping using script
- Script as well as pure Java
- Script to Java if to slow
- Synchronisation client/server
- Scripting (BeanShell) to slow for complex pages
- Changing default style sheet not easy