Author: konstantin.mishin
Date: 2007-06-14 07:39:44 -0400 (Thu, 14 Jun 2007)
New Revision: 1179
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/ScrollableGridBaseRenderer.java
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/CustomEvent.js
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js
Log:
Added fake rows.
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
11:27:14 UTC (rev 1178)
+++
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java 2007-06-14
11:39:44 UTC (rev 1179)
@@ -29,6 +29,8 @@
public static final String DATA_GRID_RENDERER_STATE =
GridRendererState.class.getName();
+ private boolean fake;
+
private int _rowIndex = 0;
private int _cellIndex = 0;
@@ -366,5 +368,13 @@
public void setCollection(Collection collection) {
this.collection = collection;
+ }
+
+ public boolean isFake() {
+ return fake;
+ }
+
+ public void setFake(boolean fake) {
+ this.fake = fake;
}
}
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
11:27:14 UTC (rev 1178)
+++
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-14
11:39:44 UTC (rev 1179)
@@ -169,7 +169,9 @@
variables.setVariable("cell_index", new Integer(cell_index));
cellTemplate.encodeBegin(context, column);
- renderChildren(context, column);
+ if(!state.isFake()) {
+ renderChildren(context, column);
+ }
cellTemplate.encodeEnd(context, column);
}
@@ -184,7 +186,7 @@
grid.setRowKey(rowKey);
- if(grid.isRowAvailable()){
+ if(grid.isRowAvailable() || state.isFake()){
String row_id;
int index = state.getRowIndex();
@@ -366,6 +368,12 @@
state.setFrozenPart(isFrozen);
state.setClientId(grid.getClientId(context));
grid.walk(context, rowsRenderer, state);
+ int fakeRowsCount = grid.getDefaultRows() - grid.getRowCount();
+ state.setFake(true);
+ for (int i = 0; i < fakeRowsCount; i++) {
+ rowsRenderer.process(context, null, state);
+ }
+ state.setFake(false);
grid.setRowKey(null);
}
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/CustomEvent.js
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/CustomEvent.js 2007-06-14
11:27:14 UTC (rev 1178)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/CustomEvent.js 2007-06-14
11:39:44 UTC (rev 1179)
@@ -35,8 +35,7 @@
// Fire this event and notifies the subscribers.
fire: function() {
- var len = Event.subscribers.length;
- if (!len) {
+ if (!Event.subscribers || !Event.subscribers.length) {
return true;
}
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-06-14
11:27:14 UTC (rev 1178)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-06-14
11:39:44 UTC (rev 1179)
@@ -134,11 +134,11 @@
this.frozenContentBox = new ClientUI.common.box.Box(frozen);
this.frozenContentBox.makeAbsolute();
- this.helpObject1 = new
ClientUI.common.box.Box($(document.createElement("img")),
this.contentBox.getElement());
+ this.helpObject1 = new
ClientUI.common.box.Box($(document.createElement("span")),
this.contentBox.getElement());
this.helpObject1.setWidth(10);
this.helpObject1.setHeight(10);
this.helpObject1.makeAbsolute();
- this.helpObject2 = new
ClientUI.common.box.Box($(document.createElement("img")),
this.frozenContentBox.getElement());
+ this.helpObject2 = new
ClientUI.common.box.Box($(document.createElement("span")),
this.frozenContentBox.getElement());
this.helpObject2.setWidth(10);
this.helpObject2.setHeight(10);
this.helpObject2.makeAbsolute();
@@ -194,7 +194,7 @@
i++;
});
- this.rowsCount = templNormal.rows.length;
+ this.rowsCount = Math.min(templNormal.rows.length, this.grid.dataModel.getCount());
this.defaultRowHeight = Element.getHeight(templNormal.rows[0].cells[0]);
if(ClientUILib.isGecko) {
this.defaultRowHeight -= this.getBorderWidth("tb") +
this.getPadding("tb");
Show replies by date