Author: abelevich
Date: 2007-06-13 11:17:05 -0400 (Wed, 13 Jun 2007)
New Revision: 1154
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
Log:
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-13
15:16:52 UTC (rev 1153)
+++
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-13
15:17:05 UTC (rev 1154)
@@ -25,6 +25,7 @@
import org.apache.commons.logging.LogFactory;
import org.richfaces.component.UIScrollableGrid;
import org.richfaces.component.UIScrollableGridColumn;
+import org.richfaces.event.scroll.ScrollEvent;
import org.richfaces.event.sort.SortEvent;
import org.richfaces.renderkit.CompositeRenderer;
import org.richfaces.renderkit.RendererContributor;
@@ -525,42 +526,35 @@
if(parameters.containsKey(clientId + "_state_input") && !sorted){
String submitedState = (String)parameters.get(clientId + "_state_input");
- decodeScrolling(submitedState, grid);
- grid.queueEvent(new AjaxEvent(grid));
+
+ boolean isEmpty = true;
+
+
+ String [] values = submitedState.split(",");
+ for (int i = 0; i < values.length; i++) {
+ isEmpty = isEmpty && values[i].equals("");
+ }
+
+ int rows = 0;
+ int first = 0;
+
+ if(!isEmpty){
+ grid.getAttributes().put(GridUtils.CLIENT_ROW_KEY,Integer.valueOf(values[2]));
+ rows = Integer.parseInt(values[0]);
+ first = Integer.parseInt(values[1]);
+
+ }else{
+ grid.getAttributes().put(GridUtils.CLIENT_ROW_KEY, new Integer(0));
+ }
+
+ ScrollEvent scrollEvent = new ScrollEvent(grid,rows,first);
+ grid.queueEvent(scrollEvent);
}
}
}
- private void decodeScrolling(String submitedState, UIScrollableGrid grid){
-
- boolean isEmpty = true;
-
-
- String [] values = submitedState.split(",");
- for (int i = 0; i < values.length; i++) {
- isEmpty = isEmpty && values[i].equals("");
- }
-
- if(!isEmpty){
-
- grid.setRows(Integer.parseInt(values[0]));
- grid.setFirst(Integer.parseInt(values[1]));
- grid.getAttributes().put(GridUtils.CLIENT_ROW_KEY,Integer.valueOf(values[2]));
-
- }else{
- grid.getAttributes().put(GridUtils.CLIENT_ROW_KEY, new Integer(0));
- }
- if (log.isDebugEnabled()) {
- log.debug("");
- log.debug("row count: " + grid.getRows());
- log.debug("data index: " + grid.getFirst()) ;
- log.debug("start row: " +
grid.getAttributes().get(GridUtils.CLIENT_ROW_KEY));
- }
- }
-
-
public void renderAjaxChildren(FacesContext context, UIComponent component)throws
IOException{
UIScrollableGrid grid = (UIScrollableGrid)component;
Show replies by date