Re: Problem with writing JSNI wrapper for ActiveMQ ajax code

2008-11-26 Thread sommers

When you say it does not work, exactly what error do you get?

>From what I can see it looks like it should work so long as your
ActiveMqCallback class has an onEventArrived method definition, and
that you cont have a typo in
"com.yht.gwt.client.ActiveMqCallback::onEventArrived". Perhaps check
that message/e is not null... Cant really tell you anything else
without more info.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Problem with writing JSNI wrapper for ActiveMQ ajax code

2008-11-25 Thread Pete Kay
Hi,

I have a small piece of javascript code that I would like to wrap around
with JSNI to make it GWT.  It is essentially a javascript that calls
amq.addListener where amq is a object provided by amq.js. When a message
arrived, I would like it to call a Java Callback function.

Here is the Javascript that call the addListener method and then do
something.


amq.uri='/mycontext/amq';
var myHandler =
{
  rcvMessage: function(message)
  {
 alert("received "+message);
  }
};
amq.addListener(myId,myDestination,myHandler.rcvMessage);


For the GWT context, I would like the myHandler function to call a Java
callback object that I can define within GWT.
Here is the jsni code, but it does not work. Could someone tell me what's
wrong?

public static native void listen(ActiveMqCallback cb) /*-{
var myHandler =
{
  rcvMessage: function(message)
  {
 Event e = new Event(message);
 [EMAIL 
PROTECTED]::onEventArrived(Ljava/lang/String,Ljava/lang/String;)(message.type,message.value);

  }
};

amq.addListener(myId,myDestination,myHandler.rcvMessage);
}-*/;



Thank you very much in advance for all your help.
Pete

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---