本文描述如何在ADF项目中使用自定义SKIN。
1.新建ADF项目
2.在Jdeveloper中引入XML Schema
进入菜单——Tools——Preference——XML Schemas
单击添加按钮,将MW_HOME/oracle_common/modules/oracle.adf.view_11.1.1/trinidad-impl.jar!/org/apache/myfaces/trinidadinternal/ui/laf/xml/schemas/skin/trinidad-skins.xsd文件引入。如上图所示。
3. 注册自定义Skin
新建Skin的XML文件,步骤见下图
4. 编辑XML
<?xml version="1.0" encoding="UTF-8" ?>
<skins xmlns="http://myfaces.apache.org/trinidad/skin">
<skin>
<id>richdemo.desktop</id>
<family>richDemo</family>
<extends>fusion.desktop</extends>
<render-kit-id>org.apache.myfaces.trinidad.desktop</render-kit-id>
<!--
<bundle-name></bundle-name>
-->
<style-sheet-name>skins/richdemo/richdemo.css</style-sheet-name>
</skin>
</skins>
5.配置trinidad-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<trinidad-config xmlns="http://myfaces.apache.org/trinidad/config">
<skin-family>richDemo</skin-family>
</trinidad-config>
6. 编写CSS文件
af|commandButton {font-size: large;}
7. 运行结果
如果想要修改CSS随时生效(不需要重新运行ADF项目),则需要修改如下配置。
web.xml中修改
<context-param>
<description>If this parameter is true, there will be an automatic check of the modification date of your JSPs, and saved state will be discarded when JSP's change. It will also automatically check if your skinning css files have changed without you having to restart the server. This makes development easier, but adds overhead. For this reason this parameter should be set to false when your application is deployed.</description>
<param-name>org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION</param-name>
<param-value>true</param-value>
</context-param>
相关文档:
http://jdevadf.oracle.com/adf-richclient-demo/docs/skin-selectors.html
http://docs.oracle.com/cd/E16764_01/web.1111/b31973/af_skin.htm