Tuesday, October 29, 2013

JNI Problem

Hey guys, I read the documentation on JNI and I think what I'm doing is correct, but its not working. I'm trying to get values from JAVA into Javascript. 

Code Snippet:
* @return
public String getColorScale()
int selIndex =m_colorBox.getSelectedIndex();
return m_colorBox.getItemText(selIndex);

* @return TMS URL for OSM cyclemap
private static native JSObject getCIDBUrl(CIDBViewer p_valHolder) /*-{
function get_my_gwt_url(bounds) {
var res = this.map.getResolution();

var x = Math.round((bounds.left - this.maxExtent.left)
/ (res * this.tileSize.w));
var y = Math.round((this.maxExtent.top - bounds.top)
/ (res * this.tileSize.h));
var z = this.map.getZoom();
return "";
var left = bounds.left;
var right = bounds.right;
var top = bounds.top;
var bottom = bounds.bottom;
//Call the JAVA side to get these values
var minVal = 0;
var maxVal = 10;
var colorScale = p_valHolder.@com.ll.cidb.client.CIDBViewer::getColorScale();
url = "" + res + "&z=" + z
+ "&left=" + left + "&right=" + right + "&top=" + top
+ "&bottom=" + bottom
+"&cs="+ colorScale
return url;

return get_my_gwt_url;


So you can see I have a simple java method that gets the value out of a ListBox. I want to pass that value into the JavaScript function so I can send it to my server. However, when I get to the server the value of colorScale is:
[function () {      var result = __static(dispId, this);      if (result[0]) {        throw result[1];      } else {        return result[1];      }    }]

I've tried this instead of passing the java instance. That didn't work either.

Any ideas?

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment