April 19, 2013

Adding Custom Skins to the application



If you want to add your own style files (CSS files) to a ADF application, please follow the below steps.

  • Create css file under the webcontent folder (css can put under subfolder also)
  • Create a trinidad-skins.xml under WEB-INF folder and create the content like below
<?xml version="1.0" encoding="windows-1252"?>
<skins xmlns="http://myfaces.apache.org/trinidad/skin">
  <skin>
    <id>skin1.desktop</id>
    <family>skin1</family>
    <extends>blafplus-medium.desktop</extends>
    <render-kit-id>org.apache.myfaces.trinidad.desktop</render-kit-id>
    <style-sheet-name>skins/style.css</style-sheet-name>
    <bundle-name>resources.skinBundle</bundle-name>
  </skin>
</skins>

  • Open trinidad-config.xml file under WEB-INF folder and replace the value of the tag <skin-family> with the value of <family> tag in trinidad-skins.xml
Now you can use your CSS file in the application.