{
RendererUtils.checkParamValidity(facesContext, component, HtmlCommandSortHeader.class);
if (UserRoleUtils.isEnabledOnUserRole(component))
{
HtmlCommandSortHeader sortHeader = (HtmlCommandSortHeader)component;
HtmlDataTable dataTable = sortHeader.findParentDataTable();
if (sortHeader.getColumnName().equals(dataTable.getSortColumn()))
{
UIComponent img = (dataTable.isSortAscending())
? sortHeader.getFacet(FACET_ASCENDING)
: sortHeader.getFacet(FACET_DESCENDING);
// render directional image
if (img != null)
{
RendererUtils.renderChild(facesContext, img);
}
// render directional character
if (sortHeader.isArrow())
{
ResponseWriter writer = facesContext.getResponseWriter();
writer.write((dataTable.isSortAscending()) ? "↑" : "↓");
}
}
}
super.encodeEnd(facesContext, component);
}