Jump to: navigation, search

RAP Theming

Revision as of 10:11, 4 June 2007 by Rsternberg.innoopract.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This article describes the themeing functionality of RWT, the RAP Widget Toolkit. This themeing defines the default look and feel of the basic RWT controls like Shell, Button, Text etc. It must not be mixed up with the themeing of the Eclipse workbench. Instead, it can be compared to the themeing functionality of a desktop system that allows the user to set custom colors for title bars, text background and the like.

State of Development

The RWT themeing mechanism, as introduced with the M4 milestone, is still in an early state of development. Some details are still likely to change, as our experience with this approach grows. Your comments and suggestions are welcome.

Currently, the RWT themeing only allows to define colors. Themeing of icons, fonts, borders, margins etc. will follow shortly.

How to define a custom RWT Theme

1. Create a custom theme file

RWT theme files are simple Java Property files. A template named theme-template.properties can be found in the src/ directory of the RWT plugin (org.eclipse.rap.rwt). You only have to specify those properties that are relevant for you, undefined properties will stay at their default value. Note that some property names are likely to be changed in the future, other properties will emerge and a few properties will even be dropped. Please refer to the template file shipped with your current version.

2. Register the new theme with the extension point org.eclipse.rap.swt.themes

In the plugin.xml of your application project, add an extension like this:

  <extension
      id="my.application.themes"
      point="org.eclipse.rap.swt.themes">
    <theme
        id="my.application.aquablue"
        name="Aqua Blue Test Theme"
        file="aqua-blue.properties"
        default="true"/>
  </extension>

3. Activate the theme

The extension parameter default specifies whether the theme should be active by default. Currently, this is the only way to activate a custom theme. Support for programmatic activation of custom themes is planned for future versions.