Understanding the Theming Subsystem"

From Documentation
m
 
(13 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
{{ZKDevelopersReferencePageHeader}}
 
{{ZKDevelopersReferencePageHeader}}
  
{{Template:UnderConstruction}}
+
The collection of the components' stylesheets and associated images is called a theme. Themes control the overall look and feel of a page composed of ZK components. For example, the components using the standard sapphire theme will all follow the same blue-ish color scheme.
  
== Overview ==
+
Starting from ZK 6.5.2, supporting different themes takes a more modularized approach. '''Theme Support Subsystem''' breaks up into a few pluggable modules: '''ThemeRegistry''', '''ThemeResolver''', and '''ThemeProvider'''. ThemeRegistry keeps track of a list of available themes to use. ThemeResolver is responsible for setting and obtaining the current theme. ThemeProvider allows web developers to manipulate the CSS stylesheets actually employed to style the UI components. Customizing these modules enables web developers to modify any part of the theme processing pipeline to fit their particular requirement.
  
The collection of the components' styles and associated images is called a theme. Theme controls the overall look and feel of a page composed of ZK components. For example, all the components using the standard sapphire theme have the same blue-ish glow appeal.
+
'''Theme Support Subsystem''' is illustrated by the figure below. In addition to the three pluggable modules, there also exist facilities to encapsulate theme information and resolve URLs for locating theme resources.  
  
== Information about a Theme ==
+
Please refer to the subsections for more information on the constituent parts.
  
Available in ZK 6.5.2+
+
[[File:ThemeSubsystem.png|900px]]
  
Apart from having a name, a theme could be associated with many attributes. Standard themes have additional attributes like a more descriptive name for displaying purposes, a priority value to help the system choose the theme to use, and a origin of the theme's resources (i.e. CSS and image files). Web developers could also add more information about a theme, if so desired.
+
{{ZKDevelopersReferenceHeadingToc}}
 
 
== Registering your Theme ==
 
 
 
Before using a theme, it must be registered so that the system knows about its existence and where to retrieve its resources (from a jar file or from a folder). Web developers could also modify the theme registration process by writing a ThemeRegistry, if their application requires it.
 
 
 
== Switching Themes ==
 
 
 
The user could switch to any registered themes by setting a cookie or a library property. Web developers could also add other ways for setting the current theme by writing a custom ThemeResolver.
 
 
 
== Providing Theme Resources ==
 
 
 
After switching to another theme, ThemeProvider is responsible for getting the correct stylesheets to the client. This is done by manipulating the list of widget stylesheets comprising the theme. Web developers could create a custom ThemeProvider to change the caching for the widget stylesheets, inject additional widget stylesheets, reject unwanted widget stylesheets, and/or replace some widget stylesheets with another set.
 
 
 
== Resolving Theme URLs ==
 
Themes comprises of stylesheets and images. The URLs for those resources must be resolved once the theme changes. There are utility methods created for this purpose.
 
  
 
{{ZKDevelopersReferencePageFooter}}
 
{{ZKDevelopersReferencePageFooter}}

Latest revision as of 09:33, 31 January 2024


Understanding the Theming Subsystem


The collection of the components' stylesheets and associated images is called a theme. Themes control the overall look and feel of a page composed of ZK components. For example, the components using the standard sapphire theme will all follow the same blue-ish color scheme.

Starting from ZK 6.5.2, supporting different themes takes a more modularized approach. Theme Support Subsystem breaks up into a few pluggable modules: ThemeRegistry, ThemeResolver, and ThemeProvider. ThemeRegistry keeps track of a list of available themes to use. ThemeResolver is responsible for setting and obtaining the current theme. ThemeProvider allows web developers to manipulate the CSS stylesheets actually employed to style the UI components. Customizing these modules enables web developers to modify any part of the theme processing pipeline to fit their particular requirement.

Theme Support Subsystem is illustrated by the figure below. In addition to the three pluggable modules, there also exist facilities to encapsulate theme information and resolve URLs for locating theme resources.

Please refer to the subsections for more information on the constituent parts.

ThemeSubsystem.png





Last Update : 2024/01/31

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