You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by sc...@apache.org on 2011/04/05 15:05:37 UTC

svn commit: r1089019 - in /incubator/wookie/trunk: WebContent/shared/js/wookie-wrapper.js src/org/apache/wookie/ajaxmodel/impl/WidgetAPIImpl.java

Author: scottbw
Date: Tue Apr  5 13:05:37 2011
New Revision: 1089019

URL: http://svn.apache.org/viewvc?rev=1089019&view=rev
Log:
Ensure that we always return a number for "width" and "height" widget attributes and never NULL, as required by the TWI spec. See WOOKIE-204. If there is no value, we return 0.

Modified:
    incubator/wookie/trunk/WebContent/shared/js/wookie-wrapper.js
    incubator/wookie/trunk/src/org/apache/wookie/ajaxmodel/impl/WidgetAPIImpl.java

Modified: incubator/wookie/trunk/WebContent/shared/js/wookie-wrapper.js
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/WebContent/shared/js/wookie-wrapper.js?rev=1089019&r1=1089018&r2=1089019&view=diff
==============================================================================
--- incubator/wookie/trunk/WebContent/shared/js/wookie-wrapper.js (original)
+++ incubator/wookie/trunk/WebContent/shared/js/wookie-wrapper.js Tue Apr  5 13:05:37 2011
@@ -163,6 +163,7 @@ var Widget = {
 	},
 
 	setMetadataProperty: function(key, value){
+        if (key == "width" || key == "height") value = Number(value);
 		try{
 			Widget.__defineSetter__(key, function(){window.DOMException.code = DOMException.NO_MODIFICATION_ALLOWED_ERR;throw (window.DOMException);});
 			Widget.__defineGetter__(key, function(){return value});

Modified: incubator/wookie/trunk/src/org/apache/wookie/ajaxmodel/impl/WidgetAPIImpl.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/ajaxmodel/impl/WidgetAPIImpl.java?rev=1089019&r1=1089018&r2=1089019&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/ajaxmodel/impl/WidgetAPIImpl.java (original)
+++ incubator/wookie/trunk/src/org/apache/wookie/ajaxmodel/impl/WidgetAPIImpl.java Tue Apr  5 13:05:37 2011
@@ -119,6 +119,12 @@ public class WidgetAPIImpl implements IW
 		String version = "";
 		if (widget.getVersion() != null) version = WidgetFormattingUtils.getEncoded(widget.getDir(), widget.getVersion());
 		
+		String width = "0";
+		if (widget.getWidth() != null) width = String.valueOf(widget.getWidth());
+		
+		String height = "0";
+		if (widget.getHeight() != null) height = String.valueOf(widget.getHeight());
+		
 		// Add in metadata
 
 		map.put("id", String.valueOf(widget.getGuid()));	//$NON-NLS-1$
@@ -129,8 +135,8 @@ public class WidgetAPIImpl implements IW
 		map.put("description", description);//$NON-NLS-1$	
 		map.put("shortName", shortName); //$NON-NLS-1$
 		map.put("version",version);//$NON-NLS-1$
-		map.put("width", String.valueOf(widget.getWidth()));//$NON-NLS-1$
-		map.put("height", String.valueOf(widget.getHeight()));//$NON-NLS-1$
+		map.put("width", width);//$NON-NLS-1$
+		map.put("height", height);//$NON-NLS-1$
 		
 		return map;
 	}