8 Integration - Reference Documentation
Authors: groovyquan
Version: 0.5.1
8 Integration
8.1 ZK EE
ZK UI supports ZK Enterprise features.Just put the zk ee jar tolibs
or put jar dependencies in grails-app/conf/BuildConfig.groovyYou can also install the Enterprise edition by
$ grails install-plugin zk-ee
8.2 ZK Themes
How to use
You can simply put theme jar inlib
directory.Or add dependencies in grails-app/conf/BuildConfig.groovy
First, add zkoss' maven Dependency Repositories
repositories {
…
mavenRepo "http://mavensync.zkoss.org/maven2/"
…
}
Second,specify dependencies
dependencies { // there are three theme 'breeze', 'sapphire', 'silvertail' def zkThemeVersion="6.0.1" def zkTheme="breeze" runtime "org.zkoss.theme:${zkTheme}:${zkThemeVersion}" }
How to switch different themes dynamically
The default theme provider checks the current theme settings in order of preferences;First priority: Cookie
Set cookie zktheme=nameFor instance, write cookie zktheme=breeze, breeze theme will be activatedSecond priority: Library property
The default theme provider will obtain the current theme setting from library property if cookie is empty.<library-property> <name>org.zkoss.theme.preferred</name> <value>name</value> </library-property>
<library-property> <name>org.zkoss.theme.preferred</name> <value>breeze</value> </library-property>
Third priority: System's default them
The default theme provider maintains a default theme. If theme provider can't find theme setting in cookie or library property, default theme will be activated.Dynamically switch themes using cookie
Here are a list of cookie sample codes that you can choose from.Breeze
Themes.setTheme(Executions.getCurrent(), "breeze") Executions.sendRedirect(null)
Sapphire
Themes.setTheme(Executions.getCurrent(), "sapphire") Executions.sendRedirect(null)
Silvertail
Themes.setTheme(Executions.getCurrent(), "silvertail") Executions.sendRedirect(null)
Dynamically switch themes using library property
Breeze
Library.setProperty("org.zkoss.theme.preferred", "breeze") Executions.sendRedirect(null)
Sapphire
Library.setProperty("org.zkoss.theme.preferred", "sapphire") Executions.sendRedirect(null)
Silvertail
Library.setProperty("org.zkoss.theme.preferred", "silvertail") Executions.sendRedirect(null)
Retrieve web app supported theme names
String names = Library.getProperty("org.zkoss.theme.names");
Reference
ZK Themes GetStarted8.3 ZK Extensions Component
You can extends the org.grails.plugins.zkui.AbstractTagLib implement the Extensions Component's Taglib same as:import org.grails.plugins.zkui.AbstractTagLibclass CalendarsTagLib extends AbstractTagLib { static namespace = "z" def calendars = { attrs, body -> doTag(attrs, body, "calendars") }}
lib