Re: Is it possible to seamlessly display an ajax spinner for every GWT RPC call?
I guess I could have a decorator class for every async service interface I use but that seems incredibly tedious and repetitive. I have quite a few RPC services already and will have many more as the project grows. I guess the other option is to try to generate decorator classes via deferred binding. This seems like a pretty big deal though. Are there existing libraries which would allow me to do this? On Dec 3, 9:34 pm, Cristiano cristiano.costant...@gmail.com wrote: Hi, interesting question and answer, could please Mohamed make a GWT example of what you mean? Thanks! On 3 Dic, 05:54, Mohamed Mansour m0.interact...@gmail.com wrote: When I mean decorator, I meant to follow the decorator pattern:http://en.wikipedia.org/wiki/Decorator_pattern On Dec 2, 11:53 pm, Mohamed Mansour m0.interact...@gmail.com wrote: Why wont you implement a decorator interface that will decorate your RPC calls? That way you can always hide/show your spinner icon for each call without affecting your RPC code. On Dec 2, 9:39 pm, tin tin.pavli...@gmail.com wrote: Hi everyone, I have a GWT application that uses RPC calls heavily. I would like to display a spinner icon whenever a call is in progress. It is easy enough to display the icon, but I want to do it seamlessly in one place so I don't have to explicitly hide and show the icon for each call. I guess I am looking for something similar to jQuery's ajaxStart and ajaxStop events. Has anyone done something like this before? Cheers, Tin -- 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-tool...@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.
Is it possible to seamlessly display an ajax spinner for every GWT RPC call?
Hi everyone, I have a GWT application that uses RPC calls heavily. I would like to display a spinner icon whenever a call is in progress. It is easy enough to display the icon, but I want to do it seamlessly in one place so I don't have to explicitly hide and show the icon for each call. I guess I am looking for something similar to jQuery's ajaxStart and ajaxStop events. Has anyone done something like this before? Cheers, Tin -- 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-tool...@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.
Usage Scenario
Hi All I am planning to use GWT in an already existing HTML GUI. I would request the group to point me to best practices for using GWT in this manner. Basically I am trying to make use of my existing MVC application and want to add the AJAX functionality to my existing HTML widgets using GWT. I will be doing no or very little markup in GWT and will mainly be accessing my HTML widgets using their IDs. Regards N --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Facing a Problem with tomcat deployment
Hi group I am getting this exception when any RPC call is being made. I am not getting this when I am running the app in the hosted mode and web mode when running inside Eclipse. But when I deploy the war file in Tomcat, I start facing this problem. Please help. Regards Nitin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
user/src/com/google/gwt/user/client/ui/Frame.java refers to FrameElement instead of IFrameElement. Is this a bad idea?
Hi everyone, I am writing some code to try and test some of the behaviour of GWT widgets inside plain old JUnit tests, as opposed to GWTTestCase. One thing I have come across is the following: The Frame class is a wrapper for the IFRAME element, but it uses the following code: public String getUrl() { return getFrameElement().getSrc(); } public void setUrl(String url) { getFrameElement().setSrc(url); } private FrameElement getFrameElement() { return getElement().cast(); } Yet, FrameElement represents a FRAME tag, not an IFRAME tag. In javascript, this all works without a hitch because we can freely cast between different element types, but it is still somewhat untidy and misleading. I would suggest that it is changed to: public String getUrl() { return getIFrameElement().getSrc(); } public void setUrl(String url) { getIFrameElement().setSrc(url); } private IFrameElement getIFrameElement() { return getElement().cast(); } Any thoughts or comments would be appreciated. Cheers Tin --~--~-~--~~~---~--~~ 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: Hooking a GWT event onto an element in an external iframe
Hi Mat, Thanks for your reply. That was really helpful. Tin On Jul 20, 2:11 pm, Mat Gessel mat.ges...@gmail.com wrote: HiTin, There is a potential for memory leaks via event listeners due to cyclical references between DOM and JS. To avoid this, GWT manages the event listeners via the Widget lifecycle. When the widget is attached to the DOM (i.e. it or it's ancestor is attached to a RootPanel) the widget's event listener is initialized. When the widget is detached (or the page is unloaded) the event listener is cleaned up. You can see the code in Widget.onAttach() and Widget.onDetach(). I'd say it is erroneous to use Widget outside of the normal Widget containment hierarchy. Instead, we can set an event listener directly: DOM.setEventListener(buttonElement, new EventListener() { // you will only get the events you sink void onBrowserEvent(Event event) { // references in this method can result in a memory leak Window.alert(GWT-hacky-clicked!); } }); // connect the foreign element to the GWT event dispatcher DOM.sinkEvents(buttonElement, Event.ONCLICK); Also consider adding a Window CloseHandler to prevent the memory leak. Window.addCloseHandler(new CloseHandlerWindow() { public void onClose(CloseEventWindow event) { DOM.setEventListener(buttonElement, null); } }); You can also look at HandlerManager and DomEvent.fireNativeEvent() to see how to translate Event into a ClickEvent, but IMO that is overkill. -= Mat On Thu, Jul 16, 2009 at 4:27 PM,tintin.pavli...@gmail.com wrote: I am writing a GWT app that involves interacting with an external document in an iframe. As a proof of concept, I am trying to attach a click handler to a button. The following works in javascript var iframe = document.getElementById(rawJSIFrame); var doc = iframe.contentDocument; var body = doc.body; var button = doc.getElementsByTagName(input).namedItem(submit); button.onclick = function() { alert(Clicked!); }; Trying to do the equivalent in GWT, I did the following: public void addClickHandlerToSubmitButton(String buttonElementName, ClickHandler clickHandler) { IFrameElement iframe = IFrameElement.as(frame.getElement()); Document frameDocument = getIFrameDocument(iframe); if (frameDocument != null) { Element buttonElement = finder(frameDocument).tag(input).name (buttonElementName).findOne(); ElementWrapper wrapper = new ElementWrapper(buttonElement); HandlerRegistration handlerRegistration = wrapper.addClickHandler(clickHandler); } } private native Document getIFrameDocument(IFrameElement iframe)/*-{ return iframe.contentDocument; }-*/; The following is the ElementWrapper class: public class ElementWrapper extends Widget implements HasClickHandlers { public ElementWrapper(Element theElement) { setElement(theElement); } public HandlerRegistration addClickHandler(ClickHandler handler) { return addDomHandler(handler, ClickEvent.getType()); } } The code to find the button works fine but the actual click event handler is not getting invoked. Has anybody had a similar issue before, and how did you resolve 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 -~--~~~~--~~--~--~---
Hooking a GWT event onto an element in an external iframe
Hi everyone, I am writing a GWT app that involves interacting with an external document in an iframe. As a proof of concept, I am trying to attach a click handler to a button. The following works in javascript var iframe = document.getElementById(rawJSIFrame); var doc = iframe.contentDocument; var body = doc.body; var button = doc.getElementsByTagName(input).namedItem(submit); button.onclick = function() { alert(Clicked!); }; Trying to do the equivalent in GWT, I did the following: public void addClickHandlerToSubmitButton(String buttonElementName, ClickHandler clickHandler) { IFrameElement iframe = IFrameElement.as(frame.getElement()); Document frameDocument = getIFrameDocument(iframe); if (frameDocument != null) { Element buttonElement = finder(frameDocument).tag(input).name (buttonElementName).findOne(); ElementWrapper wrapper = new ElementWrapper(buttonElement); HandlerRegistration handlerRegistration = wrapper.addClickHandler(clickHandler); } } private native Document getIFrameDocument(IFrameElement iframe)/*-{ return iframe.contentDocument; }-*/; The following is the ElementWrapper class: public class ElementWrapper extends Widget implements HasClickHandlers { public ElementWrapper(Element theElement) { setElement(theElement); } public HandlerRegistration addClickHandler(ClickHandler handler) { return addDomHandler(handler, ClickEvent.getType()); } } The code to find the button works fine but the actual click event handler is not getting invoked. Has anybody had a similar issue before, and how did you resolve it? Thanks in advance, Tin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Getting java.net.SocketTimeoutException: Read timed out
Hi All, I occassionally get this exception when my app's page is getting downloaded in the broser. In my application, I make few rpc calls to fetch the data once the JSP is downloaded by the browser. Any help in this will greatly be appreciated. No concrete answer could be found for this on the internet but it seeems others have faced this problem too. Stack Trace: java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(Unknown Source) at org.apache.coyote.http11.InternalInputBuffer.fill (InternalInputBuffer.java:747) at org.apache.coyote.http11.InternalInputBuffer $InputStreamInputBuffer.doRead(InternalInputBuffer.java:777) at org.apache.coyote.http11.filters.IdentityInputFilter.doRead (IdentityInputFilter.java:115) at org.apache.coyote.http11.InternalInputBuffer.doRead (InternalInputBuffer.java:712) at org.apache.coyote.Request.doRead(Request.java:427) at org.apache.catalina.connector.InputBuffer.realReadBytes (InputBuffer.java:283) at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:379) at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java: 298) at org.apache.catalina.connector.CoyoteInputStream.read (CoyoteInputStream.java:180) at com.google.gwt.user.server.rpc.RPCServletUtils.readContentAsUtf8 (RPCServletUtils.java:146) at com.google.gwt.user.server.rpc.RemoteServiceServlet.readContent (RemoteServiceServlet.java:335) at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost (RemoteServiceServlet.java:77) at org.gwtwidgets.server.spring.GWTSpringController.handleRequest (GWTSpringController.java:82) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle (SimpleControllerHandlerAdapter.java:48) at org.springframework.web.servlet.DispatcherServlet.doDispatch (DispatcherServlet.java:875) at org.springframework.web.servlet.DispatcherServlet.doService (DispatcherServlet.java:809) at org.springframework.web.servlet.FrameworkServlet.processRequest (FrameworkServlet.java:523) at org.springframework.web.servlet.FrameworkServlet.doPost (FrameworkServlet.java:463) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) --~--~-~--~~~---~--~~ 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: redirect problem
Hi, I am also facing the same issue. In my case, I have also used Acegi Security to implement authorization. If session times out then in this case, Authorization filters of the acegi will not work control will not be able to reach the GWT Handler. In this case, however, exception would still be thrown. So what alternatives do I have in this case? One that comes to mind is that I can leave authorization rules on the GWT services as these services shall be accessed by someone who has got access to the web page in first case. So no authorization for RPC based services. If there is any authentication error, then the control would reach GWT handler and the aspects can catch them, marshall them and send them back to GWT client. Comments? Regards, Nitin On Oct 2, 12:25 pm, falafala [EMAIL PROTECTED] wrote: The gwt client cannot interpret the redirect or invalid response (hence invocation exception). I do it this way... I use GWT server library so I can implement the service as POJO in Spring container and published as gwt service. I cannot use servlet filter bcoz it cannot handle the marshaling of the response. It should be behind the GWT rpc servlet. So I intercept the call to POJO service using Spring aop and check the session there, and throw session expired exception. The SessionExpiredException can also include the URL to be redirected. This can be marshaled and sent back to the gwt client. On the client side, you can catch the SessionExpiredException in the AsyncCallback handler and call the Javascript to do the redirect. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
CSV Parsing best strategy
Hi All, I need to have a CSV import functionality in my application. User can give CSV files to the web client and then the server is supposed to understand its contents and persist the data. What would be the best approach to handle this? - I upload the CSV file from the web client and use a library to parse its contents on the server - I parse the CSV on the web client itself and then pass the data to the server (using RPC or JSON) Any examples or pointers to best approaches to handle this problem willl be highly appreciated. Thankx Regards, Nitin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---