Re: JSNI function and DevMode
I've been able to get largely past this issue. It looks like the menus aren't working because of an issue with how the Controllers are loaded in DevMode (still researching). The JS method gets exported and is properly firing the selected page, but that event is getting lost further along. The part that was throwing me off is that in DevMode, when I have the JS function defined as in the first post, clicking on a menu and firing this function causes the page to clear and null to be displayed. If I remove the $entry(); wrapping, the method still fires, but doesn't cause DevMode to clear the page and display null. Thanks for everyone's suggestions. On Thursday, July 3, 2014 12:19:31 PM UTC-4, jonl wrote: After reading the other replies and looking at this, I would suspect it to be a race condition in DevMode. Where the problem lies in when the exportMenuClickedMethod() is called. This is where the method being static or not comes into play. By it not being static, it can't be called until an instance of the class is created, which in DevMode may different than in compiled mode because you have the back and forth of the browser and Eclipse here. So, I would make the method static, and call it in a static initialize block for the class in which it is declared. That way it will be exported more consistently in DevMode and compiled mode. On Wednesday, July 2, 2014 10:33:33 AM UTC-7, gktcs wrote: I was trying to anonymize what was actually being done when pasting in here and somehow ended up with an extra single quote. I've verified that the application is correct and just using 'PAGE'. As for the export function not being static...probably just an oversight. I wouldn't think it matters either, but I'll make the change and see if that makes any difference. On Wednesday, July 2, 2014 11:59:47 AM UTC-4, Patrick Tucker wrote: You have 2 single quotes after PAGE?? Also, not that it should matter here, but why isn't your export function static? -- 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/d/optout.
Re: JSNI function and DevMode
Looks like a difference between compiled and DevMode with respect to the link handling. If I define the menu links as such, there are no issues in compiled or dev mode, even with keeping the $entry() call: a href=javascript:; onclick=javascript:launchMenuEvent('PAGE'); return false; class=menuClass Thanks again for the suggestions. On Thursday, July 3, 2014 2:32:59 PM UTC-4, gktcs wrote: I've been able to get largely past this issue. It looks like the menus aren't working because of an issue with how the Controllers are loaded in DevMode (still researching). The JS method gets exported and is properly firing the selected page, but that event is getting lost further along. The part that was throwing me off is that in DevMode, when I have the JS function defined as in the first post, clicking on a menu and firing this function causes the page to clear and null to be displayed. If I remove the $entry(); wrapping, the method still fires, but doesn't cause DevMode to clear the page and display null. Thanks for everyone's suggestions. On Thursday, July 3, 2014 12:19:31 PM UTC-4, jonl wrote: After reading the other replies and looking at this, I would suspect it to be a race condition in DevMode. Where the problem lies in when the exportMenuClickedMethod() is called. This is where the method being static or not comes into play. By it not being static, it can't be called until an instance of the class is created, which in DevMode may different than in compiled mode because you have the back and forth of the browser and Eclipse here. So, I would make the method static, and call it in a static initialize block for the class in which it is declared. That way it will be exported more consistently in DevMode and compiled mode. On Wednesday, July 2, 2014 10:33:33 AM UTC-7, gktcs wrote: I was trying to anonymize what was actually being done when pasting in here and somehow ended up with an extra single quote. I've verified that the application is correct and just using 'PAGE'. As for the export function not being static...probably just an oversight. I wouldn't think it matters either, but I'll make the change and see if that makes any difference. On Wednesday, July 2, 2014 11:59:47 AM UTC-4, Patrick Tucker wrote: You have 2 single quotes after PAGE?? Also, not that it should matter here, but why isn't your export function static? -- 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/d/optout.
Re: JSNI function and DevMode
I was trying to anonymize what was actually being done when pasting in here and somehow ended up with an extra single quote. I've verified that the application is correct and just using 'PAGE'. As for the export function not being static...probably just an oversight. I wouldn't think it matters either, but I'll make the change and see if that makes any difference. On Wednesday, July 2, 2014 11:59:47 AM UTC-4, Patrick Tucker wrote: You have 2 single quotes after PAGE?? Also, not that it should matter here, but why isn't your export function static? -- 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/d/optout.
JSNI function and DevMode
We have a simple GWT (2.5.1) and GXT (3.0.6) application which has a menu built from anchors. The anchors are defined like: a href=javascript:launchMenuEvent('PAGE''); class=menuClass Where the launchMenuEvent function is defined as: private final native void exportMenuClickMethod() /*-{ $wnd.launchMenuEvent = $entry(@our.package.ui.NavigationContainer::handleMenuEvent(Ljava/lang/String;)); }-*/; When we run the compiled application in any of the supported browsers, this functionality works as designed; a user can select a menu item and fire-off the corresponding event. However, when we run this in DevMode, we simply get null returned and the code behind NavigationContainer.handleMenuEvent is never called. It seems like the launchMenuEvent is never being defined in the browser when running in DevMode, even though we can step through the code and see that exportMenuClickMethod is called. I feel like I've overlooked something simple, but can't figure out why this isn't working in DevMode. Any help would be greatly appreciated. Thanks! -- 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/d/optout.
Re: GWT and method overriding
The override has been there all along (I was hoping it wasn't), I just forgot to put it in my sample code. The callback instance is defined as: dispatch.execute(someAction, new MyCallbacksomeActionResult() { // implementation of a couple abstract methods from MyCallback @Override public void handleException(SomeException ex) { // do actual work here } }); Not sure if it matters, but the callback code above is behind an application split point. We're using GWT 2.4.0. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/KV5AcBDV-9UJ. 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: GWT and method overriding
Ugh. Never mind, user error. Functionality works as expected. I forgot we had an additional layer wrapping the original callback; updated that and everything works as expected. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/pCt1TTmW0twJ. 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.
GWT and method overriding
I was hoping someone could explain to me why the following isn't working in GWT. I've been staring at this for a while now and clearly I'm missing something simple. Hopefully someone can hit me with a clue stick and fill me in on what I'm missing. We have a custom callback class defined as: public abstract class MyCallbackT implements AsyncCallbackT which looks at the exception type in onFailure and takes some action based on the class type. A new type check has been added: public void onFailure(Throwable t) { ... if (t instanceof SomeException) { handleException((SomeException)t); } where handleException(SomeException) is defined in the custom callback class as: public void handleException(SomeException ex) { // empty } When the callback object is actually created and used in an RPC dispatch (we're using gwt-dispatch), the handleException method is defined then: dispatch.execute(someAction, new MyCallbacksomeActionResult() { // implementation of a couple abstract methods from MyCallback public void handleException(SomeException ex) { // do actual work here } }); The issue is that the do actual work handleException method is never being called. Only the base handleException (the empty one in MyCallback) is being called, not the overridden method. I'm sure I've completely overlooked something simple so any explanation as to why it's not/won't work, or how to get it working would be greatly appreciated. It seems like something similar works in Java, just curious how to get it working here. Thank you in advance. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/Nfcl2i1Q6GIJ. 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.
MVC + Command Pattern + Code Splitting?
Has anyone been able to get complete code splitting working with gwt- dispatch or similar command pattern implementation? We've got a rather large MVC-based application, and our code splitting is done at the Controller level.The code splitting works great-- neither the Controller nor the View will be loaded unless the associated module has been explicitly requested. We use gwt-dispatch (with SecureDispatchAsync) to provide our communication with the server. Everything works great with gwt-dispatch, except that *all* of our Request (Action) and Result objects are compiled into the initial download, instead of being included in the split point which contains the associated Controller and View. We're using SecureDispatchAsync in the startup module to load some basic startup information, but all of the other Request/Result pairs are isolated to their corresponding Controller. The GWT SOYC report shows that all of the Request and Result objects are being included in the initial download. Given the large-ish number of Action/Result objects we have, this is adding significant bulk to our initial application download size. I've read around and asked on the gwt-dispatch group and it seems like no one has had to use code splitting and the command pattern; so far, the only answers I've been able to find were (a) had to get rid of gwt- dispatch/command pattern, (b) just accept the increased size, or (c) it could be related to this issue: http://code.google.com/p/google-web-toolkit/issues/detail?id=2374. Just curious as to what others are doing, or if someone has found a way around this problem Thanks -- 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.