Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » resourcemanager resource order
resourcemanager resource order [message #1165792] Fri, 01 November 2013 14:50
Rene Richter is currently offline Rene RichterFriend
Messages: 13
Registered: May 2013
Junior Member
Hi,

I'm facing a weird problem while playing around with the google visualization project under RAP 1.5.0. The demo works fine..

As the next step, I create an own bundle, extending the example by a treemap implementation. The resource is loaded properly.
Nevertheless I get an 'TypeError: org.eclipse.rap is undefined @http: //127.0.0.1:10081/rwt-resources/resources-d6262385.js:27

Line 27: qx.Class.define( "org.modelbus.services.metrino.analysis.api.TreeMap", {
extend: org.eclipse.rap.rwt.visualization.google.BaseChart,

in:

try {
	google.load('visualization', '1', {'packages':['treemap']});
}
catch (e) {
	var mesg = "Error loading Google TreeMap API: "+e;
	if (console) {
		console.log(mesg);
	}
	else {
		alert(mesg);
	}
}

qx.Class.define( "org.modelbus.services.metrino.analysis.api.TreeMap", {
  extend: org.eclipse.rap.rwt.visualization.google.BaseChart,
    

    
    members : {
      
      _createChart : function(domElement) {
        return new google.visualization.TreeMap(domElement);
      },

      initialize : function() {
      	var chart = this._chart; 
      	if (chart == null) {
	    		this.info("Creating new chart instance.");
	    		this._chart = new google.visualization.TreeMap(this._getTargetNode()); 
	    		var chart = this._chart;
	            var qParent = this;
	            google.visualization.events.addListener(this._chart, 'onmouseover', function() {	            	
	            });
	            google.visualization.events.addListener(this._chart, 'onmouseout', function() {

	            });
	            google.visualization.events.addListener(chart, 'select', function() {
	            	console.log("select");
	            	var wm = org.eclipse.swt.WidgetManager.getInstance();
	                var widgetId = wm.findIdByWidget(qParent);
	                
	            	var selObj = chart.getSelection();
	            	var selection = selObj[0].row;
//	            	var selection = clickedObj.row;
//	            	this.selectedItem = selection;
	            	console.log(selection);
	            	this.selectedItem = qParent._dataTable.getValue(selection,0);
//	            	this.selectedRow = selection;
//	            	this.selectedColumn = 0;
	            	console.log(qParent._dataTable.getValue(selection,4));

//	            	console.log(chart.getSelection())
	            	//fire selection event
	            	var req = org.eclipse.swt.Request.getInstance();
	            	req.addParameter(widgetId + ".selectedItem", this.selectedItem);
	            	req.addParameter(widgetId + ".selectedRow", selection);
	            	req.addParameter(widgetId + ".selectedColumn", "0");
	            	req.addParameter(widgetId + ".selectedValue", qParent._dataTable.getValue(selection,2));
	            	req.addEvent( "org.eclipse.swt.events.widgetSelected", widgetId );
	            	req.send();
	            });
	            
	            
	            
	            
	            this.info("Created new chart instance.");
      	}
      }


        
    }
    
} );


This problem doesn't occur when the treemap code doesn't reside in its own bundle but is added to the google bundle.
I suppose, that my problem is less a google charting problem, but more a resource loading problem, so here are some questions goolge couldn't answer:

- All loaded resources are merged into a resources.js, right?! I noticed, that my treemap javascript code is added first when implemented in its own bundle (and the error occurs).
So my question is, whether the order of added resoures is relevant or whether this is just a random observation.

- If the order is relevant, is it possible to load the resources in the google bundle before the treemap bundle resources?

- How is the order of loaded resources organized anyway?



I would really appreciate it if someone could enlighten my concerning resource loading and resource order.
Thank you in advance.

Edit: I added the BaseChart resource (which the treemap depends on) also to the treemap bundle manifest(only loaded in the google bundle so far). Now it works but doesn`t look like a neat solution to me.
My questions remain valid. Thank you!

[Updated on: Fri, 01 November 2013 15:09]

Report message to a moderator

Previous Topic:ClientScripting restricted DOM navigation
Next Topic:RAP 2.2M2 FileUpload: Filter specific extension
Goto Forum:
  


Current Time: Sun Dec 21 00:38:23 GMT 2014

Powered by FUDForum. Page generated in 0.04686 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software