enhancement
major
#24044
Replace hardcoded icon references with theme variables
There must be no icon references to resource icons or CSS icons. Any such references in configuration files must be replaced (WEB-INF/layout/**/*.xml, WEB-INF/model/**/*.xml, WEB-INF/conf/**/*.xml). The corresponding code constants must be replaced with Icons constants:
Instead of:
#!java
static final ThemeImage MY_IMAGE = ThemeImage.resourceIcon(".../.png");
Now:
#!java
public class Icons extends IconsBase {
public static ThemeImage MY_IMAGE;
static {
initConstants(Icons.class);
}
}
Code Migration
This migration is optional in that it is only necessary to make an application fully themeable.
- Replace icon references in layout XML, model XML, and application configuration with theme variables (use the theme variable theme:MY_ICON and add a corresponding <ICON name="MY_ICON" value="/my/icon.png"/> to the `theme-settings.xml` of the module that defines the icon (if not already present).
- The migration can be automated by running the Ant task z_migrate_icon_references in the module to be migrated.
- Replace icon references in the code with theme variables or icon constants.
- ThemeImage.icon(String), ThemeImage.resourceIcon(String), and ThemeImage.cssIcon(String) must no longer be called directly from the application code. Instead, create a ThemeImage pseudo-constant in an icon definition file.
Test
test.com.top_logic.layout.TestNoHardIconReferences