Author: abelevich
Date: 2007-06-13 11:16:39 -0400 (Wed, 13 Jun 2007)
New Revision: 1152
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java
Log:
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java 2007-06-13
14:54:31 UTC (rev 1151)
+++
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java 2007-06-13
15:16:39 UTC (rev 1152)
@@ -25,6 +25,7 @@
import org.ajax4jsf.framework.ajax.AjaxContext;
import org.ajax4jsf.framework.ajax.AjaxEvent;
import org.apache.commons.collections.iterators.IteratorChain;
+import org.richfaces.event.scroll.ScrollEvent;
import org.richfaces.event.sort.SortEvent;
import org.richfaces.model.BufferedSequenceRange;
import org.richfaces.model.DataModelCache;
@@ -173,12 +174,15 @@
AjaxContext.getCurrentInstance().addComponentToAjaxRender(this);
}else if(event instanceof SortEvent){
processSortingChange(event);
- new AjaxEvent(this).queue();
+ // new AjaxEvent(this).queue();
+ }else if(event instanceof ScrollEvent){
+ // new AjaxEvent(this).queue();
+ processScrolling(event);
}
}
protected boolean broadcastLocal(FacesEvent event) {
- return super.broadcastLocal(event) || event instanceof SortEvent;
+ return super.broadcastLocal(event) || event instanceof SortEvent || event instanceof
ScrollEvent;
}
public void queueEvent(FacesEvent event) {
@@ -186,34 +190,41 @@
if(event instanceof AjaxEvent){
event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
}else if(event instanceof SortEvent){
+ new AjaxEvent(this).queue();
+
event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ }else if(event instanceof ScrollEvent){
+ event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ new AjaxEvent(this).queue();
}
-
super.queueEvent(event);
}
+ public void processScrolling(FacesEvent event){
+ ScrollEvent e = (ScrollEvent)event;
+ setRows(e.getRows());
+ setFirst(e.getFirst());
+ getFacesContext().renderResponse();
+ }
+
public void processSortingChange(FacesEvent event){
SortEvent e = (SortEvent)event;
int sortColumn = e.getSortColumn();
- int dataIndex = e.getDataIndex();
- int startRow = e.getStartRow();
boolean asc = true;
SortOrder sortOrder = getSortOrder();
if (sortOrder != null) {
-
if (sortOrder.getSortColumn() == sortColumn) {
asc = !sortOrder.isAscending();
}
-
}
-
- SortOrder newSortOrder = new SortOrder(sortColumn, startRow, dataIndex, asc);
+ SortOrder newSortOrder = new SortOrder(sortColumn,asc);
setSortOrder(newSortOrder);
resetDataModel();
+ getFacesContext().renderResponse();
}
public void walk(FacesContext context, DataVisitor visitor, Object argument) throws
IOException {
Show replies by date