package com.iwobanas.controls.dataGridClasses
{
import com.iwobanas.core.ISearchable;
import mx.controls.dataGridClasses.DataGridItemRenderer;
/**
* The BoldSearchItemRenderer class defines a item renderer for search enabled DataGrid.
* The only difference compared to default DataGridItemRenderer is that the BoldSearchItemRenderer
* when used with DataGrid implementing <code>ISearchable</code> highlights searched text by changing font weight to bold.
*/
public class BoldSearchItemRenderer extends DataGridItemRenderer
{
/**
* @private
*/
override public function validateProperties():void
{
super.validateProperties();
if (listData && listData.owner is ISearchable)
{
var dg:ISearchable = ISearchable(listData.owner);
if (dg.searchExpression)
{
htmlText = listData.label.replace(dg.searchExpression, "<b>$&</b>");
}
else
{
htmlText = listData.label;
}
}
}
}
}