Developing WebUI Themes
This page describes a workflow that applies to older iDempiere versions (pre-9). Some tooling details (Buckminster, target platform setup) have changed. The overall approach of using an OSGi fragment attached to org.adempiere.ui.zk is still valid, but refer to the current iDempiere documentation for the latest build setup.
Purpose
Customize the WebUI by replacing images or changing CSS without touching core using an OSGi fragment project.
Prerequisites
Before you start, review the following tutorials:
- Developing Plug-Ins Without Affecting the Core
- Running Plug-ins Locally in iDempiere
- Distributing and Installing Plug-ins
Creating the fragment
New Fragment project
In Eclipse, go to File > New > Other > Plug-in Development > Fragment Project:
- Name:
org.evenos.newtheme - Location: use a directory outside the iDempiere workspace (keep plug-ins separate)
- Target Platform: OSGi Equinox
- Execution environment: JavaSE-11
- Host Plug-in:
org.adempiere.ui.zk
Create the new theme
Base the theme on iDempiere's default theme:
- Create a folder called
themein the project root, and inside it create a subfolder for your theme (e.g.newtheme). - Copy all resources from
org.adempiere.ui.zk/theme/defaultintotheme/newtheme. - Replace images in
theme/newtheme/imagesor modify CSS files.
Some .zul files in theme/newtheme/zul contain hard-coded resource paths. Update file paths there if necessary.
Configure MANIFEST.MF
In your MANIFEST.MF:
- Overview tab: check This fragment is a singleton.
- Runtime tab > Classpath: click Add and select the
themefolder. - Build tab: make sure the theme folder is checked under Binary Build.
- MANIFEST.MF tab: add this line at the end (followed by a newline):
Jetty-WarFragmentFolderPath: /
Save the manifest.
Testing locally in Eclipse
To test the theme fragment in Eclipse:
- Open Run Configurations, select the server.product, go to the Plug-ins tab, and check your theme fragment to activate it.
- Go to the Arguments tab and add to VM arguments:
-DZK_THEME=newtheme
- Run the server.
- Log in as SuperUser with the System role, open the System Configurator window, search for
ZK_THEME, and change the Configured Value fromdefaulttonewtheme. Save. - Click Change Role (or select the same role again) to apply the theme.
You can also set the browser title by adding a ZK_BROWSER_TITLE key in System Configurator.
Installing on the server
Export your theme fragment (via a feature project or by right-clicking the fragment and using Export > Deployable plug-ins and fragments), then install it following the distributing plug-ins guide.
After installation:
- In the Apache Felix Web Console, confirm that your fragment shows the state Fragment (refresh packages if needed).
- Refresh the
org.adempiere.ui.zkbundle to apply the changes. - Log in as SuperUser with the System role, open System Configurator, and change
ZK_THEMEto your theme name. Save. - Click Change Role to load the new theme.
If the theme or images don't change, flush your browser cache. If that doesn't help, recycle the application.
See also
- Update your development environment (zk7 branch): there is a known issue with fragments caused by the move from Tomcat to Jetty.