The PlatformTheme is a special ITheme. It's always active and loads image mappings for the current platform from a mapping (XML) file. This theme could be used to have the same application running on desktop, web, and mobile environments but with different image mappings. The images on mobile devices should, or can, be different to desktop application icons. The PlatformTheme is a built-in mechanism to allow image replacement without writing source code.

The search order for the mapping file is as follows:

  1. Use the package of translation parameter, if set (Application.translation)
  2. Use the package of a custom application class, if there is one
  3. Use the package of a custom theme implementation, if set
  4. Use the package of a custom platform Theme implementation, if set

If the environment is mobile, the directory should contain a file with the name imagemapping_<environment name lowercase>_<os name lowercase>.xml. If there's no such file, the fallback name is imagemapping_<environment name lowercase>.xml. If no imagemapping file was found, nothing will happen.

The file should be a standard Java XML properties file like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
 
<properties>
  <entry key="LOGIN_SMALL">/com/sibvisions/forum/images/ios/login_small.png</entry>
  <entry key="LOGIN_LARGE">/com/sibvisions/forum/images/ios/login.png</entry>
</properties>

The above replacement will change default JVx' image mappings, e.g., if your code contains

UIImage.getImage(UIImage.LOGIN_SMALL);

It's also possible to use a full qualified resource path to change your custom images in your application because not all images were taken from the JVx library:

<entry key="/com/company/app/images/car.png">/com/company/app/images/ios/car.png</entry>

If your code contains

UIImage.getImage(/com/company/app/images/car.png");