Author: konstantin.mishin
Date: 2007-12-28 14:35:03 -0500 (Fri, 28 Dec 2007)
New Revision: 5094
Modified:
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableRendererState.java
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js
trunk/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/ScrollableDataTableRendererStateTest.java
trunk/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/ScrollableDataTableRendererTest.java
Log:
merged scrollable-data-table with 3/1/x branch
Modified:
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java
===================================================================
---
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java 2007-12-28
18:47:28 UTC (rev 5093)
+++
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java 2007-12-28
19:35:03 UTC (rev 5094)
@@ -391,7 +391,7 @@
private void checkRange() {
int rows = getRows();
- if (getRowCount() <= getFirst() + getRows()) {
+ if (getRowCount() < getFirst() + rows) {
setFirst(0);
setScrollPos("0,0," + rows);
}
Modified:
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
===================================================================
---
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java 2007-12-28
18:47:28 UTC (rev 5093)
+++
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java 2007-12-28
19:35:03 UTC (rev 5094)
@@ -263,7 +263,6 @@
if(grid.isRowAvailable() || state.isFake()){
String row_id;
- String fakeClass = state.isFake() ? "fake " : "";
int index = state.getRowIndex();
@@ -281,8 +280,7 @@
writer.startElement(HTML.TR_ELEMENT, grid);
state.setFrozenColumnCount(ScrollableDataTableUtils.getFrozenColumnsCount(grid));
getUtils().writeAttribute(writer, "id",row_id);
-
- getUtils().writeAttribute(writer, "class","dr-sdt-rb rich-sdt-row
" + fakeClass + state.getRowClass(index));
+ getUtils().writeAttribute(writer, "class","dr-sdt-rb rich-sdt-row
" + state.getRowClass());
addRowJavascriptEvents(writer, grid);
if (log.isDebugEnabled()) {
log.debug("rowIndex : " + index);
@@ -344,7 +342,7 @@
row_id = baseClientId + ":f:" + state.getRowIndex();
writer.startElement("tr", grid);
- getUtils().writeAttribute(writer, "class","dr-sdt-rb
rich-sdt-row" + state.getRowClass(state.getRowIndex()));
+ getUtils().writeAttribute(writer, "class","dr-sdt-rb
rich-sdt-row" + state.getRowClass());
getUtils().writeAttribute(writer,"id",row_id);
addRowJavascriptEvents(writer, grid);
collection.add(row_id);
@@ -399,7 +397,7 @@
writer.startElement("tr", grid);
getUtils().writeAttribute(writer,"id",row_id);
- getUtils().writeAttribute(writer, "class","dr-sdt-rb rich-sdt-row"
+ state.getRowClass(state.getRowIndex()));
+ getUtils().writeAttribute(writer, "class","dr-sdt-rb rich-sdt-row"
+ state.getRowClass());
addRowJavascriptEvents(writer, grid);
collection.add(row_id);
}
Modified:
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableRendererState.java
===================================================================
---
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableRendererState.java 2007-12-28
18:47:28 UTC (rev 5093)
+++
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableRendererState.java 2007-12-28
19:35:03 UTC (rev 5094)
@@ -413,7 +413,11 @@
}
}
- public String getRowClass(int index) {
+ public String getRowClass() {
+ return getRowClass(getRowIndex()) + (isFake() ? " dr-sdt-fake-r rich-sdt-fake-r
" : "");
+ }
+
+ private String getRowClass(int index) {
if(rowClasses != null) {
return rowClasses[index % rowClassesSize];
} else {
Modified:
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
---
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-12-28
18:47:28 UTC (rev 5093)
+++
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-12-28
19:35:03 UTC (rev 5094)
@@ -718,7 +718,7 @@
var y = index*this.defaultRowHeight;
this.scrollBox.getElement().scrollTop = y;
this.currentPos = 0;
- this._onContentVScroll(this.scrollBox.getElement().scrollTop);
+ this._onContentVScroll({memo:{pos:y}});
}
}
},
Modified:
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js
===================================================================
---
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-12-28
18:47:28 UTC (rev 5093)
+++
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-12-28
19:35:03 UTC (rev 5094)
@@ -123,7 +123,7 @@
var ids = this.grid.options.ids;
var count = this.frozenCells.length;
for(i=0; i<count; i++) {
- cell = this.cells[i];
+ cell = this.frozenCells[i];
columns[j] = {
columnId: ids[i],
col: cols[i],
Modified:
trunk/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/ScrollableDataTableRendererStateTest.java
===================================================================
---
trunk/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/ScrollableDataTableRendererStateTest.java 2007-12-28
18:47:28 UTC (rev 5093)
+++
trunk/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/ScrollableDataTableRendererStateTest.java 2007-12-28
19:35:03 UTC (rev 5094)
@@ -196,7 +196,8 @@
public void testRowClass() {
String rowClasses = "1,2,3";
state.setRowClasses(rowClasses);
- assertEquals("2", state.getRowClass(1));
+ state.setRowIndex(1);
+ assertEquals("2", state.getRowClass());
}
public void testIds() {
Modified:
trunk/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/ScrollableDataTableRendererTest.java
===================================================================
---
trunk/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/ScrollableDataTableRendererTest.java 2007-12-28
18:47:28 UTC (rev 5093)
+++
trunk/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/ScrollableDataTableRendererTest.java 2007-12-28
19:35:03 UTC (rev 5094)
@@ -115,7 +115,7 @@
}
static final Set tagNames = new HashSet();
- static final String [] names = {"input","div","script"};
+ static final String [] names = {"input","div","script",
"table", "tbody", "tr", "td", "thead",
"tfoot", "th"};
static {
Collections.addAll(tagNames, names);
}
@@ -128,7 +128,7 @@
HtmlElement div = page.getHtmlElementById(grid.getClientId(facesContext));
assertNotNull(div);
- assertEquals("div", div.getNodeName());
+ assertEquals("table", div.getNodeName());
String classAttr = div.getAttributeValue("class");
assertTrue(classAttr.contains("dr-sdt"));