Saturday, November 10, 2012

OAF:Set Text Color/Highlight record

Lets discuss on some of the common requirements in custom OAF pages

When ever there is a business validation failure display the content(text) in red color/other or mark the text.
This can be achieved by defining a custom css style.

CSSStyle cellBGColor = new CSSStyle();
cellBGColor.setProperty("color","#FF0000");
#FF0000--red color
OAMessageStyledTextBean field12=(OAMessageStyledTextBean)webBean.findChildRecursive("field12");

if(field12 != null )
field12.setInlineStyle(cellBGColor);

-----------------------------------------------------------------

One more requirement was to set color for the records dynamically.
Once user select and submit a record in a advanced table
the region is refreshed and the selected row should be unchecked and record should be highlighted.

That mean when the page refreshes only certain record should be highlighted.



TO achieve this we create a transient attribute in the VO
based on our condition we set the value for it.



--Code in AM
--rowlineVo --row handler
--we try to use existing styles instead of defining new one
rowlineVo.setAttribute("color","OraBGGrayMedium");


--Process request CO
OAMessageStyledTextBean field1 = (OAMessageStyledTextBean)webBean.findChildRecursive("Field1");
OADataBoundValueViewObject css2 = new OADataBoundValueViewObject(field1, "color");
field1.setAttributeValue(UIConstants.STYLE_CLASS_ATTR,css2);

This worked with out any issues..

If you want different colors based on the data we need to use OADataBoundValueViewObject.
OADataBoundValueViewObject css2 = new OADataBoundValueViewObject(field1, "color");

The first parameter the field which we want to apply the color and the second parameter is the vo attribute which need to be used.





4 comments:

Unknown said...

Thank you friend for sharing this oracle query

Unknown said...
This comment has been removed by the author.
Unknown said...

Thanks for Information Oracle Apps Technical is a collection of a bunch of collected applications like accounts payables, purchasing, inventory, accounts receivables, human resources, order management, general ledger and fixed assets, etc which have its own functionality for serving the business.Oracle Apps Technical Online Training

Unknown said...
This comment has been removed by the author.