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 mt...@apache.org on 2007/05/13 19:55:48 UTC

svn commit: r537648 - in /incubator/xap/trunk/codebase/src/xap/bridges/google: GoogleIconBridge.js GoogleIconsBridge.js GoogleInfoWindowBridge.js GoogleLineBridge.js GoogleLinesBridge.js GoogleMarkerBridge.js GoogleMarkersBridge.js

Author: mturyn
Date: Sun May 13 12:55:47 2007
New Revision: 537648

URL: http://svn.apache.org/viewvc?view=rev&rev=537648
Log:
Surender's patches.

Modified:
    incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleIconBridge.js
    incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleIconsBridge.js
    incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleInfoWindowBridge.js
    incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleLineBridge.js
    incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleLinesBridge.js
    incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleMarkerBridge.js
    incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleMarkersBridge.js

Modified: incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleIconBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleIconBridge.js?view=diff&rev=537648&r1=537647&r2=537648
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleIconBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleIconBridge.js Sun May 13 12:55:47 2007
@@ -5,7 +5,7 @@
  *  regarding copyright ownership.  The ASF licenses this file
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
+ *  with the License.  You may obtain a copy of the License at 
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
@@ -19,91 +19,101 @@
  
  /**
  * @fileoverview
- * 
- * A bridge class that controls a GIcon peer.
+ * @author
+ *
+ * A bridge class that provides animations effects
  */
 
+/*
+ * this library requires Google Maps to be loaded
+ *
+ */
 
 Xap.provide("xap.bridges.google.GoogleIconBridge"); 
-// Auto-added---o.k.?
-Xap.require("xap.session.ClientEvent");
+Xap.require("xap.taghandling.AbstractTagImpl");
 
-// Auto-added---o.k.?
-// TO_DO--make sure this is superfluous: Xap.require("xap.bridges.google.GoogleInfoWindowBridge");
+/* Creates a xap.bridges.google.GoogleIconBridge.
 
-Xap.require("xap.bridges.google.GoogleBridge"); 
+   Constructor
+*/
+xap.bridges.google.GoogleIconBridge= function() { 
+	xap.taghandling.AbstractTagImpl.call(this);
+}
 
