--- D:/projects/third-party/icefaces-1.7.2-SNAPSHOT/component/src/com/icesoft/faces/component/ext/renderkit/TableRenderer.java Mon Aug 25 17:00:06 2008 +++ D:/projects/third-party/icefaces-showcase/src/com/icesoft/faces/component/ext/renderkit/TableRenderer.java Mon Aug 25 17:01:05 2008 @@ -35,6 +35,7 @@ import com.icesoft.faces.component.CSS_DEFAULT; import com.icesoft.faces.component.PORTLET_CSS_DEFAULT; +import com.icesoft.faces.component.commandsortheader.CommandSortHeader; import com.icesoft.faces.component.ext.HeaderRow; import com.icesoft.faces.component.ext.ColumnGroup; import com.icesoft.faces.component.ext.HtmlDataTable; @@ -48,6 +49,7 @@ import com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer; import com.icesoft.faces.util.CoreUtils; +import org.apache.commons.lang.StringUtils; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -325,6 +327,29 @@ } else { styleClass = baseClass.replaceAll(sourceClass, sourceClass+"Col ")+ styleClass; } + + String sortColumn = htmlDataTable.getSortColumn(); + + if (StringUtils.isNotEmpty(sortColumn)) { + Iterator it = column.getChildren().iterator(); + + while (it.hasNext()) { + UIComponent columnChild = (UIComponent) it.next(); + + if (columnChild instanceof CommandSortHeader) { + String columnName = ((CommandSortHeader) columnChild).getColumnName(); + + if (sortColumn.equals(columnName)) { + styleClass += + " " + CSS_DEFAULT.TABLE_STYLE_CLASS + CSS_DEFAULT.TABLE_ACTIVE_CLASS + + CSS_DEFAULT.TABLE_COLUMN_HEADER_CLASS; + } + + break; + } + } + } + th.setAttribute(HTML.CLASS_ATTR, styleClass); Integer colspan = null; try { @@ -436,8 +461,23 @@ } cursorParent = columnHeaderDiv; } - if ("header".equalsIgnoreCase(facet) ){ - th.setAttribute("class",getHeaderStyles(uiComponent)[styleIndex]); + + if ("header".equalsIgnoreCase(facet)) { + String styles = this.getHeaderStyles(uiComponent)[styleIndex]; + String sortColumn = htmlDataTable.getSortColumn(); + UIComponent headerFacet = nextColumn.getFacet("header"); + + if (StringUtils.isNotEmpty(sortColumn) && (headerFacet instanceof CommandSortHeader)) { + String columnName = ((CommandSortHeader) headerFacet).getColumnName(); + + if (sortColumn.equals(columnName)) { + styles += + " " + CSS_DEFAULT.TABLE_STYLE_CLASS + CSS_DEFAULT.TABLE_ACTIVE_CLASS + + CSS_DEFAULT.TABLE_COLUMN_HEADER_CLASS; + } + } + + th.setAttribute("class", styles); } else { th.setAttribute("class",getFooterClass(htmlDataTable)); } --- D:/projects/third-party/icefaces-1.7.2-SNAPSHOT/component/src/com/icesoft/faces/component/CSS_DEFAULT.java Mon Aug 25 17:04:21 2008 +++ D:/projects/third-party/icefaces-showcase/src/com/icesoft/faces/component/CSS_DEFAULT.java Mon Aug 25 15:08:44 2008 @@ -108,6 +108,7 @@ "ColHdr2"; // Originally was "columnClasses" public static final String TABLE_SCRL_SPR = "ScrlSpr"; + public static final String TABLE_ACTIVE_CLASS = "Actv"; public static final String PANEL_GROUP_DEFAULT_STYLE_CLASS = "icePnlGrp"; public static final String PANEL_GRID_DEFAULT_STYLE_CLASS = "icePnlGrd";