JNI Problem

2013-10-29 Thread Sean
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();
if(z12)
{
return http://127.0.0.1:/images/missing.png;;
}
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_valhold...@com.ll.cidb.client.CIDBViewer::getColorScale();*
url = http://127.0.0.1:/cidbviewer/map?res=; + res + z= + z
+ 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.

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+unsubscr...@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.


Re: JNI Problem

2013-10-29 Thread David
You are missing an extra () it should read:
*var colorScale = p_valhold...@com.ll.cidb.client.CIDBViewer
::getColorScale()();*
*
*


On Tue, Oct 29, 2013 at 4:58 PM, Sean slough...@gmail.com wrote:

 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();
 if(z12)
 {
 return http://127.0.0.1:/images/missing.png;;
  }
 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_valhold...@com.ll.cidb.client.CIDBViewer
 ::getColorScale();*
  url = http://127.0.0.1:/cidbviewer/map?res=; + res + z= + z
  + 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.

 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+unsubscr...@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.


-- 
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+unsubscr...@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.


Re: JNI Problem

2013-10-29 Thread Sean Loughran
Thanks David! That was the exactly it!


On Tue, Oct 29, 2013 at 12:07 PM, David david.no...@gmail.com wrote:

 You are missing an extra () it should read:
 *var colorScale = p_valhold...@com.ll.cidb.client.CIDBViewer
 ::getColorScale()();*
 *
 *


 On Tue, Oct 29, 2013 at 4:58 PM, Sean slough...@gmail.com wrote:

 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();
 if(z12)
 {
 return http://127.0.0.1:/images/missing.png;;
  }
 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_valhold...@com.ll.cidb.client.CIDBViewer
 ::getColorScale();*
  url = http://127.0.0.1:/cidbviewer/map?res=; + res + z= + z
  + 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.

 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+unsubscr...@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.


  --
 You received this message because you are subscribed to a topic in the
 Google Groups Google Web Toolkit group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/google-web-toolkit/gGocwnj1xAk/unsubscribe
 .
 To unsubscribe from this group and all its topics, send an email to
 google-web-toolkit+unsubscr...@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.


-- 
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+unsubscr...@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.