for (Iterator iter = getChildren().iterator(); iter.hasNext();)
{
UIComponent component = (UIComponent) iter.next();
if (component instanceof UIColumn)
{
UIColumn aColumn = (UIColumn) component;
UIComponent headerFacet = aColumn.getHeader();
boolean replaceHeaderFacets = isSortable(); //if the table is sortable, all
//header facets can be changed if needed
String columnName = null;
String propertyName = null;
boolean defaultSorted = false;
if (aColumn instanceof HtmlSimpleColumn)
{
HtmlSimpleColumn asColumn = (HtmlSimpleColumn) aColumn;
propertyName = asColumn.getSortPropertyName();
defaultSorted = asColumn.isDefaultSorted();
if (asColumn.isSortable())
replaceHeaderFacets = true;
}
//replace header facet with a sortable header component if needed
if (replaceHeaderFacets && isSortHeaderNeeded(aColumn, headerFacet))
{
propertyName = propertyName != null ? propertyName : getSortPropertyFromEL(aColumn);
if (propertyName == null)
log.warn("Couldn't determine sort property for column [" + aColumn.getId() + "].");
if (headerFacet != null)
{
HtmlCommandSortHeader sortHeader = createSortHeaderComponent(context, aColumn, headerFacet, propertyName);
columnName = sortHeader.getColumnName();
aColumn.setHeader(sortHeader);
sortHeader.setParent(aColumn);
}
}
else if (headerFacet instanceof HtmlCommandSortHeader)
{
//command sort headers are already in place, just store the column name and sort property name
HtmlCommandSortHeader sortHeader = (HtmlCommandSortHeader) headerFacet;
columnName = sortHeader.getColumnName();
propertyName = sortHeader.getPropertyName();
//if the command sort header component doesn't specify a sort property, determine it
if (propertyName == null)
{
propertyName = getSortPropertyFromEL(aColumn);
sortHeader.setPropertyName(propertyName);
}
if (propertyName == null)
log.warn("Couldn't determine sort property for column [" + aColumn.getId() + "].");
}
//make the column marked as default sorted be the current sorted column
if (defaultSorted && getSortColumn() == null)
{