You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2012/09/15 00:38:29 UTC
svn commit: r1384956 -
/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java
Author: lu4242
Date: Fri Sep 14 22:38:29 2012
New Revision: 1384956
URL: http://svn.apache.org/viewvc?rev=1384956&view=rev
Log:
TOMAHAWK-1638 Do not activate preserveSort if sortColumn/sortAscending is not used
Modified:
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java
Modified: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java?rev=1384956&r1=1384955&r2=1384956&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java (original)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java Fri Sep 14 22:38:29 2012
@@ -1522,7 +1522,14 @@ public abstract class AbstractHtmlDataTa
public Object saveState(FacesContext context)
{
- boolean preserveSort = isPreserveSort();
+ // It only has sense to save sorting stuff if presertSort is set to true
+ // or if it is not set (default true) if sortColumn and sortAscending is set,
+ // or a ValueExpression has been set for it.
+ boolean preserveSort =
+ (isSetPreserveSort() && isPreserveSort()) ||
+ (!isSetPreserveSort() && (isSetSortColumn() || isSetSortAscending() ||
+ (getValueExpression("sortColumn") != null) ||
+ (getValueExpression("sortAscending") != null) ) );
if (initialStateMarked())
{
@@ -1803,11 +1810,16 @@ public abstract class AbstractHtmlDataTa
* the DataModel's contents.
*
*/
- @JSFProperty
+ @JSFProperty(setMethod=true)
public String getSortColumn()
{
return (String) getStateHelper().eval(PropertyKeys.sortColumn);
}
+
+ public boolean isSetSortColumn()
+ {
+ return getStateHelper().get(PropertyKeys.sortColumn) != null;
+ }
public void setSortAscending(boolean sortAscending)
{
@@ -1833,11 +1845,16 @@ public abstract class AbstractHtmlDataTa
* determine how to sort the DataModel's contents.
*
*/
- @JSFProperty(defaultValue="true")
+ @JSFProperty(defaultValue="true", setMethod=true)
public boolean isSortAscending()
{
return (Boolean) getStateHelper().eval(PropertyKeys.sortAscending, DEFAULT_SORTASCENDING);
}
+
+ public boolean isSetSortAscending()
+ {
+ return getStateHelper().get(PropertyKeys.sortAscending) != null;
+ }
public abstract void setSortProperty(String sortProperty);
@@ -2273,8 +2290,10 @@ public abstract class AbstractHtmlDataTa
* model during the update model phase. Default: true
*
*/
- @JSFProperty(defaultValue = "true")
+ @JSFProperty(defaultValue = "true", setMethod=true)
public abstract boolean isPreserveSort();
+
+ protected abstract boolean isSetPreserveSort();
/**
* Indicates whether this table should be rendered if the