You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by jm...@apache.org on 2007/04/04 21:15:15 UTC

svn commit: r525607 - in /incubator/xap/trunk/codebase/src/xap/bridges/dojo: CellBridge.js RowBridge.js

Author: jmargaris
Date: Wed Apr  4 14:15:14 2007
New Revision: 525607

URL: http://svn.apache.org/viewvc?view=rev&rev=525607
Log:
cells can now have a dedicated sort value and the sort
text/value logic is more robust
from : https://issues.apache.org/jira/browse/XAP-352

Modified:
    incubator/xap/trunk/codebase/src/xap/bridges/dojo/CellBridge.js
    incubator/xap/trunk/codebase/src/xap/bridges/dojo/RowBridge.js

Modified: incubator/xap/trunk/codebase/src/xap/bridges/dojo/CellBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/dojo/CellBridge.js?view=diff&rev=525607&r1=525606&r2=525607
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/CellBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/CellBridge.js Wed Apr  4 14:15:14 2007
@@ -22,6 +22,8 @@
 
 xap.bridges.dojo.CellBridge = function() {
 	xap.bridges.basic.AbstractWidgetBridge.call(this);
+	this._cellInfo = {};
+	this._cellInfo._text = "";
 }
 
 Xap.setupClassAsSubclassOf("xap.bridges.dojo.CellBridge", "xap.bridges.basic.AbstractWidgetBridge");
@@ -40,13 +42,20 @@
 
 
 xap.bridges.dojo.CellBridge.prototype.getNewAllowedAttributes = function() {
-	return ["text", "image", "backgroundColor", "horizontalAlignment"];
+	return ["text", "image", "backgroundColor", "horizontalAlignment", "sortValue"];
 }	
 
 xap.bridges.dojo.CellBridge.prototype.setTextAttribute = function(text) {
 	this._domNode.innerHTML = text;
+	this._cellInfo._text = text;
 }
 
+/** XML attribute set method for "sortValue" */
+xap.bridges.dojo.CellBridge.prototype.setSortValueAttribute = function(text) {
+    this._cellInfo._sortValue = text;
+}
+
+
 xap.bridges.dojo.CellBridge.prototype.setImageAttribute = function(text) {
 	/*
 	TODO
@@ -73,4 +82,9 @@
 	/*
 	TODO: implement vertical alignment
 	*/
+}
+
+/** getCellInfo implementation for use by row bridge */
+xap.bridges.dojo.CellBridge.prototype.getCellInfo = function() {
+    return this._cellInfo;
 }

Modified: incubator/xap/trunk/codebase/src/xap/bridges/dojo/RowBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/dojo/RowBridge.js?view=diff&rev=525607&r1=525606&r2=525607
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/RowBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/RowBridge.js Wed Apr  4 14:15:14 2007
@@ -81,16 +81,22 @@
 		this.getPeer().insertRow(childHandler.getPeer(),index);
 	}
 	else{
-		var cellInfo = {};
-		cellInfo._text="";
+	    var cellInfo = null;
+	    if (childHandler.getCellInfo) {
+	        cellInfo = childHandler.getCellInfo();
+	    } else {
+	        // Non-cell child in the row, try to use the text
+	        cellInfo = { };   
+    		cellInfo._text = "";
+    		
+		    if (childHandler.getPeer() && childHandler.getPeer().getText){
+		    	cellInfo._text=childHandler.getPeer().getText();
+		    }
+	    	else{
+    			cellInfo._text = xap.bridges.dojo.RowBridge.ts_getInnerText(childHandler.getRootDomNode());
+    		}
+	    }
 		
-		//TODO improve how we recognize text and sort value
-		if (childHandler.getPeer() && childHandler.getPeer().getText){
-			cellInfo._text=childHandler.getPeer().getText();
-		}
-		else{
-			cellInfo._text = xap.bridges.dojo.RowBridge.ts_getInnerText(childHandler.getRootDomNode());
-		}
 		this.getPeer().addCell(childHandler.getRootDomNode(),cellInfo);
 	}
 }