Oracle R12 OAF Color
Oracle R12 OAF Color
Framework.
Recently I saw a question in OTN Forum on how to create custom CSS in OA Framework. Its long time I
have done some custom CSS for OA Framework. So thought of putting a blog on how to add custom
CSS for OAF Pages.
Refer the below link for Standard CSS available : Text (CSS) Standards
To get the HTML Color Codes : HTML Color Codes and Names
To add custom style sheet to your application, you need to modify the custom.xss file. The file is available
under $OA_HTML/cabo/styles.
Sample code
Now you can refer the new style in the page using "XXCustomStyle1" for the CSS Class
property of the beans in the page.
#2. Writing code in Controller
import oracle.cabo.style.CSSStyle;
CSSStyle customStyle = new CSSStyle();
customStyle.setProperty("color", "#FFA500");
customStyle.setProperty("font-size", "13pt");
OAMessageDateFieldBean dateBean =
(OAMessageDateFieldBean)webBean.findChildRecursive("DateBean");
dateBean.setInlineStyle(customStyle);
Find the screen shot below to see the output of the above code. First column is based on the
controller code and the 2nd and 3rd columns are based on the custom.xss.
Now, you can also make use of the OADataBoundValueViewObject class to dynamically
change the CSS. I have modified the View Object query to add an extra column
'CustomCssStyleAttr'. I am getting the Custom CSS Style Class as an attribute. In the below
query, we will get 3 different values, XXCustomStyle1, XXCustomStyle2, NULL. The query is as
below.
OAMessageDateFieldBean dateBean =
(OAMessageDateFieldBean)webBean.findChildRecursive("DateBean");
dateBean.setInlineStyle(customStyle);
OAColumnBean customStyleCol =
(OAColumnBean)webBean.findChildRecursive("CustomStyleCol");
OADataBoundValueViewObject customStyleCSS = new
OADataBoundValueViewObject(customStyleCol, "CustomCssStyleAttr");
customStyleCol.setAttributeValue(oracle.cabo.ui.UIConstants.STYLE_CLASS_ATTR,c
ustomStyleCSS);