[richfaces-svn-commits] JBoss Rich Faces SVN: r5174 - in branches/3.1.x/ui/scrollableDataTable/src/main: javascript/ClientUI/common/box and 1 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Tue Jan 8 07:08:18 EST 2008


Author: konstantin.mishin
Date: 2008-01-08 07:08:18 -0500 (Tue, 08 Jan 2008)
New Revision: 5174

Modified:
   branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
   branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Box.js
   branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js
   branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js
Log:
merged scrollable-data-table with trunk

Modified: branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
===================================================================
--- branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java	2008-01-08 11:59:21 UTC (rev 5173)
+++ branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java	2008-01-08 12:08:18 UTC (rev 5174)
@@ -72,7 +72,7 @@
 			int width = 0;
 						
 			
-			String widthPx = (String)column.getAttributes().get("width");
+			String widthPx = getColumnWidth(column);
 			widthPx = getFormattedWidth(widthPx);
 			prevWidth = state.getSumWidth();
 			width = prevWidth + Integer.parseInt(widthPx); 
@@ -86,7 +86,7 @@
 
 		public void renderContent(FacesContext context, UIComponent column, ResponseWriter writer, ScrollableDataTableRendererState state) throws IOException {
 			writer.startElement("col", column);
-			getUtils().writeAttribute(writer, "width", column.getAttributes().get("width"));
+			getUtils().writeAttribute(writer, "width", getColumnWidth(column));
 			getUtils().writeAttribute(writer, "style", column.getAttributes().get("style"));
 			//int cell_index =  state.getCellIndex();
 			//Object columnClass = state.getColumnClass(cell_index);
@@ -108,7 +108,7 @@
 			
 			ComponentVariables variables = 
 				ComponentsVariableResolver.getVariables(headerCellTemplate, column);
-			String widthPx = (String)column.getAttributes().get("width");
+			String widthPx = getColumnWidth(column);
 			
 			widthPx = getFormattedWidth(widthPx);
 			int width = Integer.parseInt(widthPx);
@@ -956,4 +956,11 @@
 		return sorting;
 	}
 
+	private String getColumnWidth(UIComponent column) {
+		String width = (String) column.getAttributes().get("width");
+		if (width == null) {
+			width = "100px";
+		}
+		return width;
+	}
 }

Modified: branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Box.js
===================================================================
--- branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Box.js	2008-01-08 11:59:21 UTC (rev 5173)
+++ branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Box.js	2008-01-08 12:08:18 UTC (rev 5174)
@@ -69,8 +69,9 @@
 		return this.element;
 	},
 	getHeight: function() {
-		if(this.getElement().tagName.toLowerCase() != "body") {
-			var h = Element.getHeight(this.element);
+		var el = this.getElement();
+		if(el.tagName.toLowerCase() != "body") {
+			var h = el.offsetHeight;
 			return h>0 ? h : (this.element.boxHeight ? parseInt(this.element.boxHeight) : 0);
 		}
 
@@ -97,8 +98,9 @@
 		return this;
 	},
 	getWidth: function() {
-		if(this.getElement().tagName.toLowerCase() != "body") {
-			var w = Element.getWidth(this.element);
+		var el = this.getElement();
+		if(el.tagName.toLowerCase() != "body") {
+			var w = el.offsetWidth;
 			return w>0 ? w : (this.element.boxWidth ? parseInt(this.element.boxWidth) : 0);
 		}
 			

Modified: branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js
===================================================================
--- branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js	2008-01-08 11:59:21 UTC (rev 5173)
+++ branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js	2008-01-08 12:08:18 UTC (rev 5174)
@@ -102,10 +102,11 @@
 
 		this.helpObj = new ClientUI.common.box.Box(this.frozenContentBox.getElement(), null, true);
 		this.defaultWidth = this.grid.getHeader().defaultWidth;
-		this.defaultHeight = Element.getHeight(this.headerRow.getElement().rows[0].cells[0]);
 		if(ClientUILib.isGecko) {
 			this.defaultHeight -= this.getBorderWidth("tb") + this.getPadding("tb");
 			//this.defaultWidth -= this.getBorderWidth("lr") + this.getPadding("lr");
+		} else {
+			this.defaultHeight = this.headerRow.getElement().rows[0].cells[0].offsetHeight;			
 		}
 				
 		this.frozenSubstrate = new ClientUI.common.box.Box(this.grid.getElement().id + ":fs", this.getElement());
@@ -115,10 +116,11 @@
 	},
 	updateSize: function() {
 		this.defaultWidth = this.grid.getHeader().defaultWidth;
-		this.defaultHeight = Element.getHeight(this.headerRow.getElement().rows[0].cells[0]);
 		if(ClientUILib.isGecko) {
 			this.defaultHeight -= this.getBorderWidth("tb") + this.getPadding("tb");
 			//this.defaultWidth -= this.getBorderWidth("lr") + this.getPadding("lr");
+		} else {
+		this.defaultHeight = this.headerRow.getElement().rows[0].cells[0].offsetHeight;			
 		}
 		this.setHeight(this.defaultHeight);
 		this.setWidth(this.defaultWidth);

Modified: branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js
===================================================================
--- branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js	2008-01-08 11:59:21 UTC (rev 5173)
+++ branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js	2008-01-08 12:08:18 UTC (rev 5174)
@@ -140,7 +140,7 @@
 			
 			if(columns[j].sortable)
 				Event.observe(cell, 'click',  eventCellMouseDown);
-			h = Element.getHeight(cell);
+			h = cell.offsetHeigh;
 			if(h > defaultHeight) defaultHeight = h;
 			defaultWidth += columns[j].width;
 			columns[j].object = new ClientUI.common.box.InlineBox(cell, null, true);
@@ -187,7 +187,7 @@
 			
 			if(columns[j].sortable)
 				Event.observe(cell, 'click',  eventCellMouseDown);
-			h = Element.getHeight(cell);
+			h = cell.offsetHeight;
 			if(h > defaultHeight) defaultHeight = h;
 			defaultWidth += columns[j].width;
 			columns[j].object = new ClientUI.common.box.InlineBox(cell, null, true);
@@ -259,7 +259,7 @@
 		cells.each(function(cell) {
 			if(i<columns.length) {
 				columns[i].width = parseInt(cols[j].width);				
-				h = Element.getHeight(cell);
+				h = cell.offsetHeigh;
 				if(h > defaultHeight) defaultHeight = h;
 				defaultWidth += columns[i].width;
 			}
@@ -273,7 +273,7 @@
 			if(i<columns.length) {
 				columns[i].width = parseInt(cols[j].width);
 				
-				h = Element.getHeight(cell);
+				h = cell.offsetHeigh;
 				if(h > defaultHeight) defaultHeight = h;
 				defaultWidth += columns[i].width;
 			}




More information about the richfaces-svn-commits mailing list