Author: abelevich
Date: 2007-06-14 12:58:37 -0400 (Thu, 14 Jun 2007)
New Revision: 1187
Modified:
trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridUtils.java
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
Log:
Modified: trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml 2007-06-14
15:11:41 UTC (rev 1186)
+++ trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml 2007-06-14
16:58:37 UTC (rev 1187)
@@ -44,14 +44,6 @@
<defaultvalue>"700px"</defaultvalue>
</property>
- <property>
- <name>defaultRows</name>
- <classname>int</classname>
- <description>Rows to render</description>
- <defaultvalue>40</defaultvalue>
- </property>
-
-
<property attachedstate="true" hidden="true">
<name>sortOrder</name>
<classname>org.richfaces.model.SortOrder</classname>
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-14
15:11:41 UTC (rev 1186)
+++
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java 2007-06-14
16:58:37 UTC (rev 1187)
@@ -45,20 +45,26 @@
public abstract class UIScrollableGrid extends UIRepeat implements AjaxComponent,
Sortable, Selectable{
- public static final String COMPONENT_TYPE =
"org.richfaces.component.ScrollableGrid";
+ public static final String COMPONENT_TYPE =
"org.richfaces.component.ScrollableGrid";
private transient Collection partialUpdateChildren;
private Collection responseData = new ArrayList();
+ private int reqRowsCount = -1;
+
+ public int getReqRowsCount() {
+ return reqRowsCount;
+ }
+
+ public void setReqRowsCount(int reqRowsCount) {
+ this.reqRowsCount = reqRowsCount;
+ }
+
public abstract SortOrder getSortOrder();
-
+
public abstract void setSortOrder(SortOrder sortOrder) ;
- public abstract int getDefaultRows();
-
- public abstract void setDefaultRows(int defaultRows);
-
public Collection getResponseData() {
return responseData;
}
@@ -74,7 +80,13 @@
public Range getRange() {
int curentRow = getFirst();
- int rows = getRows();
+
+ if(reqRowsCount == -1 ){
+ reqRowsCount = getRows();
+ }
+
+ int rows = getReqRowsCount();
+
int rowsCount = getExtendedDataModel().getRowCount();
if(rows > 0){
@@ -191,8 +203,7 @@
event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
}else if(event instanceof SortEvent){
new AjaxEvent(this).queue();
-
- event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ event.setPhaseId(PhaseId.INVOKE_APPLICATION);
}else if(event instanceof ScrollEvent){
event.setPhaseId(PhaseId.INVOKE_APPLICATION);
new AjaxEvent(this).queue();
@@ -202,7 +213,7 @@
public void processScrolling(FacesEvent event){
ScrollEvent e = (ScrollEvent)event;
- setRows(e.getRows());
+ setReqRowsCount(e.getRows());
setFirst(e.getFirst());
getFacesContext().renderResponse();
}
@@ -249,9 +260,4 @@
super.encodeEnd(context);
partialUpdateChildren = null;
}
-
- public int getRows() {
- int rows = super.getRows();
- return rows != 0 ? rows : getDefaultRows();
- }
}
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java 2007-06-14
15:11:41 UTC (rev 1186)
+++
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java 2007-06-14
16:58:37 UTC (rev 1187)
@@ -215,7 +215,7 @@
* @return Returns the rowIndex.
*/
public int getRowIndex() {
- if(_rowIndex >= _grid.getDefaultRows()){
+ if(_rowIndex >= _grid.getRows()){
_rowIndex = 0;
}
return _rowIndex;
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridUtils.java
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridUtils.java 2007-06-14
15:11:41 UTC (rev 1186)
+++
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridUtils.java 2007-06-14
16:58:37 UTC (rev 1187)
@@ -15,7 +15,7 @@
public static final String FROZEN_COL_COUNT_ATTR = "frozenColCount";
public static final String CLIENT_ROW_KEY = "clientIndex";
-
+
public static int getFrozenColumnsCount(UIScrollableGrid grid) {
return getIntOr0(grid, FROZEN_COL_COUNT_ATTR);
}
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-14
15:11:41 UTC (rev 1186)
+++
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-14
16:58:37 UTC (rev 1187)
@@ -325,7 +325,7 @@
int columnCount = grid.getChildCount();
options.addOption("columnsCount", new Integer(columnCount));
- options.addOption("rowsCount", new Integer(grid.getDefaultRows()));
+ options.addOption("rowsCount", new Integer(grid.getRows()));
JSFunction function = new JSFunction("new
ClientUI.controls.grid.ScrollableGrid");
function.addParameter(options);
@@ -369,7 +369,7 @@
state.setFrozenPart(isFrozen);
state.setClientId(grid.getClientId(context));
grid.walk(context, rowsRenderer, state);
- int fakeRowsCount = grid.getDefaultRows() - grid.getRowCount();
+ int fakeRowsCount = grid.getRows() - grid.getRowCount();
state.setFake(true);
for (int i = 0; i < fakeRowsCount; i++) {
rowsRenderer.process(context, null, state);
@@ -520,7 +520,7 @@
grid.getAttributes().put(GridUtils.CLIENT_ROW_KEY,sortStartRow);
grid.setFirst(sortDataIndex);
- grid.setRows(grid.getDefaultRows());
+ grid.setReqRowsCount(grid.getRows());
if (log.isDebugEnabled()) {
@@ -561,6 +561,7 @@
}else{
grid.getAttributes().put(GridUtils.CLIENT_ROW_KEY, new Integer(0));
+ rows = grid.getRows();
}
ScrollEvent scrollEvent = new ScrollEvent(grid,rows,first);
@@ -609,9 +610,7 @@
ajaxContext.getAjaxRenderedAreas().remove(grid.getClientId(context));
GridScrollSettings options = createOptions(grid);
ajaxContext.getResponseDataMap().put("options", options);
- grid.setRows(grid.getDefaultRows());
-
//Then call contributors to write additional HTML content
contributorsEncodeHere(context, grid);
Show replies by date