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.
/**
*
* @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();
if(z<12)
{
}
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();
+ "&left=" + left + "&right=" + right + "&top=" + top
+ "&bottom=" + bottom
+"&cs="+ colorScale
+"&min="+minVal
+"&max="+maxVal;
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.