You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mm...@apache.org on 2006/11/01 20:14:05 UTC
svn commit: r470041 -
/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScroller.java
Author: mmarinschek
Date: Wed Nov 1 11:14:04 2006
New Revision: 470041
URL: http://svn.apache.org/viewvc?view=rev&rev=470041
Log:
Fix for TOMAHAWK-764: ValueBinding lost for first attribute
Modified:
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScroller.java
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScroller.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScroller.java?view=diff&rev=470041&r1=470040&r2=470041
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScroller.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScroller.java Wed Nov 1 11:14:04 2006
@@ -167,19 +167,19 @@
String facet = scrollerEvent.getScrollerfacet();
if (FACET_FIRST.equals(facet))
{
- uiData.setFirst(0);
+ setFirst(uiData, 0);
}
else if (FACET_PREVIOUS.equals(facet))
{
int previous = uiData.getFirst() - uiData.getRows();
if (previous >= 0)
- uiData.setFirst(previous);
+ setFirst(uiData, previous);
}
else if (FACET_NEXT.equals(facet))
{
int next = uiData.getFirst() + uiData.getRows();
if (next < uiData.getRowCount())
- uiData.setFirst(next);
+ setFirst(uiData, next);
}
else if (FACET_FAST_FORWARD.equals(facet))
{
@@ -190,7 +190,7 @@
int rowcount = uiData.getRowCount();
if (next > rowcount)
next = (rowcount - 1) - ((rowcount - 1) % uiData.getRows());
- uiData.setFirst(next);
+ setFirst(uiData, next);
}
else if (FACET_FAST_REWIND.equals(facet))
{
@@ -200,7 +200,7 @@
int previous = uiData.getFirst() - uiData.getRows() * fastStep;
if (previous < 0)
previous = 0;
- uiData.setFirst(previous);
+ setFirst(uiData, previous);
}
else if (FACET_LAST.equals(facet))
{
@@ -210,11 +210,11 @@
int first = delta > 0 && delta < rows ? rowcount - delta : rowcount - rows;
if (first >= 0)
{
- uiData.setFirst(first);
+ setFirst(uiData, first);
}
else
{
- uiData.setFirst(0);
+ setFirst(uiData, 0);
}
}
}
@@ -229,9 +229,22 @@
{
pageindex = 1;
}
- uiData.setFirst(uiData.getRows() * (pageindex - 1));
+ setFirst(uiData, uiData.getRows() * (pageindex - 1));
}
}
+ }
+
+ protected void setFirst(UIData uiData, int value) {
+ //there might be special cases where the first-property of the data-table
+ //is bound to a backing bean. If this happens, the user probably wants
+ //the data-scroller to update this backing-bean value - if not, you can always
+ //override this method in a subclass.
+ if(uiData.getValueBinding("first")!=null)
+ {
+ ValueBinding vb = uiData.getValueBinding("first");
+ vb.setValue(getFacesContext(),new Integer(value));
+ }
+ uiData.setFirst(value);
}
/**