Hi i am a Eclipse RAP developer. I was trying to make a custom RAP
widget of the Motion Chart in Google Visualization.
http://code.google.com/apis/visualization/documentation/gallery/motionchart.html
but I was getting an error. So I tried to make the Motion Chart in a
Qooxdoo 0.7.4 quickstart application, and I get the same error:
currPackage is undefined
The error occurs here
if(currPackage._logger==null){currPackage._logger=new
qx.log.Logger(currPackageName,
parentLogger);
Ivan Furnadjiev of the RAP team suggested this might be a conflict
between Qooxdoo and the Motion Chart library. My code is below.
Thanks for any help!
David Donohue
index.html:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Quickstart</title>
<!-- Use settings to configure application -->
<script type="text/javascript">
qxsettings = { "qx.application" : "Application" };
</script>
<!-- Include compiled qooxdoo -->
<script type="text/javascript" src="script/qx.js"></script>
<script type="text/javascript"
src="http://www.google.com/jsapi"></script>
<!-- Add your own classes here -->
<script type="text/javascript" src="Application.js"></script>
</head>
<body>
<div id="motionchart"/>
</body>
</html>
Application.js
qx.Class.define("Application",
{
extend : qx.application.Gui,
members :
{
main : function()
{
// Call super class
this.base(arguments);
// Create button
var button1 = new qx.ui.form.Button("First Button", "./button.png");
// Set button location
button1.setTop(50);
button1.setLeft(50);
// Add button to document
button1.addToDocument();
// Add an event listener
button1.addEventListener("execute", function(e) {
alert("Hello World!");
});
qx.Class.define( "org.inqle.ui.google.jsapi.MotionChart", {
extend: qx.ui.layout.CanvasLayout,
construct: function( id ) {
this.base( arguments );
this.setHtmlAttribute( "id", id );
this._id = id;
this._chart = null;
this.addEventListener( "changeHeight", this._doResize, this );
this.addEventListener( "changeWidth", this._doResize, this );
google.load('visualization', '1', {'packages':['motionchart']});
google.setOnLoadCallback(this.drawMotionChart);
alert('construct finished.');
this.info('Constructed');
},
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 );
}
},
drawMotionChart : function() {
alert('drawMotionChart() called');
if( this._chart == null ) {
this._chart = new
google.visualization.MotionChart(document.getElementById(this._id));
}
var data = new google.visualization.DataTable();
data.addRows(6);
data.addColumn('string', 'Fruit');
data.addColumn('date', 'Date');
data.addColumn('number', 'Sales');
data.addColumn('number', 'Expenses');
data.addColumn('string', 'Location');
data.setValue(0, 0, 'Apples');
data.setValue(0, 1, new Date (1988,0,1));
data.setValue(0, 2, 1000);
data.setValue(0, 3, 300);
data.setValue(0, 4, 'East');
data.setValue(1, 0, 'Oranges');
data.setValue(1, 1, new Date (1988,0,1));
data.setValue(1, 2, 950);
data.setValue(1, 3, 200);
data.setValue(1, 4, 'West');
data.setValue(2, 0, 'Bananas');
data.setValue(2, 1, new Date (1988,0,1));
data.setValue(2, 2, 300);
data.setValue(2, 3, 250);
data.setValue(2, 4, 'West');
data.setValue(3, 0, 'Apples');
data.setValue(3, 1, new Date(1988,1,1));
data.setValue(3, 2, 1200);
data.setValue(3, 3, 400);
data.setValue(3, 4, "East");
data.setValue(4, 0, 'Oranges');
data.setValue(4, 1, new Date(1988,1,1));
data.setValue(4, 2, 900);
data.setValue(4, 3, 150);
data.setValue(4, 4, "West");
data.setValue(5, 0, 'Bananas');
data.setValue(5, 1, new Date(1988,1,1));
data.setValue(5, 2, 788);
data.setValue(5, 3, 617);
data.setValue(5, 4, "West");
var chart = this._chart;
this.chart.draw(data, {width: 600, height:300});
},
onLoadCallback : function() {
alert('onLoadCallback() called');
drawMotionChart();
},
_doResize : function() {
qx.ui.core.Widget.flushGlobalQueues();
if( this._chart != null ) {
this._chart.checkResize();
}
}
}
} );
alert('defined class MotionChart');
var mc = new org.inqle.ui.google.jsapi.MotionChart("motionchart");
mc.addToDocument();
}
}
});
------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel