refs bug 377242 - updated widgets to the protocol and reduced javascript.
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google.demo/RAP Google Visualizations Demo.launch b/bundles/org.eclipse.rap.rwt.visualization.google.demo/RAP Google Visualizations Demo.launch
index c07d125..7f42a57 100644
--- a/bundles/org.eclipse.rap.rwt.visualization.google.demo/RAP Google Visualizations Demo.launch
+++ b/bundles/org.eclipse.rap.rwt.visualization.google.demo/RAP Google Visualizations Demo.launch
@@ -39,5 +39,5 @@
 <booleanAttribute key="tracing" value="false"/>
 <booleanAttribute key="useCustomFeatures" value="false"/>
 <booleanAttribute key="useDefaultConfigArea" value="true"/>
-<stringAttribute key="workspace_bundles" value="org.eclipse.rap.jface.databinding@default:default,org.eclipse.rap.jface@default:default,org.eclipse.rap.rwt.excanvas@default:default,org.eclipse.rap.rwt.osgi@default:default,org.eclipse.rap.rwt.visualization.google.demo@default:default,org.eclipse.rap.rwt.visualization.google@default:default,org.eclipse.rap.rwt@default:default,org.eclipse.rap.ui.workbench@default:default,org.eclipse.rap.ui@default:default,org.json@default:default"/>
+<stringAttribute key="workspace_bundles" value="org.eclipse.rap.jettycustomizer@default:default,org.eclipse.rap.jface.databinding@default:default,org.eclipse.rap.jface@default:default,org.eclipse.rap.rwt.excanvas@default:default,org.eclipse.rap.rwt.osgi@default:default,org.eclipse.rap.rwt.visualization.google.demo@default:default,org.eclipse.rap.rwt.visualization.google@default:default,org.eclipse.rap.rwt@default:default,org.eclipse.rap.ui.workbench@default:default,org.eclipse.rap.ui@default:default,org.json@default:default"/>
 </launchConfiguration>
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/plugin.xml b/bundles/org.eclipse.rap.rwt.visualization.google/plugin.xml
index d2d8318..6d93065 100644
--- a/bundles/org.eclipse.rap.rwt.visualization.google/plugin.xml
+++ b/bundles/org.eclipse.rap.rwt.visualization.google/plugin.xml
@@ -9,12 +9,10 @@
     <resource class="org.eclipse.rap.rwt.visualization.google.internal.CoreChartAPIResource"/>
     <resource class="org.eclipse.rap.rwt.visualization.google.internal.BaseChartResource"/>
     
-    <resource class="org.eclipse.rap.rwt.visualization.google.internal.motionchartkit.MotionChartAPIResource"/>
     <resource class="org.eclipse.rap.rwt.visualization.google.internal.motionchartkit.MotionChartResource"/>
     
     <resource class="org.eclipse.rap.rwt.visualization.google.internal.columnchartkit.ColumnChartResource"/>
     
-    <resource class="org.eclipse.rap.rwt.visualization.google.internal.tablekit.TableAPIResource"/>
     <resource class="org.eclipse.rap.rwt.visualization.google.internal.tablekit.TableResource"/>
     
     <resource class="org.eclipse.rap.rwt.visualization.google.internal.scatterchartkit.ScatterChartResource"/>
@@ -23,18 +21,14 @@
     
     <resource class="org.eclipse.rap.rwt.visualization.google.internal.piechartkit.PieChartResource"/>
     
-    <resource class="org.eclipse.rap.rwt.visualization.google.internal.annotatedtimelinekit.AnnotatedTimeLineAPIResource"/>
     <resource class="org.eclipse.rap.rwt.visualization.google.internal.annotatedtimelinekit.AnnotatedTimeLineResource"/>
     
     <resource class="org.eclipse.rap.rwt.visualization.google.internal.barchartkit.BarChartResource"/>
     
-    <resource class="org.eclipse.rap.rwt.visualization.google.internal.gaugekit.GaugeAPIResource"/>
     <resource class="org.eclipse.rap.rwt.visualization.google.internal.gaugekit.GaugeResource"/>
     
-    <resource class="org.eclipse.rap.rwt.visualization.google.internal.geomapkit.GeomapAPIResource"/>
     <resource class="org.eclipse.rap.rwt.visualization.google.internal.geomapkit.GeomapResource"/>
     
-    <resource class="org.eclipse.rap.rwt.visualization.google.internal.intensitymapkit.IntensityMapAPIResource"/>
     <resource class="org.eclipse.rap.rwt.visualization.google.internal.intensitymapkit.IntensityMapResource"/>
     
     <resource class="org.eclipse.rap.rwt.visualization.google.internal.areachartkit.AreaChartResource"/>
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/BaseChart.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/BaseChart.js
index 146fda9..c11edfb 100644
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/BaseChart.js
+++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/BaseChart.js
@@ -10,19 +10,63 @@
  *     Austin Riddle - improvements to widget hierarchy and data flow for 
  *                     consistency with SWT behavior.
  ******************************************************************************/
