refs bug 340324 - upgraded google charts to latest api.
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 b6f03c0..c07d125 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
@@ -1,21 +1,26 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration type="org.eclipse.rap.ui.launch.RAPLauncher"> <booleanAttribute key="append.args" value="true"/> +<booleanAttribute key="askclear" value="false"/> <booleanAttribute key="automaticAdd" value="false"/> <booleanAttribute key="automaticValidate" value="false"/> <stringAttribute key="bootstrap" value=""/> <stringAttribute key="checked" value="[NONE]"/> <booleanAttribute key="clearConfig" value="false"/> +<booleanAttribute key="clearws" value="false"/> <stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/RAP Google Visualizations Demo"/> <booleanAttribute key="default" value="true"/> <booleanAttribute key="default_auto_start" value="true"/> <intAttribute key="default_start_level" value="4"/> <booleanAttribute key="includeOptional" value="false"/> <booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> +<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_27"/> <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -console -consolelog"/> <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dorg.eclipse.equinox.http.jetty.customizer.class=org.eclipse.rap.jettycustomizer.internal.SessionCookieCustomizer"/> <stringAttribute key="org.eclipse.rap.launch.browserMode" value="INTERNAL"/> +<stringAttribute key="org.eclipse.rap.launch.contextpath" value=""/> +<stringAttribute key="org.eclipse.rap.launch.dataLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.rap.ui.launch/RAPGoogleVisualizationsDemo"/> <stringAttribute key="org.eclipse.rap.launch.entryPoint" value="demo"/> <stringAttribute key="org.eclipse.rap.launch.libraryVariant" value="DEBUG"/> <stringAttribute key="org.eclipse.rap.launch.logLevel" value="ALL"/> @@ -24,13 +29,15 @@ <stringAttribute key="org.eclipse.rap.launch.servletName" value="googlevis"/> <intAttribute key="org.eclipse.rap.launch.sessionTimeout" value="0"/> <booleanAttribute key="org.eclipse.rap.launch.terminatePrevious" value="true"/> +<booleanAttribute key="org.eclipse.rap.launch.useDefaultDataLocation" value="true"/> +<booleanAttribute key="org.eclipse.rap.launch.useManualContextPath" value="false"/> <booleanAttribute key="org.eclipse.rap.launch.useManualPort" value="false"/> <booleanAttribute key="org.eclipse.rap.launch.useSessionTimeout" value="false"/> <stringAttribute key="pde.version" value="3.3"/> <booleanAttribute key="show_selected_only" value="false"/> -<stringAttribute key="target_bundles" value="org.eclipse.rap.rwt@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.osgi@-1:true,org.eclipse.rap.ui.workbench@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.rap.jettycustomizer@default:false,org.eclipse.equinox.common@2:true,org.eclipse.core.runtime@default:true,org.eclipse.equinox.registry@default:default,com.ibm.icu.base@default:default,org.eclipse.osgi.services@default:default,org.mortbay.jetty.server@default:default,org.eclipse.help@default:default,org.eclipse.rap.jface@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.equinox.preferences@default:default,org.mortbay.jetty.util@default:default,javax.servlet@default:default,org.eclipse.rap.rwt.q07@default:false,org.eclipse.equinox.http.jetty@default:default,org.eclipse.rap.ui@default:default"/> +<stringAttribute key="target_bundles" value="com.ibm.icu.base@default:default,javax.servlet@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime@default:true,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.console@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.help@default:default,org.eclipse.jetty.continuation@default:default,org.eclipse.jetty.http@default:default,org.eclipse.jetty.io@default:default,org.eclipse.jetty.security@default:default,org.eclipse.jetty.server@default:default,org.eclipse.jetty.servlet@default:default,org.eclipse.jetty.util@default:default,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true"/> <booleanAttribute key="tracing" value="false"/> <booleanAttribute key="useCustomFeatures" value="false"/> <booleanAttribute key="useDefaultConfigArea" value="true"/> -<stringAttribute key="workspace_bundles" value="org.eclipse.rap.rwt.visualization.google.demo@default:default,org.eclipse.rap.rwt.visualization.google@default:default,org.json@default:default,org.eclipse.rap.rwt.excanvas@default:default"/> +<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"/> </launchConfiguration>
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/plugin.xml b/bundles/org.eclipse.rap.rwt.visualization.google/plugin.xml index bfaa5b5..d2d8318 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.google/plugin.xml +++ b/bundles/org.eclipse.rap.rwt.visualization.google/plugin.xml
@@ -6,29 +6,26 @@ id="org.org.eclipse.rap.rwt.visualizations.google.jsapi" point="org.eclipse.rap.ui.resources"> <resource class="org.eclipse.rap.rwt.visualization.google.internal.GoogleAPIResource"/> + <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.ColumnChartAPIResource"/> <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.ScatterChartAPIResource"/> <resource class="org.eclipse.rap.rwt.visualization.google.internal.scatterchartkit.ScatterChartResource"/> - <resource class="org.eclipse.rap.rwt.visualization.google.internal.linechartkit.LineChartAPIResource"/> <resource class="org.eclipse.rap.rwt.visualization.google.internal.linechartkit.LineChartResource"/> - <resource class="org.eclipse.rap.rwt.visualization.google.internal.piechartkit.PieChartAPIResource"/> <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.BarChartAPIResource"/> <resource class="org.eclipse.rap.rwt.visualization.google.internal.barchartkit.BarChartResource"/> <resource class="org.eclipse.rap.rwt.visualization.google.internal.gaugekit.GaugeAPIResource"/> @@ -40,7 +37,6 @@ <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.AreaChartAPIResource"/> <resource class="org.eclipse.rap.rwt.visualization.google.internal.areachartkit.AreaChartResource"/> </extension> </plugin>
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 new file mode 100644 index 0000000..146fda9 --- /dev/null +++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/BaseChart.js
@@ -0,0 +1,159 @@ +/******************************************************************************* + * 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 - improvements to widget hierarchy and data flow for + * consistency with SWT behavior. + ******************************************************************************/ +qx.Class.define( "org.eclipse.rap.rwt.visualization.google.BaseChart", { + type: "abstract", + 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 : "" + } + }, + + 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) { + + }, + + _initChart : function() { + var chart = this._chart; + if (chart == null) { + this.info("Creating new chart instance."); + this._chart = this._createChart(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 chart 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
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/linechartkit/LineChartAPIResource.java b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/BaseChartResource.java similarity index 73% copy from bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/linechartkit/LineChartAPIResource.java copy to bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/BaseChartResource.java index 322801f..15e405a 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/linechartkit/LineChartAPIResource.java +++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/BaseChartResource.java
@@ -8,14 +8,14 @@ * Contributors: * David Donahue - initial API, implementation and documentation ******************************************************************************/ -package org.eclipse.rap.rwt.visualization.google.internal.linechartkit; +package org.eclipse.rap.rwt.visualization.google.internal; import org.eclipse.rap.rwt.visualization.google.internal.GoogleVisualizationResource; -public class LineChartAPIResource extends GoogleVisualizationResource { - +public class BaseChartResource extends GoogleVisualizationResource { + public String getLocation() { - return "org/eclipse/rap/rwt/visualization/google/internal/linechartkit/LineChartAPI.js"; + return "org/eclipse/rap/rwt/visualization/google/internal/BaseChart.js"; } }
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/linechartkit/LineChartAPI.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/CoreChartAPI.js similarity index 85% rename from bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/linechartkit/LineChartAPI.js rename to bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/CoreChartAPI.js index 95b9890..2a409fd 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/linechartkit/LineChartAPI.js +++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/CoreChartAPI.js
@@ -11,14 +11,14 @@ * added fault tolerance for offline situations ******************************************************************************/ try { - google.load("visualization", "1", {packages:["linechart"]}); + google.load('visualization', '1.0', {'packages':['corechart']}); } catch (e) { - var mesg = "Error loading Google Line Chart API: "+e; + var mesg = "Error loading Google Core 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/linechartkit/LineChartAPIResource.java b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/CoreChartAPIResource.java similarity index 74% rename from bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/linechartkit/LineChartAPIResource.java rename to bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/CoreChartAPIResource.java index 322801f..b054d7c 100644 --- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/linechartkit/LineChartAPIResource.java +++ b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/CoreChartAPIResource.java
@@ -8,14 +8,14 @@ * Contributors: * David Donahue - initial API, implementation and documentation ******************************************************************************/ -package org.eclipse.rap.rwt.visualization.google.internal.linechartkit; +package org.eclipse.rap.rwt.visualization.google.internal; import org.eclipse.rap.rwt.visualization.google.internal.GoogleVisualizationResource; -public class LineChartAPIResource extends GoogleVisualizationResource { +public class CoreChartAPIResource extends GoogleVisualizationResource { public String getLocation() { - return "org/eclipse/rap/rwt/visualization/google/internal/linechartkit/LineChartAPI.js"; + return "org/eclipse/rap/rwt/visualization/google/internal/CoreChartAPI.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 80e3033..23793ce 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
@@ -11,140 +11,14 @@ * consistency with SWT behavior. ******************************************************************************/ qx.Class.define( "org.eclipse.rap.rwt.visualization.google.AreaChart", { - 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.AreaChart(domElement); + } - _initChart : function() { - var chart = this._chart; - if (chart == null) { - this.info("Creating new areachart instance."); - this._chart = new google.visualization.AreaChart(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 areachart 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
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/areachartkit/AreaChartAPI.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/areachartkit/AreaChartAPI.js deleted file mode 100644 index 5cb5b9c..0000000 --- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/areachartkit/AreaChartAPI.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':['areachart']}); -} -catch (e) { - var mesg = "Error loading Google Area 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/areachartkit/AreaChartAPIResource.java b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/areachartkit/AreaChartAPIResource.java deleted file mode 100644 index da4557f..0000000 --- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/areachartkit/AreaChartAPIResource.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.areachartkit; - -import org.eclipse.rap.rwt.visualization.google.internal.GoogleVisualizationResource; - -public class AreaChartAPIResource extends GoogleVisualizationResource { - - public String getLocation() { - return "org/eclipse/rap/rwt/visualization/google/internal/areachartkit/AreaChartAPI.js"; - } - -}
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 4fc90de..6b310fb 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
@@ -11,140 +11,14 @@ * consistency with SWT behavior. ******************************************************************************/ qx.Class.define( "org.eclipse.rap.rwt.visualization.google.BarChart", { - 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.BarChart(domElement); + } - _initChart : function() { - var chart = this._chart; - if (chart == null) { - this.info("Creating new areachart instance."); - this._chart = new google.visualization.BarChart(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 areachart 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
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/barchartkit/BarChartAPI.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/barchartkit/BarChartAPI.js deleted file mode 100644 index 52c7cb8..0000000 --- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/barchartkit/BarChartAPI.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':['barchart']}); -} -catch (e) { - var mesg = "Error loading Google Bar 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/barchartkit/BarChartAPIResource.java b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/barchartkit/BarChartAPIResource.java deleted file mode 100644 index 7ee8238..0000000 --- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/barchartkit/BarChartAPIResource.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.barchartkit; - -import org.eclipse.rap.rwt.visualization.google.internal.GoogleVisualizationResource; - -public class BarChartAPIResource extends GoogleVisualizationResource { - - public String getLocation() { - return "org/eclipse/rap/rwt/visualization/google/internal/barchartkit/BarChartAPI.js"; - } - -}
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 ca6e1c0..0a35641 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
@@ -11,140 +11,14 @@ * consistency with SWT behavior. ******************************************************************************/ qx.Class.define( "org.eclipse.rap.rwt.visualization.google.ColumnChart", { - 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.ColumnChart(domElement); + } - _initChart : function() { - var chart = this._chart; - if (chart == null) { - this.info("Creating new Column Chart instance."); - this._chart = new google.visualization.ColumnChart(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 Column Chart 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
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/columnchartkit/ColumnChartAPI.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/columnchartkit/ColumnChartAPI.js deleted file mode 100644 index 61dab9f..0000000 --- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/columnchartkit/ColumnChartAPI.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':['columnchart']}); -} -catch (e) { - var mesg = "Error loading Google Column 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/columnchartkit/ColumnChartAPIResource.java b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/columnchartkit/ColumnChartAPIResource.java deleted file mode 100644 index 338f0a1..0000000 --- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/columnchartkit/ColumnChartAPIResource.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.columnchartkit; - -import org.eclipse.rap.rwt.visualization.google.internal.GoogleVisualizationResource; - -public class ColumnChartAPIResource extends GoogleVisualizationResource { - - public String getLocation() { - return "org/eclipse/rap/rwt/visualization/google/internal/columnchartkit/ColumnChartAPI.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 a7ee3b9..2e59198 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
@@ -11,145 +11,14 @@ * consistency with SWT behavior. ******************************************************************************/ qx.Class.define( "org.eclipse.rap.rwt.visualization.google.LineChart", { - 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.LineChart(domElement); + } - _initChart : function() { - qx.ui.core.Widget.flushGlobalQueues(); - var chart = this._chart; - if (chart == null) { - this.info("Creating new linechart instance."); - this._chart = new google.visualization.LineChart(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() { - 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 linechart 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
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 bb0a509..ff889d9 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
@@ -11,144 +11,14 @@ * consistency with SWT behavior. ******************************************************************************/ qx.Class.define( "org.eclipse.rap.rwt.visualization.google.PieChart", { - 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.PieChart(domElement); + } - _initChart : function() { - var chart = this._chart; - if (chart == null) { - this.info("Creating new piechart instance."); - this._chart = new google.visualization.PieChart(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 piechart 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
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/piechartkit/PieChartAPI.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/piechartkit/PieChartAPI.js deleted file mode 100644 index 32df840..0000000 --- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/piechartkit/PieChartAPI.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:["piechart"]}); -} -catch (e) { - var mesg = "Error loading Google Pie Chart 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/piechartkit/PieChartAPIResource.java b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/piechartkit/PieChartAPIResource.java deleted file mode 100644 index 8ced23a..0000000 --- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/piechartkit/PieChartAPIResource.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.piechartkit; - -import org.eclipse.rap.rwt.visualization.google.internal.GoogleVisualizationResource; - -public class PieChartAPIResource extends GoogleVisualizationResource { - - public String getLocation() { - return "org/eclipse/rap/rwt/visualization/google/internal/piechartkit/PieChartAPI.js"; - } - -}
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 98141a9..7bcb651 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
@@ -11,145 +11,14 @@ * consistency with SWT behavior. ******************************************************************************/ qx.Class.define( "org.eclipse.rap.rwt.visualization.google.ScatterChart", { - 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.ScatterChart(domElement); + } - _initChart : function() { - qx.ui.core.Widget.flushGlobalQueues(); - var chart = this._chart; - if (chart == null) { - this.info("Creating new scatter chart instance."); - this._chart = new google.visualization.ScatterChart(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() { - 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 chart 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
diff --git a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/scatterchartkit/ScatterChartAPI.js b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/scatterchartkit/ScatterChartAPI.js deleted file mode 100644 index 767b6cb..0000000 --- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/scatterchartkit/ScatterChartAPI.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:["scatterchart"]}); -} -catch (e) { - var mesg = "Error loading Google Scatter Chart 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/scatterchartkit/ScatterChartAPIResource.java b/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/scatterchartkit/ScatterChartAPIResource.java deleted file mode 100644 index df27671..0000000 --- a/bundles/org.eclipse.rap.rwt.visualization.google/src/org/eclipse/rap/rwt/visualization/google/internal/scatterchartkit/ScatterChartAPIResource.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.scatterchartkit; - -import org.eclipse.rap.rwt.visualization.google.internal.GoogleVisualizationResource; - -public class ScatterChartAPIResource extends GoogleVisualizationResource { - - public String getLocation() { - return "org/eclipse/rap/rwt/visualization/google/internal/scatterchartkit/ScatterChartAPI.js"; - } - -}