Author: sergeyhalipov
Date: 2008-03-24 16:26:01 -0400 (Mon, 24 Mar 2008)
New Revision: 7152
Modified:
trunk/ui/dataTable/src/main/config/component/columnAttributes.ent
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/HeaderEncodeStrategy.java
trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss
Log:
http://jira.jboss.com/jira/browse/RF-2454
Modified: trunk/ui/dataTable/src/main/config/component/columnAttributes.ent
===================================================================
--- trunk/ui/dataTable/src/main/config/component/columnAttributes.ent 2008-03-24 20:05:16
UTC (rev 7151)
+++ trunk/ui/dataTable/src/main/config/component/columnAttributes.ent 2008-03-24 20:26:01
UTC (rev 7152)
@@ -105,3 +105,18 @@
<description>Event for filter input that forces the filtration (default =
onchange)</description>
<defaultvalue>"onchange"</defaultvalue>
</property>
+<property>
+ <name>sortIcon</name>
+ <classname>java.lang.String</classname>
+ <description></description>
+</property>
+<property>
+ <name>sortIconAscending</name>
+ <classname>java.lang.String</classname>
+ <description></description>
+</property>
+<property>
+ <name>sortIconDescending</name>
+ <classname>java.lang.String</classname>
+ <description></description>
+</property>
\ No newline at end of file
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java 2008-03-24
20:05:16 UTC (rev 7151)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java 2008-03-24
20:26:01 UTC (rev 7152)
@@ -54,6 +54,15 @@
public abstract String getFilterDefaultLabel();
public abstract void setFilterDefaultLabel(String label);
+ public abstract String getSortIcon();
+ public abstract void setSortIcon(String sortIcon);
+
+ public abstract String getSortIconAscending();
+ public abstract void setSortIconAscending(String sortIcon);
+
+ public abstract String getSortIconDescending();
+ public abstract void setSortIconDescending(String sortIcon);
+
public FilterField getFilterField(){
FilterField filterField = null;
MethodExpression filterMethod = getFilterMethod();
Modified:
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
---
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-03-24
20:05:16 UTC (rev 7151)
+++
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-03-24
20:26:01 UTC (rev 7152)
@@ -28,7 +28,6 @@
import java.util.Map;
import java.util.Set;
-import javax.faces.FacesException;
import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
@@ -45,6 +44,9 @@
import org.richfaces.component.Row;
import org.richfaces.component.UIDataTable;
import org.richfaces.model.Ordering;
+import org.richfaces.renderkit.html.iconimages.DataTableIconSortNone;
+import org.richfaces.renderkit.html.images.TriangleIconDown;
+import org.richfaces.renderkit.html.images.TriangleIconUp;
/**
* @author shura
@@ -56,8 +58,6 @@
private static final String FILTER_INPUT_FACET_NAME = "filterValueInput";
- private static final String SPACER_PATH =
"/org/richfaces/renderkit/html/images/spacer.gif";
-
/**
* Encode all table structure - colgroups definitions, caption, header,
* footer
@@ -138,7 +138,6 @@
String headerClass, String facetName, String element, int colCount)
throws IOException {
int t_colCount = 0;
- String spacerUrl = getResource(SPACER_PATH).getUri(context, null);
HeaderEncodeStrategy richEncodeStrategy = new RichHeaderEncodeStrategy();
HeaderEncodeStrategy simpleEncodeStrategy = new SimpleHeaderEncodeStrategy();
@@ -176,7 +175,7 @@
renderChild(context, facet);
}
- strategy.encodeEnd(context, writer, column, facetName, sortableColumn, spacerUrl);
+ strategy.encodeEnd(context, writer, column, facetName, sortableColumn);
writer.endElement(element);
@@ -550,7 +549,7 @@
}
public void encodeEnd(FacesContext context, ResponseWriter writer,
- UIComponent column, String facetName, boolean sortableColumn, String spacelUrl)
+ UIComponent column, String facetName, boolean sortableColumn)
throws IOException {
}
@@ -580,28 +579,41 @@
if (sortableColumn) {
writer.startElement(HTML.SPAN_ELEM, column);
-
- String spanClass = "";
- if (Ordering.ASCENDING.equals(col.getSortOrder())) {
- spanClass = "dr-table-header-sort-up dr-table-sortable-header";
- } else if (Ordering.DESCENDING.equals(col.getSortOrder())) {
- spanClass = "dr-table-header-sort-down dr-table-sortable-header";
- } else {
- spanClass = "dr-table-header-sort-none dr-table-sortable-header";
- }
- writer.writeAttribute(HTML.class_ATTRIBUTE, spanClass, null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-table-sortable-header",
null);
}
}
public void encodeEnd(FacesContext context, ResponseWriter writer,
- UIComponent column, String facetName, boolean sortableColumn, String spacerUrl)
throws IOException {
+ UIComponent column, String facetName, boolean sortableColumn) throws IOException {
org.richfaces.component.UIColumn col =
(org.richfaces.component.UIColumn) column;
if (sortableColumn) {
+ String imageUrl;
+ if (Ordering.ASCENDING.equals(col.getSortOrder())) {
+ if (null != col.getSortIconAscending()) {
+ imageUrl = col.getSortIconAscending();
+ } else {
+ imageUrl = getResource(TriangleIconUp.class.getName()).getUri(context, null);
+ }
+ } else if (Ordering.DESCENDING.equals(col.getSortOrder())) {
+ if (null != col.getSortIconDescending()) {
+ imageUrl = col.getSortIconDescending();
+ } else {
+ imageUrl = getResource(TriangleIconDown.class.getName()).getUri(context, null);
+ }
+ } else {
+ if (null != col.getSortIcon()) {
+ imageUrl = col.getSortIcon();
+ } else {
+ imageUrl = getResource(DataTableIconSortNone.class.getName()).getUri(context,
null);
+ }
+ }
+
writer.startElement(HTML.IMG_ELEMENT, column);
- writer.writeAttribute(HTML.src_ATTRIBUTE, spacerUrl, null);
- writer.writeAttribute(HTML.width_ATTRIBUTE, "16", null);
- writer.writeAttribute(HTML.height_ATTRIBUTE, "1", null);
+ writer.writeAttribute(HTML.src_ATTRIBUTE, imageUrl, null);
+ writer.writeAttribute(HTML.width_ATTRIBUTE, "15", null);
+ writer.writeAttribute(HTML.height_ATTRIBUTE, "15", null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-table-header-sort-img",
null);
writer.endElement(HTML.IMG_ELEMENT);
writer.endElement(HTML.SPAN_ELEM);
Modified:
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/HeaderEncodeStrategy.java
===================================================================
---
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/HeaderEncodeStrategy.java 2008-03-24
20:05:16 UTC (rev 7151)
+++
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/HeaderEncodeStrategy.java 2008-03-24
20:26:01 UTC (rev 7152)
@@ -33,6 +33,6 @@
UIComponent column, String facetName, boolean sortableColumn) throws IOException;
public abstract void encodeEnd(FacesContext context, ResponseWriter writer,
- UIComponent column, String facetName, boolean sortableColumn, String spacerUrl) throws
IOException;
+ UIComponent column, String facetName, boolean sortableColumn) throws IOException;
}
Modified:
trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss
===================================================================
---
trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss 2008-03-24
20:05:16 UTC (rev 7151)
+++
trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss 2008-03-24
20:26:01 UTC (rev 7152)
@@ -115,26 +115,12 @@
.rich-inplace-edit, .rich-inplace-view {
cursor: default;
}
+
+ .dr-table-header-sort-img {
+ vertical-align: middle;
+ }
</f:verbatim>
-<u:selector name=".dr-table-header-sort-down" >
- <u:style name="background-image">
- <f:resource
f:key="org.richfaces.renderkit.html.images.TriangleIconDown"/>
- </u:style>
-</u:selector>
-
-<u:selector name=".dr-table-header-sort-up" >
- <u:style name="background-image">
- <f:resource
f:key="org.richfaces.renderkit.html.images.TriangleIconUp"/>
- </u:style>
-</u:selector>
-
-<u:selector name=".dr-table-header-sort-none" >
- <u:style name="background-image">
- <f:resource
f:key="org.richfaces.renderkit.html.iconimages.DataTableIconSortNone"/>
- </u:style>
-</u:selector>
-
<u:selector name=".dr-table-footer" >
<u:style name="background-color"
skin="tableFooterBackgroundColor"/> <!--tableFooterBackgroundColor-->
</u:selector>