+//The reason this is still a qooxdoo widget is because google embeds the chart in an iframe. 
 qx.Class.define( "org.eclipse.rap.rwt.visualization.google.BaseChart", {
     type: "abstract",
     extend: qx.ui.layout.CanvasLayout,
     
-    construct: function( id ) {
+    statics : 
+    { 
+      registerAdapter : function(className, constructor) {
+    	  org.eclipse.rwt.protocol.AdapterRegistry.add( className, {
+
+    		  factory : function( properties ) {
+    		    var result = new constructor();
+    		    org.eclipse.rwt.protocol.AdapterUtil.addStatesForStyles( result, properties.style );
+    		    result.setUserData( "isControl", true );
+    		    org.eclipse.rwt.protocol.AdapterUtil.setParent( result, properties.parent );
+    		    return result;
+    		  },
+    		  
+    		  destructor : org.eclipse.rwt.protocol.AdapterUtil.getControlDestructor(),
+
+    		  properties : org.eclipse.rwt.protocol.AdapterUtil.extendControlProperties( [
+    		    "widgetData",
+    		    "widgetOptions",
+    		  ] ),
+
+    		  propertyHandler : org.eclipse.rwt.protocol.AdapterUtil.extendControlPropertyHandler( {} ),   
+
+    		  listeners : org.eclipse.rwt.protocol.AdapterUtil.extendControlListeners( [] ),
+
+    		  listenerHandler : org.eclipse.rwt.protocol.AdapterUtil.extendControlListenerHandler( {} ),
+
+    		  methods : [
+    		    "redraw"
+    		  ],
+    		  
+    		  methodHandler : {
+    		    "redraw" : function( widget, args ) {
+    		      widget.redraw();
+    		    }
+    		  }
+          } );
+      }
+    },
+    
+    construct: function() {
         this.base( arguments );
-        this.setHtmlAttribute( "id", id );
-        this._id = id;
         this._chart = null;
         this._dataTable = null;
         this._options = {};
     },
     
+    destruct : function() {
+    	if (this._chart != null) {
+    		this._chart.dispose();
+    	}
+    },
+    
     properties : {
         widgetData : {
             init : "",
@@ -69,19 +113,20 @@
           
         },
         
-        _initChart : function() {
+        initialize : function() {
         	var chart = this._chart; 
         	if (chart == null) {
 	    		this.info("Creating new chart instance.");
-	    		this._chart = this._createChart(document.getElementById(this._id));
+	    		this._chart = this._createChart(this._getTargetNode());
 	    		chart = this._chart;
 	            var qParent = this;
 	            google.visualization.events.addListener(chart, 'ready', function() {
 	            	qParent.inited = true;
 	            });
-	            var widgetId = this._id;
 	            var dataTable = qParent._dataTable;
 	            google.visualization.events.addListener(chart, 'select', function() {
+	            	var wm = org.eclipse.swt.WidgetManager.getInstance();
+	                var widgetId = wm.findIdByWidget(qParent);
 	            	qParent.info(widgetId+" - Sending selection event");
 	            	var selArray = chart.getSelection();
 	            	var selObj = selArray[0];
@@ -133,7 +178,7 @@
         
         redraw : function () {
         	try {
-	        	this._initChart();
+        		this.initialize();
 	        	this.info("Attempting to redraw: "+this._dataTable+", "+this._options);
 	        	if (this._chart && this._dataTable && this._options) {
 	        		this.info("Drawing: "+this._options);
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/VisualizationWidgetLCA.java b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/VisualizationWidgetLCA.java
index 5b9d027..b0052d3 100644
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/VisualizationWidgetLCA.java
+++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/VisualizationWidgetLCA.java
@@ -15,6 +15,8 @@
 import java.io.IOException;
 
 import org.eclipse.rap.rwt.visualization.google.VisualizationWidget;
+import org.eclipse.rwt.internal.protocol.ClientObjectFactory;
+import org.eclipse.rwt.internal.protocol.IClientObject;
 import org.eclipse.rwt.lifecycle.AbstractWidgetLCA;
 import org.eclipse.rwt.lifecycle.ControlLCAUtil;
 import org.eclipse.rwt.lifecycle.IWidgetAdapter;
@@ -40,55 +42,55 @@
   protected static final String REDRAW_FUNC = "redraw";
   protected static final String PROP_DATA = "widgetData";
   protected static final String PROP_OPTIONS = "widgetOptions";
-
+  
+  private static final String[] ALLOWED_STYLES = new String[] { "BORDER" };
+  
   public abstract Class getWidgetType();
   
   public void renderInitialization( final Widget widget ) throws IOException {
-     JSWriter writer = JSWriter.getWriterFor( widget );
-     String id = WidgetUtil.getId( widget );
-     writer.newWidget( getWidgetType().getName(), new Object[]{
-       id
-     } );
-     writer.set( "appearance", "composite" );
-     writer.set( "overflow", "hidden" );
-     ControlLCAUtil.writeStyleFlags( ( Control ) widget );
+    Control control = (Control)widget;
+    IClientObject clientObject = ClientObjectFactory.getClientObject( control );
+    clientObject.create( getWidgetType().getCanonicalName() );
+//    clientObject.set( "id", WidgetUtil.getId( control ) );
+    clientObject.set( "parent", WidgetUtil.getId( control.getParent() ) );
+    clientObject.set( "style", WidgetLCAUtil.getStyles( control, ALLOWED_STYLES ) );
    }
   
   public void preserveValues( final Widget widget ) {
+    ControlLCAUtil.preserveValues( (Control)widget );
+    WidgetLCAUtil.preserveCustomVariant( widget );
     ControlLCAUtil.preserveValues( ( Control )widget );
     IWidgetAdapter adapter = WidgetUtil.getAdapter( widget );
     adapter.preserve( PROP_OPTIONS, ( ( VisualizationWidget )widget ).getWidgetOptions() );
     adapter.preserve( PROP_DATA, ( ( VisualizationWidget )widget ).getWidgetData() );
-    // only needed for custom variants (theming)
-//    WidgetLCAUtil.preserveCustomVariant( widget );
   }
 
   public void renderChanges( final Widget widget ) throws IOException {
+    ControlLCAUtil.renderChanges( ( Control )widget );
+    WidgetLCAUtil.renderCustomVariant( widget );
+    
     VisualizationWidget vWidget = ( VisualizationWidget )widget;
-    ControlLCAUtil.writeChanges( vWidget );
-    JSWriter writer = JSWriter.getWriterFor( vWidget );
-    writer.set( PROP_OPTIONS, PROP_OPTIONS, vWidget.getWidgetOptions() );
-    writer.set( PROP_DATA, PROP_DATA, vWidget.getWidgetData() );
+    IClientObject clientObject = ClientObjectFactory.getClientObject( vWidget );
+    IWidgetAdapter adapter = WidgetUtil.getAdapter(widget);
+    boolean changed = !adapter.isInitialized() || WidgetLCAUtil.hasChanged(widget, PROP_OPTIONS, vWidget.getWidgetOptions());
+    if (changed) {
+      clientObject.set(PROP_OPTIONS, vWidget.getWidgetOptions());
+    }
+    changed = WidgetLCAUtil.hasChanged(widget, PROP_DATA, vWidget.getWidgetData());
+    if (changed) {
+      clientObject.set(PROP_DATA, vWidget.getWidgetData());
+    }
+    
     if (vWidget.isDirty()) {
-      writer.call( REDRAW_FUNC, null );
+      clientObject.call(REDRAW_FUNC, null);
       vWidget.setDirty(false);
     }
   }
 
   public void renderDispose( final Widget widget ) throws IOException {
-    JSWriter writer = JSWriter.getWriterFor( widget );
-    writer.dispose();
+    ClientObjectFactory.getClientObject( widget ).destroy();
   }
 
-  public void createResetHandlerCalls( String typePoolId ) throws IOException {
-     //preserved empty here for pre RAP 1.3 compatibility
-  }
-
-  public String getTypePoolId( Widget widget ) {
-   //preserved empty here for pre RAP 1.3 compatibility
-    return null;
-  }
-  
   /**
    * Respond to selection events, set the value of selectedItem on the widget Java object,
    * and broadcast a SWT.Selection event to any listeners  
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/annotatedtimelinekit/AnnotatedTimeLine.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/annotatedtimelinekit/AnnotatedTimeLine.js
index 80f9926..3e45bea 100644
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/annotatedtimelinekit/AnnotatedTimeLine.js
+++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/annotatedtimelinekit/AnnotatedTimeLine.js
@@ -10,145 +10,32 @@
  *     Austin Riddle - improvements to widget hierarchy and data flow for 
  *                     consistency with SWT behavior.
  ******************************************************************************/
+try {
+	google.load("visualization", "1", {packages:["annotatedtimeline"]});
+}
+catch (e) {
+	var mesg = "Error loading Google Annotated Timeline API: "+e;
+	if (console) {
+		console.log(mesg);
+	}
+	else {
+		alert(mesg);
+	}
+}
+
 qx.Class.define( "org.eclipse.rap.rwt.visualization.google.AnnotatedTimeLine", {
-    extend: qx.ui.layout.CanvasLayout,
-    
-    construct: function( id ) {
-        this.base( arguments );
-        this.setHtmlAttribute( "id", id );
-        this._id = id;
-        this._chart = null;
-        this._dataTable = null;
-        this._options = {};
-    },
-    
-    properties : {
-        widgetData : {
-            init : "",
-            apply : "refreshWidgetData"
-        },
-        widgetOptions : {
-            init : "",
-            apply : "refreshWidgetOptions"
-        },
-        selectedItem : {
-        	init : "",
-            apply : ""
-        },
-        selectedRow : {
-        	init : "",
-            apply : ""
-        },
-        selectedColumn : {
-        	init : "",
-            apply : ""
-        },
-        selectedValue : {
-        	init : "",
-            apply : ""
-        }
-    },
+extend: org.eclipse.rap.rwt.visualization.google.BaseChart,
     
     members : {
-        _doActivate : function() {
-            var shell = null;
-            var parent = this.getParent();
-            while( shell == null && parent != null ) {
-                if( parent.classname == "org.eclipse.swt.widgets.Shell" ) {
-                    shell = parent;
-                }
-                parent = parent.getParent();
-            }
-            if( shell != null ) {
-                shell.setActiveChild( this );
-            }
-        },
+      
+      _createChart : function(domElement) {
+        return new google.visualization.AnnotatedTimeLine(domElement);
+      }
         
-        _initChart : function() {
-        	var chart = this._chart; 
-        	if (chart == null) {
-	    		this.info("Creating new timeline instance.");
-	    		this._chart = new google.visualization.AnnotatedTimeLine(document.getElementById(this._id));
-	    		chart = this._chart;
-	            var qParent = this;
-	            google.visualization.events.addListener(chart, 'ready', function() {
-	            	qParent.inited = true;
-	            });
-	            var widgetId = this._id;
-	            var dataTable = qParent._dataTable;
-	            google.visualization.events.addListener(chart, 'select', function() {
-	            	qParent.info(widgetId+" - Sending selection event");
-	            	var selArray = chart.getSelection();
-	            	var selObj = selArray[0];
-	            	var selection = dataTable.getValue(selObj.row, 0) + "," + dataTable.getColumnId(selObj.column) + "," + dataTable.getValue(selObj.row, selObj.column);
-	            	this.selectedItem = selection;
-	            	this.selectedRow = dataTable.getValue(selObj.row, 0);
-	            	this.selectedColumn = dataTable.getColumnId(selObj.column);
-	            	this.selectedValue = dataTable.getValue(selObj.row, selObj.column);
-
-	            	//fire selection event
-	            	var req = org.eclipse.swt.Request.getInstance();
-	            	req.addParameter(widgetId + ".selectedItem", this.selectedItem);
-	            	req.addParameter(widgetId + ".selectedRow", this.selectedRow);
-	            	req.addParameter(widgetId + ".selectedColumn", this.selectedColumn);
-	            	req.addParameter(widgetId + ".selectedValue", this.selectedValue);
-	            	req.addEvent( "org.eclipse.swt.events.widgetSelected", widgetId );
-	            	req.send();
-		        });
-	            
-	            this.info("Created new timeline instance.");
-        	}
-        },
-        
-        refreshWidgetData : function() {
-        	try {
-	        	var data = eval('(' + this.getWidgetData() + ')');
-	            this._dataTable = new google.visualization.DataTable(data);
-	            this.info("Setting data set to : "+this._dataTable);
-        	}
-        	catch (err) {
-        		this.info("Attempted to set data but failed.");
-        		this.info(err);
-        	}
-        },
-        
-        refreshWidgetOptions : function() {
-        	try {
-	        	qx.ui.core.Widget.flushGlobalQueues();
-	        	var opString = this.getWidgetOptions();
-	        	opString = opString.replace(new RegExp("~","g"), "\"");
-	        	var evalStr = "({" + opString;
-	        	evalStr = evalStr + "})";
-	        	this._options = eval(evalStr);
-        	}
-        	catch (err) {
-        		this.info(err);
-        	}
-        },
-        
-        redraw : function () {
-        	try {
-	        	this._initChart();
-	        	this.info("Attempting to redraw: "+this._dataTable+", "+this._options);
-	        	if (this._chart && this._dataTable && this._options) {
-	        		this.info("Drawing: "+this._options);
-	        		this._chart.draw(this._dataTable, this._options);
-	        	}
-        	}
-        	catch (err) {
-        		this.info(err);
-        	}
-        },
-
-        _sendResponse : function(widget, field, value) {
-			//if (!org.eclipse.swt.EventUtil.getSuspended()) {
-				var wm = org.eclipse.swt.WidgetManager.getInstance();
-				var canvasId = wm.findIdByWidget(widget);
-				var req = org.eclipse.swt.Request.getInstance();
-				req.addParameter(canvasId + "." + field, value);
-				req.send();
-			//}
-		}
     }
     
-} );
\ No newline at end of file
+} );
+
+org.eclipse.rap.rwt.visualization.google.BaseChart.registerAdapter(
+		"org.eclipse.rap.rwt.visualization.google.AnnotatedTimeLine",
+		org.eclipse.rap.rwt.visualization.google.AnnotatedTimeLine);
\ No newline at end of file
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/annotatedtimelinekit/AnnotatedTimeLineAPI.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/annotatedtimelinekit/AnnotatedTimeLineAPI.js
deleted file mode 100644
index 81b93b9..0000000
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/annotatedtimelinekit/AnnotatedTimeLineAPI.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009-2010 David Donahue and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     David Donahue - initial API, implementation and documentation
- *     Austin Riddle (Texas Center for Applied Technology) - 
- *        added fault tolerance for offline situations
- ******************************************************************************/
-try {
-	google.load("visualization", "1", {packages:["annotatedtimeline"]});
-}
-catch (e) {
-	var mesg = "Error loading Google Annotated Timeline API: "+e;
-	if (console) {
-		console.log(mesg);
-	}
-	else {
-		alert(mesg);
-	}
-}
-
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/annotatedtimelinekit/AnnotatedTimeLineAPIResource.java b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/annotatedtimelinekit/AnnotatedTimeLineAPIResource.java
deleted file mode 100644
index 9935321..0000000
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/annotatedtimelinekit/AnnotatedTimeLineAPIResource.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009-2010 David Donahue.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     David Donahue - initial API, implementation and documentation
- ******************************************************************************/
-package org.eclipse.rap.rwt.visualization.google.internal.annotatedtimelinekit;
-
-import org.eclipse.rap.rwt.visualization.google.internal.GoogleVisualizationResource;
-
-public class AnnotatedTimeLineAPIResource extends GoogleVisualizationResource {
-
-  public String getLocation() {
-    return "org/eclipse/rap/rwt/visualization/google/internal/annotatedtimelinekit/AnnotatedTimeLineAPI.js";
-  }
-  
-}
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/areachartkit/AreaChart.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/areachartkit/AreaChart.js
index 23793ce..bdafbed 100644
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/areachartkit/AreaChart.js
+++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/areachartkit/AreaChart.js
@@ -21,4 +21,8 @@
         
     }
     
-} );
\ No newline at end of file
+} );
+
+org.eclipse.rap.rwt.visualization.google.BaseChart.registerAdapter(
+		"org.eclipse.rap.rwt.visualization.google.AreaChart",
+		org.eclipse.rap.rwt.visualization.google.AreaChart);
\ No newline at end of file
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/barchartkit/BarChart.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/barchartkit/BarChart.js
index 6b310fb..af5e041 100644
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/barchartkit/BarChart.js
+++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/barchartkit/BarChart.js
@@ -21,4 +21,8 @@
         
     }
     
-} );
\ No newline at end of file
+} );
+
+org.eclipse.rap.rwt.visualization.google.BaseChart.registerAdapter(
+		"org.eclipse.rap.rwt.visualization.google.BarChart",
+		org.eclipse.rap.rwt.visualization.google.BarChart);
\ No newline at end of file
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/columnchartkit/ColumnChart.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/columnchartkit/ColumnChart.js
index 0a35641..b4a67eb 100644
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/columnchartkit/ColumnChart.js
+++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/columnchartkit/ColumnChart.js
@@ -21,4 +21,8 @@
         
     }
     
