Author: maksimkaszynski
Date: 2007-07-04 14:36:00 -0400 (Wed, 04 Jul 2007)
New Revision: 1469
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/layouts/LayoutManager.js
branches/3.0.2/sandbox/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss
branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cell.jspx
branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx
branches/3.0.2/sandbox/scrollable-grid/src/test/java/org/richfaces/renderkit/html/ScrollableGridRendererTest.java
Log:
merged with rev 1436
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
===================================================================
---
branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-07-04
16:24:58 UTC (rev 1468)
+++
branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-07-04
18:36:00 UTC (rev 1469)
@@ -141,13 +141,13 @@
variables.setVariable("client_id", client_id);
variables.setVariable("cell_index", new Integer(cell_index));
- footerCellTemplate.encodeBegin(context, column);
+
UIComponent component = column.getFacet(FOOTER_PART);
if(component != null){
+ footerCellTemplate.encodeBegin(context, column);
renderChild(context, component);
+ footerCellTemplate.encodeEnd(context, column);
}
- footerCellTemplate.encodeEnd(context, column);
-
}
};
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js
===================================================================
---
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js 2007-07-04
16:24:58 UTC (rev 1468)
+++
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js 2007-07-04
18:36:00 UTC (rev 1469)
@@ -47,40 +47,60 @@
if (ClientUILib.isIE) {
var theDoc = document;
- var createEl = theDoc.createElement;
+ //var createEl = theDoc.createElement;
- row = createEl( "TR" );
+ row = theDoc.createElement( "TR" );
Utils.DOM.copyAttributes(row, src);
- var tdSrc, tdNode;
+ var tdSrc, tdNode, subNode;
var childs = src.childNodes;
var ccount = childs.length;
- for(var k=0; k<ccount; k++) {
- tdSrc = childs[k];
- tdNode = createEl( "TD" );
- //Utils.DOM.copyAttributes(tdNode, tdSrc);
+ var tcount = target.childNodes.length;
+ for(var k=0; k<tcount; k++) {
+ tdSrc = k<ccount ? childs[k] : null;
+ tdNode = theDoc.createElement( "TD" );
tdNode.className = "ClientUI_Grid_BC";
- row.insertBefore(tdNode, null);
- innerHTML = [];
- innerCount = tdSrc.childNodes.length;
- for(j=0; j<innerCount; j++) {
- innerHTML.push(tdSrc.childNodes[j].xml);
+ if(tdSrc) {
+ if(tdSrc.innerHTML) {
+ tdNode.innerHTML = tdSrc.innerHTML;
+ }
+ else {
+ innerHTML = [];
+ innerCount = tdSrc.childNodes.length;
+ for(j=0; j<innerCount; j++) {
+ subNode = tdSrc.childNodes[j];
+ innerHTML.push(subNode.xml);
+ }
+ tdNode.innerHTML = innerHTML.join("");
+ }
}
- tdNode.innerHTML = innerHTML.join("");
+ row.insertBefore(tdNode, null);
}
target.parentNode.replaceChild(row, target);
return row;
} else {
- Element.hide(target);
- Utils.DOM.Event.removeListeners(target);
-
+ var theDoc = document;
+
Utils.DOM._clearAttributes(target);
- target.innerHTML = src.innerHTML;
Utils.DOM.copyAttributes(target, src);
- Element.show(target);
+
+ var tdSrc, tdNode, subNode;
+ var childs = src.childNodes;
+ var ccount = childs.length;
+ var tcount = target.childNodes.length;
+ var innerHTML = [];
+
+ for(var k=0; k<tcount; k++) {
+ tdSrc = k<ccount ? childs[k] : null;
+ innerHTML.push("<td class='ClientUI_Grid_BC'>");
+ innerHTML.push(tdSrc?tdSrc.innerHTML:"");
+ innerHTML.push("</td>");
+ }
+
+ target.innerHTML = innerHTML.join("");
return target;
}
}
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
---
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-07-04
16:24:58 UTC (rev 1468)
+++
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-07-04
18:36:00 UTC (rev 1469)
@@ -44,6 +44,7 @@
*/
initialize: function(template, grid) {
this.grid = grid;
+ this.gridId = grid.getElement().id;
ClientUI.controls.grid.GridBody.parentClass.constructor().call(this, template);
// declare event listeners
@@ -86,7 +87,7 @@
var childs = template.childNodes;
for(var i=0; i<childs.length; i++) {
- if(childs[i].tagName && childs[i].tagName.toLowerCase() == "div") {
+ if(childs[i].id == this.gridId + ":bc") {
this.container = new ClientUI.common.box.Box(childs[i], null, true);
this.container.makeAbsolute();
this.container.setStyle({'z-index' : 20});
@@ -96,13 +97,10 @@
}
// create scroll box
- this.scrollBox = new ClientUI.common.box.ScrollableBox(null, this.getElement());
- this.scrollBox.makeAbsolute();
+ this.scrollBox = new ClientUI.common.box.ScrollableBox(this.gridId + ":scb",
this.getElement());
this.scrollBox.setWidth(this.getWidth());
this.scrollBox.setHeight(this.getHeight());
- this.scrollBox.setStyle({'z-index' : 0});
- this.sizeBox = new ClientUI.common.box.Box(null, this.scrollBox.getElement());
- this.sizeBox.makeAbsolute();
+ this.sizeBox = new ClientUI.common.box.Box(this.gridId + ":sb",
this.scrollBox.getElement());
var normal = null, frozen = null;
var childs = this.container.getElement().childNodes;
@@ -126,14 +124,8 @@
this.frozenContentBox = new ClientUI.common.box.Box(frozen);
this.frozenContentBox.makeAbsolute();
- 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("span")),
this.frozenContentBox.getElement());
- this.helpObject2.setWidth(10);
- this.helpObject2.setHeight(10);
- this.helpObject2.makeAbsolute();
+ this.helpObject1 = new ClientUI.common.box.Box(this.gridId + ":nho",
this.contentBox.getElement());
+ this.helpObject2 = new ClientUI.common.box.Box(this.gridId + ":fho",
this.frozenContentBox.getElement());
// create row template
var ch = this.frozenContentBox.getElement().firstChild;
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js
===================================================================
---
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-07-04
16:24:58 UTC (rev 1468)
+++
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-07-04
18:36:00 UTC (rev 1469)
@@ -209,22 +209,24 @@
var details = this._getCellElements(j);
// separator
- columns[j].sep = new ClientUI.common.box.InlineBox(details[0], null, true);
- columns[j].sep.getElement().columnIndex = j;
- if(!columns[j].fixedWidth) {
- Event.observe(columns[j].sep.getElement(), 'dblclick',
this.eventSepDblClick);
- Event.observe(columns[j].sep.getElement(), 'mousedown',
this.eventSepMouseDown);
- }
- else {
- sep.setStyle({cursor: 'auto'});
+ if (details[0]) {
+ columns[j].sep = new ClientUI.common.box.InlineBox(details[0], null, true);
+ columns[j].sep.getElement().columnIndex = j;
+ if(!columns[j].fixedWidth) {
+ Event.observe(columns[j].sep.getElement(), 'dblclick',
this.eventSepDblClick);
+ Event.observe(columns[j].sep.getElement(), 'mousedown',
this.eventSepMouseDown);
+ }
+ else {
+ sep.setStyle({cursor: 'auto'});
+ }
+ // sort icons
+ columns[j].sortDesc = details[1];
+ columns[j].sortAsc = details[2];
+ if(ClientUILib.isIE && columns[j].sortDesc) {
+ Element.setStyle(columns[j].sortDesc, {left: "-10px"});
+ Element.setStyle(columns[j].sortAsc, {left: "-10px"});
+ }
}
- // sort icons
- columns[j].sortDesc = details[1];
- columns[j].sortAsc = details[2];
- if(ClientUILib.isIE && columns[j].sortDesc) {
- Element.setStyle(columns[j].sortDesc, {left: "-10px"});
- Element.setStyle(columns[j].sortAsc, {left: "-10px"});
- }
j++;
}
@@ -392,12 +394,9 @@
}
},
_createSplitter: function() {
- this.columnSplitter = new ClientUI.common.box.Box(null, this.grid.getElement());
+ this.columnSplitter = new ClientUI.common.box.Box(this.grid.getElement().id
+":cs", this.grid.getElement());
this.columnSplitter.makeAbsolute();
- this.columnSplitter.getElement().addClassName("ClientUI_Grid_HSplit");
this.columnSplitter.setWidth(10);
- this.columnSplitter.getElement().setStyle({backgroundColor: ''});
- this.columnSplitter.getElement().setStyle({zIndex: '100'});
this.columnSplitter.hide();
},
adjustScrollPosition: function(pos) {
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/layouts/LayoutManager.js
===================================================================
---
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/layouts/LayoutManager.js 2007-07-04
16:24:58 UTC (rev 1468)
+++
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/layouts/LayoutManager.js 2007-07-04
18:36:00 UTC (rev 1469)
@@ -48,11 +48,9 @@
this.registerEvents();
},
registerEvents: function() {
- if(this.container)
Event.observe(window, "resize", this.eventContainerResize);
},
destroy: function() {
- if(this.container)
Event.stopObserving(window, "resize", this.eventContainerResize);
},
containerResize: function(event) {
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss
===================================================================
---
branches/3.0.2/sandbox/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss 2007-07-04
16:24:58 UTC (rev 1468)
+++
branches/3.0.2/sandbox/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss 2007-07-04
18:36:00 UTC (rev 1469)
@@ -129,9 +129,8 @@
.ClientUI_Grid_HSplit {
width:1px;
border-right:1px dashed #6593cf;
- background:none;
cursor: col-resize;
- z-index: 70;
+ z-index: 100;
}
/**
@@ -277,6 +276,12 @@
/**
* Body row style
*/
+.ClientUI_Grid_HO {
+ position: absolute;
+ height: 10px;
+ width: 10px;
+}
+
.ClientUI_Grid_BR {
font: normal 8pt arial;
white-space: nowrap;
@@ -308,18 +313,13 @@
.ClientUI_Grid_BCBody {
cursor: default;
font: normal 8pt arial;
- padding: 3px 5px;
- white-space: nowrap;
-}
-.ClientUI_Grid_BCBody1 {
- cursor: default;
- font: normal 8pt arial;
+ white-space: nowrap;
padding: 0px 0px;
- white-space: nowrap;
position: relative;
display: block;
- overflow: hidden;
+ overflow: hidden;
width: 100%;
+ height: 16px;
}
/**
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cell.jspx
===================================================================
---
branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cell.jspx 2007-07-04
16:24:58 UTC (rev 1468)
+++
branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cell.jspx 2007-07-04
18:36:00 UTC (rev 1469)
@@ -12,10 +12,8 @@
<td class="ClientUI_Grid_BC Idg-column-cell #{columnClass}
#{component.attributes['styleClass']}"
id="#{client_id}:c_#{cell_id}">
- <div id="#{client_id}:bc_#{cell_index}"
class="ClientUI_Grid_BCBody1">
- <div class="ClientUI_Grid_BCBody"
id="#{client_id}:bc_#{cell_id}">
- <vcp:body/>
- </div>
+ <div id="#{client_id}:bc_#{cell_id}"
class="ClientUI_Grid_BCBody">
+ <vcp:body/>
</div>
</td>
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx
===================================================================
---
branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx 2007-07-04
16:24:58 UTC (rev 1468)
+++
branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx 2007-07-04
18:36:00 UTC (rev 1469)
@@ -28,7 +28,7 @@
<div id="#{clientId}" style="width:
#{component.attributes['width']};height:
#{component.attributes['height']};" class="ClientUI_Grid
#{component.attributes['styleClass']}" >
-
+ <div id="#{clientId}:cs" class="ClientUI_Grid_HSplit" />
<div id="#{clientId}_GridHeaderTemplate"
class="ClientUI_InlineBox" style="width:
#{component.attributes['width']};">
<div style="display: block; left: 0px; top: 0px; width:
#{sumWidth}px;">
<span class="ClientUI_TmplBox ClientUI_FrozenBox"
id="#{clientId}:header:FrozenBox">
@@ -77,7 +77,10 @@
</div>
<div id="#{clientId}_GridBodyTemplate"
class="ClientUI_InlineBox" style="overflow: auto; width:
#{component.attributes['width']}; height:
#{component.attributes['height']};">
- <div style="display: block; width: #{sumWidth}px;">
+ <div id="#{clientId}:scb" style="position: absolute; z-index:
0;">
+ <div id="#{clientId}:sb" style="position: absolute;" />
+ </div>
+ <div id="#{clientId}:bc" style="display: block; width:
#{sumWidth}px;">
<span class="ClientUI_TmplBox ClientUI_FrozenBox"
id="#{clientId}:body:FrozenBox">
<table id="#{clientId}:f" cellpadding="0"
cellspacing="0" style="border-collapse:collapse;
table-layout:fixed">
@@ -94,6 +97,7 @@
</jsp:scriptlet>
</tbody>
</table>
+ <span class="ClientUI_Grid_HO" id="#{clientId}:fho" />
</span>
<span class="ClientUI_TmplBox ClientUI_NormalBox"
id="#{clientId}:body:NormalBox">
<table id="#{clientId}:n" cellpadding="0"
cellspacing="0" style="border-collapse:collapse;
table-layout:fixed">
@@ -112,6 +116,7 @@
</jsp:scriptlet>
</tbody>
</table>
+ <span class="ClientUI_Grid_HO" id="#{clientId}:nho" />
</span>
</div>
</div>
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/test/java/org/richfaces/renderkit/html/ScrollableGridRendererTest.java
===================================================================
---
branches/3.0.2/sandbox/scrollable-grid/src/test/java/org/richfaces/renderkit/html/ScrollableGridRendererTest.java 2007-07-04
16:24:58 UTC (rev 1468)
+++
branches/3.0.2/sandbox/scrollable-grid/src/test/java/org/richfaces/renderkit/html/ScrollableGridRendererTest.java 2007-07-04
18:36:00 UTC (rev 1469)
@@ -152,54 +152,71 @@
if(elem.getNodeName().equals("div")){
String elemClassAttr = elem.getAttributeValue("class");
- assertTrue(elemClassAttr.contains("ClientUI_InlineBox"));
- boolean templates = elem.getId().equals(grid.getId()+ "_GridBodyTemplate")
|| elem.getId().equals(grid.getId()+ "_GridFooterTemplate") ||
elem.getId().equals(grid.getId()+ "_GridHeaderTemplate");
- assertTrue(templates);
- Iterator divIter = elem.getChildElementsIterator();
- HtmlElement inDiv = (HtmlElement) divIter.next();
- assertNotNull(inDiv);
- assertEquals("div", inDiv.getNodeName());
+ res = false;
+ if(elemClassAttr.contains("ClientUI_InlineBox")){
+ res = true;
+ }else if(elemClassAttr.contains("ClientUI_Grid_HSplit")){
+ res = true;
+ }
+ assertTrue(res);
- Iterator spanIter = inDiv.getChildElementsIterator();
+ if(!elemClassAttr.contains("ClientUI_Grid_HSplit")){
+
+ boolean templates = elem.getId().equals(grid.getId()+ "_GridBodyTemplate")
|| elem.getId().equals(grid.getId()+ "_GridFooterTemplate") ||
elem.getId().equals(grid.getId()+ "_GridHeaderTemplate");
+ assertTrue(templates);
+
+ Iterator divIter = elem.getChildElementsIterator();
+ HtmlElement inDiv = (HtmlElement) divIter.next();
+ assertNotNull(inDiv);
+ assertEquals("div", inDiv.getNodeName());
+
+ Iterator spanIter = inDiv.getChildElementsIterator();
- for (;spanIter.hasNext();) {
+ for (;spanIter.hasNext();) {
- HtmlElement span = (HtmlElement) spanIter.next();
- assertNotNull(span);
- assertEquals("span", span.getNodeName());
- elemClassAttr = span.getAttributeValue("class");
- assertNotNull(elemClassAttr);
+ HtmlElement element = (HtmlElement) spanIter.next();
+ assertNotNull(element);
+ res = false;
+ if(element.getNodeName().equals("span")){
+ res = true;
+
+ }else{
+ if(element.getNodeName().equals("div")){
+ String divId = element.getAttributeValue("id");
+ assertEquals(id + ":sb", divId);
+ res = true;
+ }
+ }
+
+ assertTrue(res);
+ elemClassAttr = element.getAttributeValue("class");
+ assertNotNull(elemClassAttr);
- if(span.getId().contains("FrozenBox")){
- assertTrue(elemClassAttr.contains("ClientUI_TmplBox
ClientUI_FrozenBox"));
- }else if(span.getId().contains("NormalBox")){
- assertTrue(elemClassAttr.contains("ClientUI_TmplBox
ClientUI_NormalBox"));
- }
+ if(element.getId().contains("FrozenBox")){
+ assertTrue(elemClassAttr.contains("ClientUI_TmplBox
ClientUI_FrozenBox"));
+ }else if(element.getId().contains("NormalBox")){
+ assertTrue(elemClassAttr.contains("ClientUI_TmplBox
ClientUI_NormalBox"));
+ }
- for (int i = 0; i < columns; i++) {
+ for (int i = 0; i < columns; i++) {
- HtmlElement hcell = page.getHtmlElementById(id + ":hc_" + i);
- assertNotNull(hcell);
- elemClassAttr = hcell.getAttributeValue("class");
- assertTrue(elemClassAttr.contains("ClientUI_Grid_HC Idg-header-cell"));
+ HtmlElement hcell = page.getHtmlElementById(id + ":hc_" + i);
+ assertNotNull(hcell);
+ elemClassAttr = hcell.getAttributeValue("class");
+ assertTrue(elemClassAttr.contains("ClientUI_Grid_HC Idg-header-cell"));
- for (int j = 0; j < grid.getRows(); j++) {
- HtmlElement bcell = page.getHtmlElementById(id + ":c_" + j +
"_" + i);
- assertNotNull(bcell);
- elemClassAttr = bcell.getAttributeValue("class");
- assertTrue(elemClassAttr.contains("ClientUI_Grid_BC Idg-column-cell"));
+ for (int j = 0; j < grid.getRows(); j++) {
+ HtmlElement bcell = page.getHtmlElementById(id + ":c_" + j +
"_" + i);
+ assertNotNull(bcell);
+ elemClassAttr = bcell.getAttributeValue("class");
+ assertTrue(elemClassAttr.contains("ClientUI_Grid_BC
Idg-column-cell"));
+ }
}
-
}
-
}
-
}
-
}
-
}
-
}