-/**
- * Creates a xap.bridges.google.GoogleInfoWindowBridge.
- * 
- * 
- * @class xap.bridges.google.GoogleInfoWindowBridge is the bridge between an XML element
- * representing a google maps marker.
- * 
- * @constructor
- * 
- * @author bbuffone
- */
-xap.bridges.google.GoogleIconBridge = function() {
-	xap.bridges.google.GoogleBridge.call( this );
+// Making the GoogleIconBridge as a sub class of AbstractTagImpl
+Xap.setupClassAsSubclassOf("xap.bridges.google.GoogleIconBridge", "xap.taghandling.AbstractTagImpl");
+
+// initialize, create the marker and add to the parent
+xap.bridges.google.GoogleIconBridge.prototype.init = function() {
+	xap.taghandling.AbstractTagImpl.prototype.init.call(this);
+	this.createIcon();
+	this.parseInitialChildren(this.getElement());
 }
 
-xap.bridges.google.GoogleIconBridge.prototype = new xap.bridges.google.GoogleBridge;
+xap.bridges.google.GoogleIconBridge.prototype.createIcon = function() {
 
-xap.bridges.google.GoogleIconBridge.s_log = xap.log.Logger.getLogger( "xap.bridges.google.GoogleIconBridge" );
+	try {
+		// retrieve the initial attributes which supports.      	    
+		var icon = new GIcon();
+
+		image = this.getElement().getAttribute("image");
+		if (image!=null && image!=""){
+			icon.image = image;
+		}
+
+		shadow = this.getElement().getAttribute("shadow");	 
+		if (shadow!=null && shadow!=""){
+			icon.shadow = shadow;
+		}
+
+		iconSize = this.getElement().getAttribute("iconSize");
+		if (iconSize!=null && iconSize!=""){
+			icon.iconSize = this.convertStringToGSize(iconSize);
+		}
+
+		shadowSize = this.getElement().getAttribute("shadowSize");
+		if (shadowSize!=null && shadowSize!=""){
+			icon.shadowSize = this.convertStringToGSize(shadowSize);
+		}
+
+		iconAnchor = this.getElement().getAttribute("iconAnchor");
+		if (iconAnchor!=null && iconAnchor!=""){
+			icon.iconAnchor  = this.convertStringToGPoint(iconAnchor);
+		}
+
+		infoWindowAnchor = this.getElement().getAttribute("infoWindowAnchor");
+		if (infoWindowAnchor!=null && infoWindowAnchor!=""){
+			icon.infoWindowAnchor = this.convertStringToGPoint(infoWindowAnchor);
+		}
+
+		this.setPeer(icon);
+
+	} 
+	catch ( e ) {
+		alert( e );
+	}
+}
 
-xap.bridges.google.GoogleIconBridge.prototype.toString = function() {
-	return "xap.bridges.google.GoogleIconBridge";
+/**
+ * takes a string that is comma seperated x and y "37, 80"
+ * and returns a CPoint object.  
+ */
+ 
+xap.bridges.google.GoogleIconBridge.prototype.convertStringToGPoint = function(value) {
+    var x = parseFloat(value.substring(0, value.indexOf(",")));
+    var y = parseFloat(value.substring(value.indexOf(",") + 1));
+    return new GPoint(x, y);   
 }
 
 /**
- * Creates the peer component that this bridge controls.
+ * takes a string that is comma seperated width and height "37, 80"
+ * and returns a GSize object.  
  */
-xap.bridges.google.GoogleIconBridge.prototype.createPeer = function() {
-	var parent = this.getElement().getParent();
-	var handler = this.getUiContentHandler().getHandlerForElement( parent );
-	var parentPeer = handler.getPeer();
-	
-	if ( parentPeer instanceof GMap2 ) {
-    	try {
-    	    //Parse the value into the lat and long that will be used to 
-    	    //set the center position.       	    
-            var icon = new GIcon();
-            
-	        image = this.getElement().getAttribute("image");
-	        if (image!=null&&image!=""){
-	            icon.image=image;
-	        }
-	        shadow = this.getElement().getAttribute("shadow");	 
-	        if (shadow!=null&&shadow!=""){
-	            icon.shadow=shadow;
-	        }
-	        iconSize = this.getElement().getAttribute("iconSize");
-	        if (iconSize!=null&&iconSize!=""){
-	            icon.iconSize=this.convertStringToGSize(iconSize);
-	        }
-	        shadowSize = this.getElement().getAttribute("shadowSize");
-	        if (shadowSize!=null&&shadowSize!=""){
-	            icon.shadowSize=this.convertStringToGSize(shadowSize);
-	        }
-	        iconAnchor = this.getElement().getAttribute("iconAnchor");
-	        if (iconAnchor!=null&&iconAnchor!=""){
-	            icon.iconAnchor=this.convertStringToGPoint(iconAnchor);
-	        }
-	        infoWindowAnchor = this.getElement().getAttribute("infoWindowAnchor");
-	        if (infoWindowAnchor!=null&&infoWindowAnchor!=""){
-	            icon.infoWindowAnchor=this.convertStringToGPoint(infoWindowAnchor);
-	        }
-                        
-    		this.setPeer(icon);
-        } catch ( e ) {
-        	alert(e);
-    	}
-	} else {
-		
-		//TODO this message is lame
-		xap.bridges.google.GoogleIconBridge.s_log.error("Bogus parent peer:" + parentPeer );
-	}
+ 
+xap.bridges.google.GoogleIconBridge.prototype.convertStringToGSize = function(value) {
+	var width = parseFloat(value.substring(0, value.indexOf(",")));
+	var height = parseFloat(value.substring(value.indexOf(",") + 1))
+	return new GSize(width, height);   
 }
 
 /**
@@ -120,38 +130,4 @@
      
     //this method will handle the firing of all event handlers
     this.fireEvent("onClick", null, null, clientEvent);  	
-}
-
-/**
- * This method is called whenever an attribute
- * on the XML element that maps to this bridge class
- * is changed. DwtControlBridge handles the following attributes:
- * Attributes not handled here are are passed to the 
- * superclass attributeSet method.
- */
-xap.bridges.google.GoogleIconBridge.prototype.attributeSet = function( event ) {
-	var name = event.getName();
-	var value = event.getNewValue();
-    
-	if (name=="image") {
-	}else if (name=="shadow"){	 
-	}else if (name=="iconSize"){
-	}else if (name=="shadowSize"){
-	}else if (name=="iconAnchor"){
-	}else if (name=="infoWindowAnchor"){
-	}else{
-		xap.bridges.google.GoogleBridge.prototype.attributeSet.call( this, event );
-	}
-	
-}
-
-/**
- * Called by the parent to handle the removal of the Xml Element from the parent.
- * In the case of the marker bridge we will need to remove the maker.
- */
-xap.bridges.google.GoogleIconBridge.prototype.handleRemoval = function(parent, parentPeer) {
-    //remove the marker.
-    parentPeer.removeOverlay(this.getPeer());
-
-	xap.bridges.google.GoogleBridge.prototype.attributeSet.call( this, event );
 }

Modified: incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleIconsBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleIconsBridge.js?view=diff&rev=537648&r1=537647&r2=537648
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleIconsBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleIconsBridge.js Sun May 13 12:55:47 2007
@@ -5,7 +5,7 @@
  *  regarding copyright ownership.  The ASF licenses this file
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
+ *  with the License.  You may obtain a copy of the License at 
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
@@ -19,48 +19,43 @@
  
  /**
  * @fileoverview
- * 
- * A bridge class that controls a Google object peer.
+ * @author
+ *
+ * A bridge class that provides animations effects
+ */
+
+/*
+ * this library requires Google Maps to be loaded
+ *
  */
 
 Xap.provide("xap.bridges.google.GoogleIconsBridge"); 
-// Auto-added---o.k.?
 Xap.require("xap.taghandling.AbstractTagImpl");
 
-Xap.require("xap.bridges.google.GoogleBridge"); 
+/* Creates a xap.bridges.google.GoogleIconsBridge.
 
-/**
- * Creates a xap.bridges.google.GoogleIconsBridge.
- * 
- * 
- * @class xap.bridges.google.GoogleIconsBridge is the bridge between an XML element
- * representing a google object.
- * 
- * @constructor
- * 
- * @author bbuffone
- */
-xap.bridges.google.GoogleIconsBridge = function() {
-	xap.taghandling.AbstractTagImpl.call( this );
+   Constructor
+*/
+xap.bridges.google.GoogleIconsBridge= function() { 
+	xap.taghandling.AbstractTagImpl.call(this);
 }
 
-xap.bridges.google.GoogleIconsBridge.prototype = new xap.bridges.google.GoogleBridge;
+// Making the GoogleIconsBridge as a sub class of AbstractTagImpl
+Xap.setupClassAsSubclassOf(	"xap.bridges.google.GoogleIconsBridge",	"xap.taghandling.AbstractTagImpl" );
 
-xap.bridges.google.GoogleIconsBridge.s_log = xap.log.Logger.getLogger( "xap.bridges.google.GoogleIconsBridge" );
+xap.bridges.google.GoogleIconsBridge.prototype.init = function() {
 
-xap.bridges.google.GoogleIconsBridge.prototype.toString = function() {
-	return "xap.bridges.google.GoogleIconsBridge";
+	// call the base class init and then parse attributes and children
+	xap.taghandling.AbstractTagImpl.prototype.init.call(this);
+	this.parseInitialChildren(this.getElement());
 }
 
-xap.bridges.google.GoogleIconsBridge.prototype.createPeer = function() {
-	var parent = this.getElement().getParent();
-	var handler = this.getUiContentHandler().getHandlerForElement( parent );
-	var parentPeer = handler.getPeer();
+xap.bridges.google.GoogleIconsBridge.prototype.childAdded = function( e ){	
+	
+	// grab the child from the event
+	var childElement = e.getChange();
+	var childHandler = this.getUiContentHandler().getHandlerForElement( childElement );
 	
-	//just set the peer to be the google map.
-	if ( parentPeer instanceof GMap2 ) {         
-    	this.setPeer(parentPeer);
- 	} else {
-		xap.bridges.google.GoogleIconsBridge.s_log.error("Bogus parent peer:" + parentPeer );
-	}
+	// save the map object to the child
+	childHandler._map = this._map;	
 }

Modified: incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleInfoWindowBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleInfoWindowBridge.js?view=diff&rev=537648&r1=537647&r2=537648
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleInfoWindowBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleInfoWindowBridge.js Sun May 13 12:55:47 2007
@@ -17,67 +17,57 @@
  *
  */
 
-Xap.provide("xap.bridges.google.GoogleInfoWindowBridge"); 
-Xap.require("xap.bridges.google.GoogleBridge"); 
-
  /**
  * @fileoverview
- * 
- * A bridge class that controls a Google Info Window peer.
+ * @author
+ *
+ * A bridge class that provides animations effects
  */
 
-/**
- * Creates a xap.bridges.google.GoogleInfoWindowBridge.
- * 
- * 
- * @class xap.bridges.google.GoogleInfoWindowBridge is the bridge between an XML element
- * representing a google maps info window.
- * 
- * @constructor
- * 
- * @author bbuffone
+/*
+ * this library requires Google Maps to be loaded
+ *
  */
-xap.bridges.google.GoogleInfoWindowBridge = function() {
-	xap.bridges.google.GoogleBridge.call( this );
+
+Xap.provide("xap.bridges.google.GoogleInfoWindowBridge"); 
+Xap.require("xap.taghandling.AbstractTagImpl");
+
+/* Creates a xap.bridges.google.GoogleInfoWindowBridge.
+
+   Constructor
+*/
+xap.bridges.google.GoogleInfoWindowBridge= function() { 
+	xap.taghandling.AbstractTagImpl.call(this);
 }
 
-xap.bridges.google.GoogleInfoWindowBridge.prototype = new xap.bridges.google.GoogleBridge;
+// Making the GoogleInfoWindowBridge as a sub class of AbstractTagImpl
+Xap.setupClassAsSubclassOf(	"xap.bridges.google.GoogleInfoWindowBridge", "xap.taghandling.AbstractTagImpl" );
 
-xap.bridges.google.GoogleInfoWindowBridge.s_log = xap.log.Logger.getLogger( "xap.bridges.google.GoogleInfoWindowBridge" );
+xap.bridges.google.GoogleInfoWindowBridge.prototype.init = function() {
 
-xap.bridges.google.GoogleInfoWindowBridge.prototype.toString = function() {
-	return "xap.bridges.google.GoogleInfoWindowBridge";
+	// call the base class init and then parse attributes and children
+	xap.taghandling.AbstractTagImpl.prototype.init.call(this);
+	this.parseInitialChildren(this.getElement());
+	this.createInfoWindow();
 }
 
-/**
- * Creates the peer component that this bridge controls.
- */
-xap.bridges.google.GoogleInfoWindowBridge.prototype.createPeer = function() {
-	var parent = this.getElement().getParent();
-	var handler = this.getUiContentHandler().getHandlerForElement( parent );
-	var parentPeer = handler.getPeer();
-	
-	if ( parentPeer instanceof GMap2 ) {
-    	try {
-    	    //Parse the value into the lat and long that will be used to 
-    	    //set the center position.   
-    	    var lat = this.getElement().getAttribute("latitude") * 1.0;
-    	    var lng = this.getElement().getAttribute("longitude") * 1.0;
-    	  
-    	    var point = new GLatLng(lat, lng); 
-    	    var textAttribute = this.getElement().getAttribute("text");
-    	    var firstChild = this.getElement().firstChild;
-    	    if (textAttribute!=null&&textAttribute!=""){
-    		    parentPeer.openInfoWindowHtml(point, textAttribute);
-            }else if (firstChild!=null&&firstChild.nodeValue!=null&&firstChild.nodeValue!=""){
-                parentPeer.openInfoWindowHtml(point, firstChild.nodeValue);
-            }
-                         
-        } catch ( e ) {
-        	alert(e);
-    	}
-	} else {
-		xap.bridges.google.GoogleInfoWindowBridge.s_log.error("Bogus parent peer:" + parentPeer );
+xap.bridges.google.GoogleInfoWindowBridge.prototype.createInfoWindow = function() {
+
+	// retrieve the initial attributes
+	var lat = this.getElement().getAttribute("latitude");
+	var lng = this.getElement().getAttribute("longitude");
+	var textAttribute = this.getElement().getAttribute("text");
+	var point = new GLatLng(lat, lng); 
+
+    var firstChild = this.getElement().firstChild;
+
+	if (textAttribute){
+		this._map.openInfoWindowHtml(point, textAttribute);
+	}
+	else if (firstChild && firstChild.nodeValue){
+		this._map.openInfoWindowHtml(point, firstChild.nodeValue);
 	}
 }
+	
+	
 

Modified: incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleLineBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleLineBridge.js?view=diff&rev=537648&r1=537647&r2=537648
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleLineBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleLineBridge.js Sun May 13 12:55:47 2007
@@ -5,7 +5,7 @@
  *  regarding copyright ownership.  The ASF licenses this file
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
+ *  with the License.  You may obtain a copy of the License at 
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
@@ -16,127 +16,78 @@
  *  limitations under the License.
  *
  */
-
-Xap.provide("xap.bridges.google.GoogleLineBridge"); 
-// Auto-added---o.k.?
-Xap.require("xap.session.ClientEvent");
-
-// Auto-added---o.k.?
-// TO_DO--make sure this is superfluous: Xap.require("xap.bridges.google.GoogleInfoWindowBridge");
-
-Xap.require("xap.bridges.google.GoogleBridge"); 
-
+ 
  /**
  * @fileoverview
- * 
- * A bridge class that controls a GMarker peer.
+ * @author
+ *
+ * A bridge class that provides animations effects
  */
 
-/**
- * Creates a xap.bridges.google.GoogleInfoWindowBridge.
- * 
- * 
- * @class xap.bridges.google.GoogleInfoWindowBridge is the bridge between an XML element
- * representing a google maps marker.
- * 
- * @constructor
- * 
- * @author bbuffone
+/*
+ * this library requires Google Maps to be loaded
+ *
  */
-xap.bridges.google.GoogleLineBridge = function() {
-	xap.bridges.google.GoogleBridge.call( this );
-}
 
-xap.bridges.google.GoogleLineBridge.prototype = new xap.bridges.google.GoogleBridge;
+Xap.provide("xap.bridges.google.GoogleLineBridge"); 
+Xap.require("xap.taghandling.AbstractTagImpl");
 
-xap.bridges.google.GoogleLineBridge.s_log = xap.log.Logger.getLogger( "xap.bridges.google.GoogleLineBridge" );
+/* Creates a xap.bridges.google.GoogleLineBridge.
 
-xap.bridges.google.GoogleLineBridge.prototype.toString = function() {
-	return "xap.bridges.google.GoogleLineBridge";
+   Constructor
+*/
+xap.bridges.google.GoogleLineBridge= function() { 
+	xap.taghandling.AbstractTagImpl.call(this);
 }
 
-/**
- * Creates the peer component that this bridge controls.
- */
-xap.bridges.google.GoogleLineBridge.prototype.createPeer = function() {
-	var parent = this.getElement().getParent();
-	var handler = this.getUiContentHandler().getHandlerForElement( parent );
-	var parentPeer = handler.getPeer();
-	
-	if ( parentPeer instanceof GMap2 ) {
-    	try {
-    	    //Parse the value into the lat and long that will be used to 
-    	    //set the center position.   
-    	    var pointsString = this.getElement().getAttribute("points");
-    	    var weight = this.getElement().getAttribute("weight") * 1.0;
-    	    var color = this.getElement().getAttribute("color");
-    	    var opacity = this.getElement().getAttribute("opacity");
-    	    if (opacity == null || opacity == ""){
-    	    	opacity = 1.0;
-    	    }
-    	    var thisPeer = this;   	    
-    	    var points = new Array();
-    	        	      	    
-    	    //lat, lng, lat, lng, lat, lng
-    	    var indexPos = pointsString.indexOf(",");
-    	    while (indexPos != -1){
-    	    	var lat = pointsString.substring(0, indexPos) * 1.0;
-    	    	pointsString = pointsString.substring(indexPos + 1);
-    	    	
-    	    	indexPos = pointsString.indexOf(",");
-    	    	var lng = "";
-    	    	if (indexPos != -1){
-    	    		lng = pointsString.substring(0, indexPos) * 1.0;
-    	    		pointsString = pointsString.substring(indexPos + 1);
-				}else{
-					lng = pointsString * 1.0;
-				}
-				var point = new GLatLng(lat, lng); 
-				points.push(point);
-				
-    	    	indexPos = pointsString.indexOf(",");
-    	    }
-
-    	    var polyLine = new GPolyline(points, color, weight, opacity); 
-     	    
-     	     	    
-    		parentPeer.addOverlay(polyLine);                       
-    		this.setPeer(polyLine);
-        } catch ( e ) {
-        	alert(e);
-    	}
-	} else {
-		xap.bridges.google.GoogleLineBridge.s_log.error("Bogus parent peer:" + parentPeer );
-	}
-}
+// Making the GoogleLineBridge as a sub class of AbstractTagImpl
+Xap.setupClassAsSubclassOf(	"xap.bridges.google.GoogleLineBridge", "xap.taghandling.AbstractTagImpl" );
 
-/**
- * This method is called whenever an attribut
- * on the XML element that maps to this bridge class
- * is changed. DwtControlBridge handles the following attributes:
- * Attributes not handled here are are passed to the 
- * superclass attributeSet method.
- */
-xap.bridges.google.GoogleLineBridge.prototype.attributeSet = function( event ) {
-	var name = event.getName();
-	var value = event.getNewValue();
-    
-	if (name=="latitude"){	 
-	}else if (name=="longitude"){
-	}else if (name=="weight"){
-	}else if (name=="color"){
-	}else if (name=="opacity"){
-	}else{
-		xap.bridges.google.GoogleBridge.prototype.attributeSet.call( this, event );
-	}
-	
+xap.bridges.google.GoogleLineBridge.prototype.init = function() {	
+	// initialize, create the Line and add to the parent
+	xap.taghandling.AbstractTagImpl.prototype.init.call(this);
+	this.createLine();
+	this.parseInitialChildren(this.getElement());
 }
 
-/**
- * Called by the parent to handle the removal of the Xml Element from the parent.
- * In the case of the marker bridge we will need to remove the maker.
- */
-xap.bridges.google.GoogleLineBridge.prototype.handleRemoval = function(parent, parentPeer) {
-    //remove the marker.
-    parentPeer.removeOverlay(this.getPeer());
+xap.bridges.google.GoogleLineBridge.prototype.createLine = function() {
+	try {
+
+		// retrieve the initial attributes
+		var pointsString = this.getElement().getAttribute("points");
+		var weight = parseFloat(this.getElement().getAttribute("weight"));
+		var color = this.getElement().getAttribute("color");
+		var opacity = this.getElement().getAttribute("opacity");
+
+		if (opacity == null || opacity == ""){
+			opacity = 1.0;
+		}
+		var points = new Array();
+
+		//lat, lng, lat, lng, lat, lng
+		var indexPos = pointsString.indexOf(",");
+		while (indexPos != -1){
+			var lat = parseFloat(pointsString.substring(0, indexPos));
+			pointsString = pointsString.substring(indexPos + 1);
+			indexPos = pointsString.indexOf(",");
+			var lng = "";
+			if (indexPos != -1){
+				lng = parseFloat(pointsString.substring(0, indexPos));
+				pointsString = pointsString.substring(indexPos + 1);
+			}
+			else{
+				lng = pointsString * 1.0;
+			}
+			var point = new GLatLng(lat, lng); 
+			points.push(point);
+			indexPos = pointsString.indexOf(",");
+		}
+
+		var polyline = new GPolyline(points, color, weight, opacity); 
+		this.setPeer(polyline);
+
+	} 
+	catch ( e ) {
+		alert(e);
+	}
 }

Modified: incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleLinesBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleLinesBridge.js?view=diff&rev=537648&r1=537647&r2=537648
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleLinesBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleLinesBridge.js Sun May 13 12:55:47 2007
@@ -17,70 +17,64 @@
  *
  */
  
-Xap.provide("xap.bridges.google.GoogleLinesBridge"); 
-// Auto-added---o.k.?
-Xap.require("xap.xml.dom.events.StructureChangeEvent");
-
-// Auto-added---o.k.?
-Xap.require("xap.taghandling.AbstractTagImpl");
-
-Xap.require("xap.bridges.google.GoogleBridge"); 
-
- /**
+/**
  * @fileoverview
- * 
- * A bridge class that controls a Google object peer.
+ * @author
+ *
+ * A bridge class that provides animations effects
  */
 
-/**
- * Creates a xap.bridges.google.GoogleLinesBridge.
- * 
- * 
- * @class xap.bridges.google.GoogleLinesBridge is the bridge between an XML element
- * representing a google object.
- * 
- * @constructor
- * 
- * @author bbuffone
+/*
+ * this library requires Google Maps to be loaded
+ *
  */
-xap.bridges.google.GoogleLinesBridge = function() {
-	xap.taghandling.AbstractTagImpl.call( this );
-}
 
-xap.bridges.google.GoogleLinesBridge.prototype = new xap.bridges.google.GoogleBridge;
+Xap.provide("xap.bridges.google.GoogleLinesBridge"); 
+Xap.require("xap.taghandling.AbstractTagImpl");
 
-xap.bridges.google.GoogleLinesBridge.s_log = xap.log.Logger.getLogger( "xap.bridges.google.GoogleLinesBridge" );
+/* Creates a xap.bridges.google.GoogleLinesBridge.
+   Constructor
+*/
+xap.bridges.google.GoogleLinesBridge= function() { 
+	xap.taghandling.AbstractTagImpl.call(this);
+}
+
+// Making the GoogleLinesBridge as a sub class of AbstractTagImpl
+Xap.setupClassAsSubclassOf(	"xap.bridges.google.GoogleLinesBridge",	"xap.taghandling.AbstractTagImpl" );
 
-xap.bridges.google.GoogleLinesBridge.prototype.toString = function() {
-	return "xap.bridges.google.GoogleLinesBridge";
+xap.bridges.google.GoogleLinesBridge.prototype.init = function() {
+	// call the base class init and then parse attributes and children
+	xap.taghandling.AbstractTagImpl.prototype.init.call(this);
+	this.parseInitialChildren(this.getElement());
 }
 
-xap.bridges.google.GoogleLinesBridge.prototype.createPeer = function() {
-	var parent = this.getElement().getParent();
-	var handler = this.getUiContentHandler().getHandlerForElement( parent );
-	var parentPeer = handler.getPeer();
-	
-	//just set the peer to be the google map.
-	if ( parentPeer instanceof GMap2 ) {         
-    	this.setPeer(parentPeer);
- 	} else {
-		xap.bridges.google.GoogleLinesBridge.s_log.error("Bogus parent peer:" + parentPeer );
-	}
+xap.bridges.google.GoogleLinesBridge.prototype.childAdded = function( e ){	
+	
+	// grab the child from the event
+	var childElement = e.getChange();
+	var childHandler = this.getUiContentHandler().getHandlerForElement( childElement );
+	
+	// save the map object to the child
+	childHandler._map = this._map;
+	
+	// check instance of and then handle them
+	if ( childHandler instanceof xap.bridges.google.GoogleLineBridge ) {
+
+		// call the GoogleMap API to add the line
+		this._map.addOverlay (childHandler.getPeer());		
+	}	
 }
 
-/**
- * Subclasses should override this method to handle dynamic removal of children.
- * Subclasses must either call super.onChildRemoved() or invoke
- * afterChildRemoved() directly.
- * @param e The xap.xml.dom.events.StructureChangeEvent
- */
-xap.bridges.google.GoogleLinesBridge.prototype.onChildRemoved = function( event ) {
+xap.bridges.google.GoogleLinesBridge.prototype.onChildRemoved = function( e ){	
+	
+	// grab the child from the event
+	var childElement = e.getChange();
+	var childHandler = this.getUiContentHandler().getHandlerForElement( childElement );
 	
-	if ( event.getType() == xap.xml.dom.events.StructureChangeEvent.ELEMENT_NODE ) {    
-	    //get the peer for the client and ask it to handle this.
-        var handler = this.getUiContentHandler().getHandlerForElement(event.getChange());
-        handler.handleRemoval(this.getElement().getParent(), this.getPeer());
-	}
+	// check instance of and then handle them
+	if ( childHandler instanceof xap.bridges.google.GoogleLineBridge ) {
+		this._map.removeOverlay (childHandler.getPeer());		
+	}	
 	
-	xap.bridges.google.GoogleBridge.prototype.onChildRemoved.call( this, event );
+	this.afterChildRemoved(e);
 }

Modified: incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleMarkerBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleMarkerBridge.js?view=diff&rev=537648&r1=537647&r2=537648
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleMarkerBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleMarkerBridge.js Sun May 13 12:55:47 2007
@@ -32,14 +32,16 @@
 Xap.provide("xap.bridges.google.GoogleMarkerBridge"); 
 Xap.require("xap.taghandling.AbstractTagImpl");
 
+/* Creates a xap.bridges.google.GoogleMarkerBridge.
+
+   Constructor
+   */
 xap.bridges.google.GoogleMarkerBridge= function() { 
 	xap.taghandling.AbstractTagImpl.call(this);
 }
 
-Xap.setupClassAsSubclassOf(
-	"xap.bridges.google.GoogleMarkerBridge",
-	"xap.taghandling.AbstractTagImpl"						
-);
+// Making the GoogleMarkerBridge as a sub class of AbstractTagImpl
+Xap.setupClassAsSubclassOf( "xap.bridges.google.GoogleMarkerBridge", "xap.taghandling.AbstractTagImpl" );
 
 xap.bridges.google.GoogleMarkerBridge.prototype.init = function() {
 	
@@ -52,8 +54,8 @@
 xap.bridges.google.GoogleMarkerBridge.prototype.createMarker = function() {
 
 	// retrieve the initial attributes
-	var lat = parseFloat(this.getElement().getAttribute("latitude"));
-	var lng = parseFloat(this.getElement().getAttribute("longitude"));
+	var lat = this.getElement().getAttribute("latitude");
+	var lng = this.getElement().getAttribute("longitude");
 	var icon = this.getElement().getAttribute("icon");	
 	var point = new GLatLng(lat, lng); 
 

Modified: incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleMarkersBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleMarkersBridge.js?view=diff&rev=537648&r1=537647&r2=537648
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleMarkersBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/google/GoogleMarkersBridge.js Sun May 13 12:55:47 2007
@@ -32,14 +32,16 @@
 Xap.provide("xap.bridges.google.GoogleMarkersBridge"); 
 Xap.require("xap.taghandling.AbstractTagImpl");
 
+/* Creates a xap.bridges.google.GoogleMarkersBridge.
+
+   Constructor
+*/
 xap.bridges.google.GoogleMarkersBridge= function() { 
 	xap.taghandling.AbstractTagImpl.call(this);
 }
 
-Xap.setupClassAsSubclassOf(
-	"xap.bridges.google.GoogleMarkersBridge",
-	"xap.taghandling.AbstractTagImpl"						
-);
+// Making the GoogleMarkersBridge as a sub class of AbstractTagImpl
+Xap.setupClassAsSubclassOf(	"xap.bridges.google.GoogleMarkersBridge", "xap.taghandling.AbstractTagImpl" );
 
 xap.bridges.google.GoogleMarkersBridge.prototype.init = function() {
 
@@ -59,11 +61,10 @@
 	
 	// check instance of and then handle them
 	if ( childHandler instanceof xap.bridges.google.GoogleMarkerBridge ) {
-		// call the GoogleMap API to add the marker
+		// call the GoogleMap API to add the Line
 		this._map.addOverlay (childHandler.getPeer());		
 	}	
 }
-
 
 xap.bridges.google.GoogleMarkersBridge.prototype.onChildRemoved = function( e ){