How to Add a Custom Skin to an Application How to Register the XML Schema Definition File for a Custom Skin

Customizing the Appearance Using Styles and Skins 20-15 with http:, https:, file:, ftp:, or jar:. Otherwise, the URL is created by calling FacesContext ExternalContext getResourcestyle-sheet-name. It will add a slash to delimit the URL parts if it is not already present. For example, the slash is added between skinsbigfontbigfont.css. – If still not retrieved, the URL is created using the ClassLoader getResource in a style-sheet-name format similar to META-INFpurpleSkinstylesmyPurpleSkin.css. Once the URL is converted to this format, it can be searched for in JAR files that may contain the style sheet. ■ bundle-name This is the resource bundle created for the skin. If you did not create a custom bundle, then you do not need to declare this element. For more information, see Section 20.3.1, How to Apply Skins to Text . ■ translation-source This is an EL binding that can point to a Map or a ResourceBundle. You can use this instead of the bundle name if you would like to be more dynamic in your skin translations at runtime. The bundle-name tag takes precedence. Example 20–4 shows the entry in the trinidad-skins.xml file for the mySkin skin. Example 20–4 Skin Entry in the trinidad-skins.xml File ?xml version=1.0 encoding=ISO-8859-1? skins xmlns=http:myfaces.apache.orgtrinidadskin skin id mySkin.desktop id family mySkin family extendsblafplus-rich.desktopextends render-kit-id org.apache.myfaces.trinidad.desktop render-kit-id style-sheet-name skinsmySkinmySkin.css style-sheet-name bundle-name myBundle bundle-name translation-sourcetranslation-source skin skins 7. Save the file. Note: If you have created localized versions of the resource bundle, then you need to register only the base resource bundle. 20-16 Web User Interface Developers Guide for Oracle Application Development Framework

20.2.4 How to Configure an Application to Use a Custom Skin

You set an element in the trinidad-config.xml file that determines which skin to use, and if necessary, under what conditions. To configure an application to use a skin: 1. Open the trinidad-config.xml file.

2. In the trinidad-config.xml file, write entries to specify the value of the

skin-family element for the skin you want to use and, optionally, the skin-version element. Example 20–5 shows the configuration to use for the mySkin skin family. Example 20–5 Configuration to Use a Skin Family trinidad-config xmlns=http:myfaces.apache.orgtrinidadconfig skin-familymySkinskin-family skin-versionv2skin-version trinidad-config

3. To conditionally set the value, enter an EL expression that can be evaluated to

determine the skin to display. For example, if you want to use the German skin when the user’s browser is set to the German locale, and to use the English skin otherwise, you would have the following entry in the trinidad-config.xml file: skin-family{facesContext.viewRoot.locale.language==de ? german : english}skin-family

4. Save the file.

During development, after you make changes to the custom skin, you can see your CSS changes without restarting the server by setting the web.xml file parameter org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION to true, as shown in Example 20–6 . However, you must always restart the server to see icon and skin property changes. Example 20–6 web.xml Parameter to Check Skin Changes context-param param-nameorg.apache.myfaces.trinidad.CHECK_FILE_MODIFICATIONparam-name param-valuetrueparam-value context-param

20.3 Defining Skin Style Properties

The ADF Faces skin style selectors support multiple options for applying skins to a component to create a custom look and feel to your application. The af:goButton component skin style selectors are described in Table 20–1 . Note: If you do not see the skin, check to see whether or not the af:document tag has been added to the page. The af:document tag initializes the skin framework to create the CSS and link it to the page.