Enhancement
Major
#24044
Replace hardcoded icon references with theme variables
No icon references to resource icons or CSS icons may exist. Corresponding references in configurations must be replaced(WEB-INF/layout/**/*.xml, WEB-INF/model/**/*.xml, WEB-INF/conf/**/*.xml). Corresponding code constants must be replaced by icon 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 only needs to be done to make an application optimally theme-able.
- Replace icon references in layout XML, model XML and application configuration with theme variables (instead of /my/icon.png, use the theme variable theme:MY_ICON and make a corresponding <icon name="MY_ICON" value="/my/icon.png"/> in the `theme-settings.xml of the module that defines the icon (if not already present).
- The miration 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 by the application code. Instead, create a ThemeImage pseudo-constant in an icon definition file.
Test
test.com.top_logic.layout.TestNoHardIconReferences