Re: Problem trying to use JSNI to eval() a JSON string
I finally figured this out (a while ago) and thought I would post the solution in case anybody else has the same problem. It turns out I needed to add an inherit line to my .gwt.xml file, as follows: By doing that it made the JSONParser and related classes available on the client side. I couldn't find that documented anywhere, but stumbled upon it on my own. Happy Apping! Glenn On Jan 17, 1:03 am, Glenn Simon wrote: > Thanks for trying to help, guys, but after modifying and checking the > string with JsonUtils, trying com.google.gwt.json.client.JSONParser > (tells me the code is unavailable and fails to load my app), and > reading Google docs 'til my eyes hurt I can't for the life of me > figure out how to make JSON work in my app. I know I'm doing > something wrong but I can't figure out what it is. I just want a way > of getting some formatted string data from the server to the client in > push mode using the Channel. I can get what looks like a JSON string > to the client in push mode, but can't find any tools that work to help > me parse the JSON string once it is at the client. I'll try switching > to XML. -- 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 google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Need help with how to handle system events like the system sleeping/waking
I have written an app that works fine, but when the user PC sleeps due to power settings and the channel times out, I have to refresh the browser to restart the app. I would like to find a handler that will do something just before the system sleeps and do something else as the system wakes up again. I'm looking for a window or browser handler with onSleep() and onWake() methods or something like that. Anybody know where I can find it? -- 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 google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Problem trying to use JSNI to eval() a JSON string
Thanks for trying to help, guys, but after modifying and checking the string with JsonUtils, trying com.google.gwt.json.client.JSONParser (tells me the code is unavailable and fails to load my app), and reading Google docs 'til my eyes hurt I can't for the life of me figure out how to make JSON work in my app. I know I'm doing something wrong but I can't figure out what it is. I just want a way of getting some formatted string data from the server to the client in push mode using the Channel. I can get what looks like a JSON string to the client in push mode, but can't find any tools that work to help me parse the JSON string once it is at the client. I'll try switching to XML. -- 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 google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Problem trying to use JSNI to eval() a JSON string
Yeah, that makes sense. And this is only client side anyway. But I have tried with and without the Serializable implementation and get the same result. Do I somehow need to convert the string to a JSON object before passing it to eval()? -- 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 google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Problem trying to use JSNI to eval() a JSON string
Here is some of my code: public abstract class Message extends JavaScriptObject implements Serializable { // does it need to be serializable? protected Message() {} public final native String getType() /*-{ return this.type; }-*/; public final native Long getTimeLeft() /*-{ return this.timeleft; }- */; } public static native Message parseJson(String jsonStr) /*-{ return eval(jsonStr); }-*/; String myString = "{ \"type\" : \"complete\", \"timeleft\" : -5000 }"; Message message = parseJson(myString); Window.alert("type: " + message.getType()); During the parseJson call, I get kicked into MethodDispatch.class when an exception is caught: } catch (InvocationTargetException e) { // If we get here, it means an exception is being thrown from // Java back into JavaScript wrapException(returnValue, e.getTargetException()); return true; } I have read the docs numerous times, and can't figure out what I am doing wrong. Can anyone help me? Thanks in advance. Glenn -- 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 google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.