-} );
\ No newline at end of file
+} );
+
+org.eclipse.rap.rwt.visualization.google.BaseChart.registerAdapter(
+		"org.eclipse.rap.rwt.visualization.google.ColumnChart",
+		org.eclipse.rap.rwt.visualization.google.ColumnChart);
\ No newline at end of file
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/gaugekit/Gauge.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/gaugekit/Gauge.js
index 7ba0437..fd00f4c 100644
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/gaugekit/Gauge.js
+++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/gaugekit/Gauge.js
@@ -10,141 +10,32 @@
  *     Austin Riddle - improvements to widget hierarchy and data flow for 
  *                     consistency with SWT behavior.
  ******************************************************************************/
+try {
+	google.load('visualization', '1', {'packages':['gauge']});
+}
+catch (e) {
+	var mesg = "Error loading Google Gauge API: "+e;
+	if (console) {
+		console.log(mesg);
+	}
+	else {
+		alert(mesg);
+	}
+}
+
 qx.Class.define( "org.eclipse.rap.rwt.visualization.google.Gauge", {
-    extend: qx.ui.layout.CanvasLayout,
-    
-    construct: function( id ) {
-        this.base( arguments );
-        this.setHtmlAttribute( "id", id );
-        this._id = id;
-        this._chart = null;
-        this._dataTable = null;
-        this._options = {};
-    },
-    
-    properties : {
-        widgetData : {
-            init : "",
-            apply : "refreshWidgetData"
-        },
-        widgetOptions : {
-            init : "",
-            apply : "refreshWidgetOptions"
-        },
-        selectedRow : {
-        	init : "",
-            apply : ""
-        },
-        selectedColumn : {
-        	init : "",
-            apply : ""
-        },
-        selectedValue : {
-        	init : "",
-            apply : ""
-        }
-    },
+    extend: org.eclipse.rap.rwt.visualization.google.BaseChart,
     
     members : {
-        _doActivate : function() {
-            var shell = null;
-            var parent = this.getParent();
-            while( shell == null && parent != null ) {
-                if( parent.classname == "org.eclipse.swt.widgets.Shell" ) {
-                    shell = parent;
-                }
-                parent = parent.getParent();
-            }
-            if( shell != null ) {
-                shell.setActiveChild( this );
-            }
-        },
+      
+      _createChart : function(domElement) {
+        return new google.visualization.Gauge(domElement);
+      }
         
-        _initChart : function() {
-        	var chart = this._chart; 
-        	if (chart == null) {
-	    		this.info("Creating new gauge instance.");
-	    		this._chart = new google.visualization.Gauge(document.getElementById(this._id));
-	    		chart = this._chart;
-	            var qParent = this;
-	            google.visualization.events.addListener(chart, 'ready', function() {
-	            	qParent.inited = true;
-	            });
-	            var widgetId = this._id;
-	            var dataTable = qParent._dataTable;
-	            google.visualization.events.addListener(chart, 'select', function() {
-	            	qParent.info(widgetId+" - Sending selection event");
-	            	var selArray = chart.getSelection();
-	            	var selObj = selArray[0];
-	            	var selection = dataTable.getValue(selObj.row, 0) + "," + dataTable.getColumnId(selObj.column) + "," + dataTable.getValue(selObj.row, selObj.column);
-	            	this.selectedItem = selection;
-	            	this.selectedRow = dataTable.getValue(selObj.row, 0);
-	            	this.selectedColumn = dataTable.getColumnId(selObj.column);
-	            	this.selectedValue = dataTable.getValue(selObj.row, selObj.column);
-                    
-	            	//fire selection event
-	            	var req = org.eclipse.swt.Request.getInstance();
-	            	req.addParameter(widgetId + ".selectedItem", this.selectedItem);
-	            	req.addParameter(widgetId + ".selectedRow", this.selectedRow);
-	            	req.addParameter(widgetId + ".selectedColumn", this.selectedColumn);
-	            	req.addParameter(widgetId + ".selectedValue", this.selectedValue);
-	            	req.addEvent( "org.eclipse.swt.events.widgetSelected", widgetId );
-	            	req.send();
-		        });
-	            
-	            this.info("Created new gauge instance.");
-        	}
-        },
-        
-        refreshWidgetData : function() {
-        	try {
-	        	var data = eval('(' + this.getWidgetData() + ')');
-	            this._dataTable = new google.visualization.DataTable(data);
-	            this.info("Setting data set to : "+this._dataTable);
-        	}
-        	catch (err) {
-        		this.info("Attempted to set data but failed.");
-        		this.info(err);
-        	}
-        },
-        
-        refreshWidgetOptions : function() {
-        	try {
-	        	qx.ui.core.Widget.flushGlobalQueues();
-	        	var opString = this.getWidgetOptions();
-	        	opString = opString.replace(new RegExp("~","g"), "\"");
-	        	var evalStr = "({" + opString;
-	        	evalStr = evalStr + "})";
-	        	this._options = eval(evalStr);
-        	}
-        	catch (err) {
-        		this.info(err);
-        	}
-        },
-        
-        redraw : function () {
-        	try {
-	        	this._initChart();
-	        	this.info("Attempting to redraw: "+this._dataTable+", "+this._options);
-	        	if (this._chart && this._dataTable && this._options) {
-	        		this.info("Drawing: "+this._options);
-	        		this._chart.draw(this._dataTable, this._options);
-	        	}
-        	}
-        	catch (err) {
-        		this.info(err);
-        	}
-        },
-
-        _sendResponse : function(widget, field, value) {
-			//if (!org.eclipse.swt.EventUtil.getSuspended()) {
-				var wm = org.eclipse.swt.WidgetManager.getInstance();
-				var canvasId = wm.findIdByWidget(widget);
-				var req = org.eclipse.swt.Request.getInstance();
-				req.addParameter(canvasId + "." + field, value);
-				req.send();
-			//}
-		}
     }
     
-} );
\ No newline at end of file
+} );
+
+org.eclipse.rap.rwt.visualization.google.BaseChart.registerAdapter(
+		"org.eclipse.rap.rwt.visualization.google.Gauge",
+		org.eclipse.rap.rwt.visualization.google.Gauge);
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/gaugekit/GaugeAPI.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/gaugekit/GaugeAPI.js
deleted file mode 100644
index f576ba4..0000000
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/gaugekit/GaugeAPI.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009-2010 David Donahue and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     David Donahue - initial API, implementation and documentation
- *     Austin Riddle (Texas Center for Applied Technology) - 
- *        added fault tolerance for offline situations
- ******************************************************************************/
-try {
-	google.load('visualization', '1', {'packages':['gauge']});
-}
-catch (e) {
-	var mesg = "Error loading Google Gauge API: "+e;
-	if (console) {
-		console.log(mesg);
-	}
-	else {
-		alert(mesg);
-	}
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/gaugekit/GaugeAPIResource.java b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/gaugekit/GaugeAPIResource.java
deleted file mode 100644
index 46e89db..0000000
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/gaugekit/GaugeAPIResource.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009-2010 David Donahue.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     David Donahue - initial API, implementation and documentation
- ******************************************************************************/
-package org.eclipse.rap.rwt.visualization.google.internal.gaugekit;
-
-import org.eclipse.rap.rwt.visualization.google.internal.GoogleVisualizationResource;
-
-public class GaugeAPIResource extends GoogleVisualizationResource {
-
-  public String getLocation() {
-    return "org/eclipse/rap/rwt/visualization/google/internal/gaugekit/GaugeAPI.js";
-  }
-  
-}
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/geomapkit/Geomap.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/geomapkit/Geomap.js
index 2595c11..56cea9a 100644
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/geomapkit/Geomap.js
+++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/geomapkit/Geomap.js
@@ -10,18 +10,35 @@
  *     Austin Riddle - improvements to widget hierarchy and data flow for 
  *                     consistency with SWT behavior.
  ******************************************************************************/
+try {
+	google.load('visualization', '1', {'packages':['geomap']});
+}
+catch (e) {
+	var mesg = "Error loading Google Geomap API: "+e;
+	if (console) {
+		console.log(mesg);
+	}
+	else {
+		alert(mesg);
+	}
+}
+
 qx.Class.define( "org.eclipse.rap.rwt.visualization.google.Geomap", {
     extend: qx.ui.layout.CanvasLayout,
     
-    construct: function( id ) {
+    construct: function() {
         this.base( arguments );
-        this.setHtmlAttribute( "id", id );
-        this._id = id;
         this._chart = null;
         this._dataTable = null;
         this._options = {};
     },
     
+    destruct : function() {
+    	if (this._chart != null) {
+    		this._chart.dispose();
+    	}
+    },
+    
     properties : {
         widgetData : {
             init : "",
@@ -60,19 +77,20 @@
             }
         },
         
-        _initChart : function() {
+        initialize : function() {
         	var chart = this._chart; 
         	if (chart == null) {
 	    		this.info("Creating new geomap instance.");
-	    		this._chart = new google.visualization.GeoMap(document.getElementById(this._id));
+	    		this._chart = new google.visualization.GeoMap(this._getTargetNode());
 	    		chart = this._chart;
 	            var qParent = this;
 	            google.visualization.events.addListener(chart, 'ready', function() {
 	            	qParent.inited = true;
 	            });
-	            var widgetId = this._id;
 	            var dataTable = qParent._dataTable;
 	            google.visualization.events.addListener(chart, 'regionClick', function(clickedObj) {
+  	                var wm = org.eclipse.swt.WidgetManager.getInstance();
+	                var widgetId = wm.findIdByWidget(qParent);
 	            	var selObj = chart.getSelection();
 //	            	var selection = selObj.region;
 	            	var selection = clickedObj.region;
@@ -117,7 +135,7 @@
         
         redraw : function () {
         	try {
-	        	this._initChart();
+        		this.initialize();
 	        	this.info("Attempting to redraw: "+this._dataTable+", "+this._options);
 	        	if (this._chart && this._dataTable && this._options) {
 	        		this.info("Drawing: "+this._options);
@@ -140,4 +158,8 @@
 		}
     }
     
-} );
\ No newline at end of file
+} );
+
+org.eclipse.rap.rwt.visualization.google.BaseChart.registerAdapter(
+		"org.eclipse.rap.rwt.visualization.google.Geomap",
+		org.eclipse.rap.rwt.visualization.google.Geomap);
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/geomapkit/GeomapAPI.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/geomapkit/GeomapAPI.js
deleted file mode 100644
index e92c1f7..0000000
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/geomapkit/GeomapAPI.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009-2010 David Donahue and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     David Donahue - initial API, implementation and documentation
- *     Austin Riddle (Texas Center for Applied Technology) - 
- *        added fault tolerance for offline situations
- ******************************************************************************/
-try {
-	google.load('visualization', '1', {'packages':['geomap']});
-}
-catch (e) {
-	var mesg = "Error loading Google Geomap API: "+e;
-	if (console) {
-		console.log(mesg);
-	}
-	else {
-		alert(mesg);
-	}
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/geomapkit/GeomapAPIResource.java b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/geomapkit/GeomapAPIResource.java
deleted file mode 100644
index 808b44c..0000000
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/geomapkit/GeomapAPIResource.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009-2010 David Donahue.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     David Donahue - initial API, implementation and documentation
- ******************************************************************************/
-package org.eclipse.rap.rwt.visualization.google.internal.geomapkit;
-
-import org.eclipse.rap.rwt.visualization.google.internal.GoogleVisualizationResource;
-
-public class GeomapAPIResource extends GoogleVisualizationResource {
-
-  public String getLocation() {
-    return "org/eclipse/rap/rwt/visualization/google/internal/geomapkit/GeomapAPI.js";
-  }
-  
-}
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/intensitymapkit/IntensityMap.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/intensitymapkit/IntensityMap.js
index 43da9e8..8a4b40d 100644
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/intensitymapkit/IntensityMap.js
+++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/intensitymapkit/IntensityMap.js
@@ -10,179 +10,33 @@
  *     Austin Riddle - improvements to widget hierarchy and data flow for 
  *                     consistency with SWT behavior.
  ******************************************************************************/
+try {
+	google.load('visualization', '1', {'packages':['intensitymap']});
+}
+catch (e) {
+	var mesg = "Error loading Google Intensity Map API: "+e;
+	if (console) {
+		console.log(mesg);
+	}
+	else {
+		alert(mesg);
+	}
+}
+
 qx.Class.define( "org.eclipse.rap.rwt.visualization.google.IntensityMap", {
-    extend: qx.ui.layout.CanvasLayout,
-    
-    construct: function( id ) {
-        this.base( arguments );
-        this.setHtmlAttribute( "id", id );
-        this._id = id;
-        this._chart = null;
-        this._dataTable = null;
-        this._options = {};
-    },
-    
-    properties : {
-        widgetData : {
-            init : "",
-            apply : "refreshWidgetData"
-        },
-        widgetOptions : {
-            init : "",
-            apply : "refreshWidgetOptions"
-        },
-        selectedRow : {
-        	init : "",
-            apply : ""
-        },
-        selectedColumn : {
-        	init : "",
-            apply : ""
-        },
-        selectedValue : {
-        	init : "",
-            apply : ""
-        }
-    },
+    extend: org.eclipse.rap.rwt.visualization.google.BaseChart,
     
     members : {
-        _doActivate : function() {
-            var shell = null;
-            var parent = this.getParent();
-            while( shell == null && parent != null ) {
-                if( parent.classname == "org.eclipse.swt.widgets.Shell" ) {
-                    shell = parent;
-                }
-                parent = parent.getParent();
-            }
-            if( shell != null ) {
-                shell.setActiveChild( this );
-            }
-        },
+      
+      _createChart : function(domElement) {
+        return new google.visualization.IntensityMap(domElement);
+      }
         
-        load : function() {
-	    	qx.ui.core.Widget.flushGlobalQueues();
-	    	var data = eval('(' + this.getWidgetData() + ')');
-	        if( this._chart == null ) {
-	            this._chart = new google.visualization.IntensityMap(document.getElementById(this._id));
-
-	        }
-	        var dataTable  = new google.visualization.DataTable(data);
-	        
-	        var chart = this._chart;
-	        var options = {};
-            if (this.getWidgetOptions()) {
-            	options = eval('(' + this.getWidgetOptions() + ')');
-            }
-	        chart.draw(dataTable, options);
-	        
-            var widgetId = this._id;
-            google.visualization.events.addListener(chart, 'select', function() {
-            	var selArray = chart.getSelection();
-            	var selObj = selArray[0];
-            	var selection = dataTable.getValue(selObj.row, 0) + "," + dataTable.getColumnId(selObj.column) + "," + dataTable.getValue(selObj.row, selObj.column);
-            	this.selectedItem = selection;
-            	this.selectedRow = dataTable.getValue(selObj.row, 0);
-            	this.selectedColumn = dataTable.getColumnId(selObj.column);
-            	this.selectedValue = dataTable.getValue(selObj.row, selObj.column);
-
-            	//fire selection event
-            	var req = org.eclipse.swt.Request.getInstance();
-            	req.addParameter(widgetId + ".selectedItem", this.selectedItem);
-            	req.addParameter(widgetId + ".selectedRow", this.selectedRow);
-            	req.addParameter(widgetId + ".selectedColumn", this.selectedColumn);
-            	req.addParameter(widgetId + ".selectedValue", this.selectedValue);
-            	req.addEvent( "org.eclipse.swt.events.widgetSelected", widgetId );
-            	req.send();
-	        });
-	        
-        },
-        
-        _initChart : function() {
-        	var chart = this._chart; 
-        	if (chart == null) {
-	    		this.info("Creating new intensity map instance.");
-	    		this._chart = new google.visualization.IntensityMap(document.getElementById(this._id));
-	    		chart = this._chart;
-	            var qParent = this;
-	            google.visualization.events.addListener(chart, 'ready', function() {
-	            	qParent.inited = true;
-	            });
-	            var widgetId = this._id;
-	            var dataTable = qParent._dataTable;
-	            google.visualization.events.addListener(chart, 'select', function() {
-	            	qParent.info(widgetId+" - Sending selection event");
-	            	var selArray = chart.getSelection();
-	            	var selObj = selArray[0];
-	            	var selection = dataTable.getValue(selObj.row, 0) + "," + dataTable.getColumnId(selObj.column) + "," + dataTable.getValue(selObj.row, selObj.column);
-	            	this.selectedItem = selection;
-	            	this.selectedRow = dataTable.getValue(selObj.row, 0);
-	            	this.selectedColumn = dataTable.getColumnId(selObj.column);
-	            	this.selectedValue = dataTable.getValue(selObj.row, selObj.column);
-                    
-	            	//fire selection event
-	            	var req = org.eclipse.swt.Request.getInstance();
-	            	req.addParameter(widgetId + ".selectedItem", this.selectedItem);
-	            	req.addParameter(widgetId + ".selectedRow", this.selectedRow);
-	            	req.addParameter(widgetId + ".selectedColumn", this.selectedColumn);
-	            	req.addParameter(widgetId + ".selectedValue", this.selectedValue);
-	            	req.addEvent( "org.eclipse.swt.events.widgetSelected", widgetId );
-	            	req.send();
-		        });
-	            
-	            this.info("Created new intensity map instance.");
-        	}
-        },
-        
-        refreshWidgetData : function() {
-        	try {
-	        	var data = eval('(' + this.getWidgetData() + ')');
-	            this._dataTable = new google.visualization.DataTable(data);
-	            this.info("Setting data set to : "+this._dataTable);
-        	}
-        	catch (err) {
-        		this.info("Attempted to set data but failed.");
-        		this.info(err);
-        	}
-        },
-        
-        refreshWidgetOptions : function() {
-        	try {
-	        	qx.ui.core.Widget.flushGlobalQueues();
-	        	var opString = this.getWidgetOptions();
-	        	opString = opString.replace(new RegExp("~","g"), "\"");
-	        	var evalStr = "({" + opString;
-	        	evalStr = evalStr + "})";
-	        	this._options = eval(evalStr);
-        	}
-        	catch (err) {
-        		this.info(err);
-        	}
-        },
-        
-        redraw : function () {
-        	try {
-	        	this._initChart();
-	        	this.info("Attempting to redraw: "+this._dataTable+", "+this._options);
-	        	if (this._chart && this._dataTable && this._options) {
-	        		this.info("Drawing: "+this._options);
-	        		this._chart.draw(this._dataTable, this._options);
-	        	}
-        	}
-        	catch (err) {
-        		this.info(err);
-        	}
-        },
-
-        _sendResponse : function(widget, field, value) {
-			//if (!org.eclipse.swt.EventUtil.getSuspended()) {
-				var wm = org.eclipse.swt.WidgetManager.getInstance();
-				var canvasId = wm.findIdByWidget(widget);
-				var req = org.eclipse.swt.Request.getInstance();
-				req.addParameter(canvasId + "." + field, value);
-				req.send();
-			//}
-		}
     }
     
-} );
\ No newline at end of file
+} );
+
+
+org.eclipse.rap.rwt.visualization.google.BaseChart.registerAdapter(
+		"org.eclipse.rap.rwt.visualization.google.IntensityMap",
+		org.eclipse.rap.rwt.visualization.google.IntensityMap);
\ No newline at end of file
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/intensitymapkit/IntensityMapAPI.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/intensitymapkit/IntensityMapAPI.js
deleted file mode 100644
index 2afcae5..0000000
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/intensitymapkit/IntensityMapAPI.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009-2010 David Donahue and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     David Donahue - initial API, implementation and documentation
- *     Austin Riddle (Texas Center for Applied Technology) - 
- *        added fault tolerance for offline situations
- ******************************************************************************/
-try {
-	google.load('visualization', '1', {'packages':['intensitymap']});
-}
-catch (e) {
-	var mesg = "Error loading Google Intensity Map API: "+e;
-	if (console) {
-		console.log(mesg);
-	}
-	else {
-		alert(mesg);
-	}
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/intensitymapkit/IntensityMapAPIResource.java b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/intensitymapkit/IntensityMapAPIResource.java
deleted file mode 100644
index cfcb72d..0000000
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/intensitymapkit/IntensityMapAPIResource.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009-2010 David Donahue.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     David Donahue - initial API, implementation and documentation
- ******************************************************************************/
-package org.eclipse.rap.rwt.visualization.google.internal.intensitymapkit;
-
-import org.eclipse.rap.rwt.visualization.google.internal.GoogleVisualizationResource;
-
-public class IntensityMapAPIResource extends GoogleVisualizationResource {
-
-  public String getLocation() {
-    return "org/eclipse/rap/rwt/visualization/google/internal/intensitymapkit/IntensityMapAPI.js";
-  }
-  
-}
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/linechartkit/LineChart.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/linechartkit/LineChart.js
index 2e59198..980039a 100644
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/linechartkit/LineChart.js
+++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/linechartkit/LineChart.js
@@ -21,4 +21,8 @@
         
     }
     
-} );
\ No newline at end of file
+} );
+
+org.eclipse.rap.rwt.visualization.google.BaseChart.registerAdapter(
+		"org.eclipse.rap.rwt.visualization.google.LineChart",
+		org.eclipse.rap.rwt.visualization.google.LineChart);
\ No newline at end of file
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/motionchartkit/MotionChart.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/motionchartkit/MotionChart.js
index 7f83b3c..e476683 100644
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/motionchartkit/MotionChart.js
+++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/motionchartkit/MotionChart.js
@@ -10,18 +10,35 @@
  *     Austin Riddle - improvements to widget hierarchy and data flow for 
  *                     consistency with SWT behavior.
  ******************************************************************************/
+try {
+	google.load('visualization', '1', {'packages':['motionchart']});
+}
+catch (e) {
+	var mesg = "Error loading Google Motion Chart API: "+e;
+	if (console) {
+		console.log(mesg);
+	}
+	else {
+		alert(mesg);
+	}
+}
+
 qx.Class.define( "org.eclipse.rap.rwt.visualization.google.MotionChart", {
     extend: qx.ui.layout.CanvasLayout,
     
-    construct: function( id ) {
+    construct: function( ) {
         this.base( arguments );
-        this.setHtmlAttribute( "id", id );
-        this._id = id;
         this._chart = null;
         this._dataTable = null;
         this._options = {};
     },
     
+    destruct : function() {
+    	if (this._chart != null) {
+    		this._chart.dispose();
+    	}
+    },
+    
     properties : {
         widgetData : {
             init : "",
@@ -49,11 +66,11 @@
             }
         },
     
-        _initChart : function() {
+        initialize : function() {
         	var chart = this._chart; 
         	if (chart == null) {
 	    		this.info("Creating new chart instance.");
-	    		this._chart = new google.visualization.MotionChart(document.getElementById(this._id));                    
+	    		this._chart = new google.visualization.MotionChart(this._getTargetNode());                    
 	            var qParent = this;
 	            google.visualization.events.addListener(this._chart, 'ready', function() {
 	            	qParent.inited = true;
@@ -96,7 +113,7 @@
         
         redraw : function () {
         	try {
-	        	this._initChart();
+	        	this.initialize();
 	        	this.info("Attempting to redraw: "+this._dataTable+", "+this._options);
 	        	if (this._chart && this._dataTable && this._options) {
 	        		this.info("Drawing: "+this._options);
@@ -119,4 +136,8 @@
 		}
     }
     
-} );
\ No newline at end of file
+} );
+
+org.eclipse.rap.rwt.visualization.google.BaseChart.registerAdapter(
+		"org.eclipse.rap.rwt.visualization.google.MotionChart",
+		org.eclipse.rap.rwt.visualization.google.MotionChart);
\ No newline at end of file
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/motionchartkit/MotionChartAPI.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/motionchartkit/MotionChartAPI.js
deleted file mode 100644
index adb4214..0000000
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/motionchartkit/MotionChartAPI.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009-2010 David Donahue and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     David Donahue - initial API, implementation and documentation
- *     Austin Riddle (Texas Center for Applied Technology) - 
- *        added fault tolerance for offline situations
- ******************************************************************************/
-try {
-	google.load('visualization', '1', {'packages':['motionchart']});
-}
-catch (e) {
-	var mesg = "Error loading Google Motion Chart API: "+e;
-	if (console) {
-		console.log(mesg);
-	}
-	else {
-		alert(mesg);
-	}
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/motionchartkit/MotionChartAPIResource.java b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/motionchartkit/MotionChartAPIResource.java
deleted file mode 100644
index 48ccf5f..0000000
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/motionchartkit/MotionChartAPIResource.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009-2010 David Donahue.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     David Donahue - initial API, implementation and documentation
- ******************************************************************************/
-package org.eclipse.rap.rwt.visualization.google.internal.motionchartkit;
-
-import org.eclipse.rap.rwt.visualization.google.internal.GoogleVisualizationResource;
-
-public class MotionChartAPIResource extends GoogleVisualizationResource {
-
-  public String getLocation() {
-    return "org/eclipse/rap/rwt/visualization/google/internal/motionchartkit/MotionChartAPI.js";
-  }
-  
-}
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/piechartkit/PieChart.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/piechartkit/PieChart.js
index ff889d9..9488d17 100644
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/piechartkit/PieChart.js
+++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/piechartkit/PieChart.js
@@ -21,4 +21,8 @@
         
     }
     
-} );
\ No newline at end of file
+} );
+
+org.eclipse.rap.rwt.visualization.google.BaseChart.registerAdapter(
+		"org.eclipse.rap.rwt.visualization.google.PieChart",
+		org.eclipse.rap.rwt.visualization.google.PieChart);
\ No newline at end of file
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/scatterchartkit/ScatterChart.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/scatterchartkit/ScatterChart.js
index 7bcb651..c4c00d0 100644
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/scatterchartkit/ScatterChart.js
+++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/scatterchartkit/ScatterChart.js
@@ -21,4 +21,8 @@
         
     }
     
-} );
\ No newline at end of file
+} );
+
+org.eclipse.rap.rwt.visualization.google.BaseChart.registerAdapter(
+		"org.eclipse.rap.rwt.visualization.google.ScatterChart",
+		org.eclipse.rap.rwt.visualization.google.ScatterChart);
\ No newline at end of file
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/tablekit/Table.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/tablekit/Table.js
index 5d772ef..30e42c8 100644
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/tablekit/Table.js
+++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/tablekit/Table.js
@@ -10,138 +10,32 @@
  *     Austin Riddle - improvements to widget hierarchy and data flow for 
  *                     consistency with SWT behavior.
  ******************************************************************************/
