定制ADF应用的CSS
2011-06-27(Monday) 00:00
客户的要求总是各种变态,如果需要定制默认的控件样式的话,那么以下的文章可能会对你有帮助。
Step.1 首先我们需要定义自己的CSS文件 CustomSkin.css
af|inputListOfValues::search-icon-style{ background-image:none; }
af|inputListOfValues::search-icon-style:hover{
background-image:none;
}
af|inputListOfValues::search-icon-style:active{
background-image:none;
}
af|inputListOfValues::search-icon-style:info{
background-image:none;
}
Step.2 接着创建 trinidad-skins.xml
<?xml version="1.0" encoding="ISO-8859-1"?> <skins xmlns="http://myfaces.apache.org/trinidad/skin"> <skin> <id>customSkin.desktop</id> <family>CustomSkin</family> <extends>blafplus-rich.desktop</extends> <render-kit-id>org.apache.myfaces.trinidad.desktop</render-kit-id> <style-sheet-name>css/CustomSkin.css</style-sheet-name> </skin> </skins>Step.3 修改 trinidad-config.xml
<skin-family>CustomSkin</skin-family>Step.4 修改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>
<context-param>
<description>No obfuscation of CSS.</description>
<param-name>org.apache.myfaces.trinidad.DISABLE_CONTENT_COMPRESSION</param-name>
<param-value>true</param-value>
</context-param>
重启下应用就会发现控件样式已经采用自定义CSS文件里的样式了!