Set themes
The Controller SPI allows you to set themes on modifiable instances
that implement the ThemeSetter interface, for example ContentPage and ContentLabel.
To set themes, proceed by the following steps:
- Obtain a modifiable instance of the resource for which you want
to set a theme.
- Obtain a Theme object from the ThemeList model.
- Check whether the resource implements the ThemeSetter interface. To do this, use the operator instanceof. If the resource
does not implement the ThemeSetter interface, you cannot
set the theme.
- Use the setTheme() method to set the theme.
Example - Setting a theme for a content page (error handling
omitted):final Modifiable modifiable = cmController.getModifiableNode(page);
// obtain theme to set from com.ibm.portal.admin.ThemeList
final Theme theme = ...
// set theme
if (modifiable instanceof ThemeSetter) {
((ThemeSetter) modifiable).setTheme(theme);
}
Parent topic: Modifying properties
Related information
Set titles and descriptions
Set unique names
Set metadata
Set supported markups
Set the orientation for layout containers
Set portlet preferences
Set flags
Set URLs
|
|
|