This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

--Using PlatformTheme

Information about development with ProjX.

--Using PlatformTheme

Postby Development@SIB » Tue Apr 08, 2014 3:00 pm



This article is outdated - please use our new system at

https://doc.sibvisions.com




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 runing 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:

Code: Select all
<?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>

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

Code: Select all
UIImage.getImage(UIImage.LOGIN_SMALL);


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

Code: Select all
<entry key="/com/company/app/images/car.png">/com/company/app/images/ios/car.png</entry>

If your code contains

Code: Select all
UIImage.getImage(/com/company/app/images/car.png");
User avatar
Development@SIB
 
Posts: 325
Joined: Mon Sep 28, 2009 1:54 pm

Return to Documentation