+try {
+	google.load('visualization', '1', {'packages':['table']});
+}
+catch (e) {
+	var mesg = "Error loading Google Table API: "+e;
+	if (console) {
+		console.log(mesg);
+	}
+	else {
+		alert(mesg);
+	}
+}
+
 qx.Class.define( "org.eclipse.rap.rwt.visualization.google.Table", {
-    extend: qx.ui.layout.CanvasLayout,
-    
-    construct: function( id ) {
-        this.base( arguments );
-        this.setHtmlAttribute( "id", id );
-        this._id = id;
-        this._chart = null;
-        this._dataTable = null;
-        this._options = {};
-    },
-    
-    properties : {
-        widgetData : {
-            init : "",
-            apply : "refreshWidgetData"
-        },
-        widgetOptions : {
-            init : "",
-            apply : "refreshWidgetOptions"
-        },
-        selectedItem : {
-        	init : "",
-            apply : ""
-        },
-        selectedRow : {
-        	init : "",
-            apply : ""
-        },
-        selectedColumn : {
-        	init : "",
-            apply : ""
-        },
-        selectedValue : {
-        	init : "",
-            apply : ""
-        }
-    },
+    extend: org.eclipse.rap.rwt.visualization.google.BaseChart,
     
     members : {
-        _doActivate : function() {
-            var shell = null;
-            var parent = this.getParent();
-            while( shell == null && parent != null ) {
-                if( parent.classname == "org.eclipse.swt.widgets.Shell" ) {
-                    shell = parent;
-                }
-                parent = parent.getParent();
-            }
-            if( shell != null ) {
-                shell.setActiveChild( this );
-            }
-        },
+      
+      _createChart : function(domElement) {
+        return new google.visualization.Table(domElement);
+      }
         
-        _initChart : function() {
-        	qx.ui.core.Widget.flushGlobalQueues();
-        	var chart = this._chart; 
-        	if (chart == null) {
-        		this.info("Creating new table instance.");
-        		this._chart = new google.visualization.Table(document.getElementById(this._id));
-        		chart = this._chart;
-        		var qParent = this;
-        		google.visualization.events.addListener(this._chart, 'ready', function() {
-        		  qParent.info("Chart is ready.");
-        			qParent.inited = true;
-        		});
-        		var widgetId = this._id;
-        		var dataTable = qParent._dataTable;
-        		google.visualization.events.addListener(chart, 'select', function() {
-                	var row = chart.getSelection()[0].row;
-                	this.selectedItem = dataTable.getValue(row, 0);
-                	this.selectedRow = dataTable.getValue(row, 0);
-                	//fire selection event
-                	var req = org.eclipse.swt.Request.getInstance();
-                	req.addParameter(widgetId + ".selectedItem", this.selectedItem);
-                	req.addParameter(widgetId + ".selectedRow", this.selectedRow);
-                	req.addEvent( "org.eclipse.swt.events.widgetSelected", widgetId );
-                	req.send();
-    	        });
-        		this.info("Created new table instance.");
-        	}
-        },
-        
-        refreshWidgetData : function() {
-        	try {
-	        	var data = eval('(' + this.getWidgetData() + ')');
-	            this._dataTable = new google.visualization.DataTable(data);
-	            this.info("Setting data set to : "+this._dataTable);
-        	}
-        	catch (err) {
-        		this.info("Attempted to set data but failed.");
-        		this.info(err);
-        	}
-        },
-        
-        refreshWidgetOptions : function() {
-        	try {
-	        	qx.ui.core.Widget.flushGlobalQueues();
-	        	var opString = this.getWidgetOptions();
-	        	opString = opString.replace(new RegExp("~","g"), "\"");
-	        	var evalStr = "({" + opString;
-	        	evalStr = evalStr + "})";
-	        	this._options = eval(evalStr);
-        	}
-        	catch (err) {
-        		this.info(err);
-        	}
-        },
-        
-        redraw : function () {
-        	try {
-	        	this._initChart();
-	        	this.info("Attempting to draw: "+this._dataTable+", "+this._options);
-	        	if (this._chart && this._dataTable && this._options) {
-	        		this.info("Drawing: "+this._options);
-	        		this._chart.draw(this._dataTable, this._options);
-	        	}
-        	}
-        	catch (err) {
-        		this.info(err);
-        	}
-        },
-
-        _sendResponse : function(widget, field, value) {
-			//if (!org.eclipse.swt.EventUtil.getSuspended()) {
-				var wm = org.eclipse.swt.WidgetManager.getInstance();
-				var canvasId = wm.findIdByWidget(widget);
-				var req = org.eclipse.swt.Request.getInstance();
-				req.addParameter(canvasId + "." + field, value);
-				req.send();
-			//}
-		}
     }
     
-} );
\ No newline at end of file
+} );
+
+org.eclipse.rap.rwt.visualization.google.BaseChart.registerAdapter(
+		"org.eclipse.rap.rwt.visualization.google.Table",
+		org.eclipse.rap.rwt.visualization.google.Table);
\ No newline at end of file
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/tablekit/TableAPI.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/tablekit/TableAPI.js
deleted file mode 100644
index e2e9cc2..0000000
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/tablekit/TableAPI.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009-2010 David Donahue and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     David Donahue - initial API, implementation and documentation
- *     Austin Riddle (Texas Center for Applied Technology) - 
- *        added fault tolerance for offline situations
- ******************************************************************************/
-try {
-	google.load('visualization', '1', {'packages':['table']});
-}
-catch (e) {
-	var mesg = "Error loading Google Table API: "+e;
-	if (console) {
-		console.log(mesg);
-	}
-	else {
-		alert(mesg);
-	}
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/tablekit/TableAPIResource.java b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/tablekit/TableAPIResource.java
deleted file mode 100644
index 262a2ff..0000000
--- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/tablekit/TableAPIResource.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009-2010 David Donahue.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     David Donahue - initial API, implementation and documentation
- ******************************************************************************/
-package org.eclipse.rap.rwt.visualization.google.internal.tablekit;
-
-import org.eclipse.rap.rwt.visualization.google.internal.GoogleVisualizationResource;
-
-public class TableAPIResource extends GoogleVisualizationResource {
-  
-  public String getLocation() {
-    return "org/eclipse/rap/rwt/visualization/google/internal/tablekit/TableAPI.js";
-  }
-
-}