Re: GWT best Practices - JS Library Wrappers Overlay Types
In that case i'll leave it as a single module. The cookie insert approach to getting around authentication ended up in a little headache because i forgot that GData requires an image to be present on the page (loaded from the same domain as the page). So, after forcing the cookie, the jUnit test case was acting as if logged on but was failing when i called any service, because no image was present. No error was being thrown in jUnit so i was in the dark for a while, but after some fiddling i got it. What a relief! I registered gwt.gd...@gmail.com and successfully got a jUnit test case to grab events grom GData calendar for that account. Now it's a matter of doing the same thing for the other services. Bobby On Jun 7, 7:20 am, Eric Ayers zun...@google.com wrote: Sounds like you are making good progress. On Sat, Jun 6, 2009 at 10:45 PM, Bobby bobbysoa...@gmail.com wrote: The GoogleAccounts module is working well and is pretty close to what it needs to be: http://code.google.com/p/gwt-gdata/source/browse/trunk/gdata/src/com/... I was able to create jUnit test cases that impersonate user authentication - the GData JS API AuthSub implementation performs authentication by redirecting to a Google Accounts page, performing auth and then redirecting back to the referring URL, passing along a session token which gets stored in a cookie. To make the authentication work i am setting the cookie directly which has the same effect but allows the jUnit tests to work smoothly: http://code.google.com/p/gwt-gdata/source/browse/trunk/gdata/test/com... Now i can write unit tests for the services which read/write data with a test account. I'm debating whether i should split the GWT-Gdata module into multiple sub modules. For example, instead of having one large GWT module at com.google.gwt.gdata, have com.google.gwt.gdata be a base module inherited by specialized modules such as: com.google.gwt.gdata.calendar com.google.gwt.gdata.blogger com.google.gwt.gdata.contacts com.google.gwt.gdata.finance ...etc The reason is that, from my experience, you end up using GData to interact with either Calendar or Documents for example, rather than all of the GData systems, so it seems more natural to have a module per GData system. In the Gears API, we ran into a similar issue. Should we break out the Gears components into separate modules? In that case we decided that it was a burden on the user to have to find and import the correct module. GWT does dead code stripping, so there is no penalty at runtime for including parts of the API you don't use. We put everything under one com.google.gwt.gears.client package in the end. In the GData case, I could see that developers are less likely to use features from across multiple packages, so I could go either way, but as far as runtime performance goes, there is no difference either way. As far as convenience goes, having everything under one module makes the setting up of your project's module easier. Bobby On May 30, 10:21 pm, Bobby bobbysoa...@gmail.com wrote: I eliminated the Date errors by making use of a DateHelper:http://code.google.com/p/gwt-gdata/source/browse/trunk/gdata/src/com/... Here's how i'm using it:http://code.google.com/p/gwt-gdata/source/browse/trunk/gdata/src/com/... I convert Dates to milliseconds since 1970 before passing them between Java and JS. Bobby On May 30, 5:04 pm, Eric Ayers zun...@google.com wrote: I don't think GWT does anything useful when you pass a Java Date object into JSNI. You may want to pass the # of milliseconds since 1970 instead. On Sat, May 30, 2009 at 2:03 AM, Bobby bobbysoa...@gmail.com wrote: I'm seeing some weird behavior whenever java.util.Date is used. The following DateTime class in GData wraps around a date: http://code.google.com/p/gwt-gdata/source/browse/trunk/gdata/src/com/... The newInstance method receives a java.util.Date.: public static native DateTime newInstance(Date date, boolean dateOnly) /*-{ return new $wnd.google.gdata.DateTime( date, dateOnly ); }-*/; Whenever i call this method it fails. If i replace it with the following, then it works: public static native DateTime newInstance(Date date, boolean dateOnly) /*-{ return new $wnd.google.gdata.DateTime( new Date(), //pass static JS date instead dateOnly ); }-*/; So the date object passed in from Java causes a failure whereas a regular JS date doesn't. I looked at the Date parameter passed in from Java and it looked like a regular JS date - when printed, a regular date string is displayed. In web mode jUnit hangs on newInstance(new Date(), true/false) because a JS exception occurs. In hosted mode the following exception is thrown: [WARN] Malformed JSNI reference 'getFullYear'; expect
Re: Run javascript functions from Java String
Thanks I didn't thought of just doing an eval. That does the job. Ganael On Wed, Jun 10, 2009 at 6:49 PM, Ian Bambury ianbamb...@gmail.com wrote: Create a jsni method which takes a string and just does an 'eval' - as long as you are sure that the JS is safe Ian http://examples.roughian.com 2009/6/10 Ganaga ganael.jatt...@gmail.com Hello, I have a Java object (client side) that contains a snippet of Javascript. Example: String s = window.alert(); Is there a way to execute the content of that String ? I mean is there a way to generate Javascript code on the fly ? Thanks Ganael --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
using gwt dto and can skip async class
can anyone explain more how when using dto to serialized object , one can skip using aync class when using service? --~--~-~--~~~---~--~~ 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: Using Filters
Anyone have any idea about this or know where I can look/read to find out more? I'm totally at a loss here. It looks like there are a bunch of interesting methods for the ServletRequest class but HttpServletRequest doesn't have much I can do with it. On Jun 10, 3:31 pm, eags eagsala...@gmail.com wrote: I'd like to use Filter to implement all my security checks as a gateway to each gwt rpc call. I'm going to include a sessionID from the client as an argument to each RPC call. I'd like my filter in doFilter to be able to pull off that argument and check if the user is logged in and see what their role is. In the example's I've seen, when implementing the doFilter() method it isn't clear how I can get that argument off the request. I looked at the methods for HttpServletRequest and didn't say anything useful. Also, once I have the request I'd like to be able to check if the role is appropriate for the method being invoked but it isn't clear to me how I can do this either without having groups of methods for each role and a specific filter that checks the specific role for each group. Maybe not a bad idea I guess. I've seen other slicker stuff using annotations that maybe the Filter could access the value of to compare the user's role with the annotated required role for the called method? Any info would be good here. In either case I would just throw an AuthenticationException right there and let the client handle it in the AsyncCallback's onFail(). Thanks for any help. --~--~-~--~~~---~--~~ 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: Using Filters
Hi, You can take a look at http://code.google.com/p/net-orcades-spring/source/browse/trunk/orcades-spring-gwt/src/main/java/net/orcades/spring/gwt/component/GWTPayloadHelper.java And see how it's not so difficult to unmarshall the GWT RPC request. This code works for GWT 1.5 but is not optimal in the sense that I had to CutAndPaste some internal GWT code. HIH On Thu, Jun 11, 2009 at 9:48 AM, eags eagsala...@gmail.com wrote: Anyone have any idea about this or know where I can look/read to find out more? I'm totally at a loss here. It looks like there are a bunch of interesting methods for the ServletRequest class but HttpServletRequest doesn't have much I can do with it. On Jun 10, 3:31 pm, eags eagsala...@gmail.com wrote: I'd like to use Filter to implement all my security checks as a gateway to each gwt rpc call. I'm going to include a sessionID from the client as an argument to each RPC call. I'd like my filter in doFilter to be able to pull off that argument and check if the user is logged in and see what their role is. In the example's I've seen, when implementing the doFilter() method it isn't clear how I can get that argument off the request. I looked at the methods for HttpServletRequest and didn't say anything useful. Also, once I have the request I'd like to be able to check if the role is appropriate for the method being invoked but it isn't clear to me how I can do this either without having groups of methods for each role and a specific filter that checks the specific role for each group. Maybe not a bad idea I guess. I've seen other slicker stuff using annotations that maybe the Filter could access the value of to compare the user's role with the annotated required role for the called method? Any info would be good here. In either case I would just throw an AuthenticationException right there and let the client handle it in the AsyncCallback's onFail(). Thanks for any help. -- “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” Sir Charles Anthony Richard Hoare --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Where to put static content?
On http://code.google.com/intl/sv/webtoolkit/doc/1.6/DevGuideOrganizingProjects.html we can read the following about static content, specifically in the example an image called logo.gif An image file available to the application code. You might load this file programmatically using this URL: GWT.getModuleBaseURL() + logo.gif. I have a project called ArrivalJournal which I´m building in Eclipse. I´m running Jboss 4.2.2 on localhost for web server. Calling GWT.getModuleBaseURL() returns http://localhost:8080/ ArrivalJournal/arrivaljournal/ But if I put any content what so ever inside my war\arrivaljournal direcory, it gets deleted when I compile my project. What to do? --~--~-~--~~~---~--~~ 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: Where to put static content?
On 11 juin, 10:02, Dalla dalla_man...@hotmail.com wrote: Onhttp://code.google.com/intl/sv/webtoolkit/doc/1.6/DevGuideOrganizingP... we can read the following about static content, specifically in the example an image called logo.gif An image file available to the application code. You might load this file programmatically using this URL: GWT.getModuleBaseURL() + logo.gif. I have a project called ArrivalJournal which I´m building in Eclipse. I´m running Jboss 4.2.2 on localhost for web server. Calling GWT.getModuleBaseURL() returns http://localhost:8080/ ArrivalJournal/arrivaljournal/ But if I put any content what so ever inside my war\arrivaljournal direcory, it gets deleted when I compile my project. What to do? You have two places where to put your static content: - in the output folder (war); use GWT.getHostPageBaseURL() as a prefix (or eventually no prefix at all, but I think using the host page base URL is safer...) - in the public subpackage of your module (where the name public can be overriden if you want); everything in there will be copied into war/arrivaljournal, so you should use GWT.getModuleBaseURL() as a prefix (in case you change the name of your module or its rename-to, you won't have to change your code). The advantage of public is that your resources are tied to your module; and if its a reusable module (rather than a full-fledge application for instance), you'll bring your resource with it with a simple inherits (that's what the themes in GWT do) --~--~-~--~~~---~--~~ 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: Question about SuggestBox.wrap
On 11 juin, 00:38, Ben benzhe...@gmail.com wrote: I have a text box insides a FlexTable and I am trying to use SuggestBox.wrap to wrap the text box into a SuggestBox. Code snippet is like this. . FlexTable ft = new FlexTable(); TextBox tb = new TextBox(); ft.setWidget(0,0,tb); MultiWordSuggestOracle oracle = new MultiWordSuggestOracle(); suggest = SuggestBox.wrap(oracle, tb.getElement()); . But it throws error in hosted mode like this: java.lang.AssertionError: A widget that has an existing parent widget may not be added to the detach list at com.google.gwt.user.client.ui.RootPanel.detachOnWindowClose (RootPanel.java:122) at com.google.gwt.user.client.ui.SuggestBox.wrap(SuggestBox.java: 267)... But it does not have this problem when you compile it and run it in browsers. I look into the source code of SuggestBox, it throws error in this line. 266 suggestBox.onAttach(); 267 RootPanel.detachOnWindowClose(suggestBox); What is the problem? Is there a way to solve it? Do not use wrap(), use the ctor instead. FlexTable ft = new FlexTable(); TextBox tb = new TextBox(); MultiWordSuggestOracle oracle = new MultiWordSuggestOracle(); suggest = new SuggestBox(oracle, tb); ft.setWidget(0,0,suggest); --~--~-~--~~~---~--~~ 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: Is it possible to call the GWT Service outside the entry point?
As long as you're obiding by the rules of GWT client-side handling, you can call anywhere you'd like within the client package. It looks like your experience a rendering versus service calling effect. I would review the documentations on best practices for creating a GWT Application with RPC's. Something in the logic isn't accurate, but your question over RPC calling is fine as long as it remains within the client domain. Good luck. On Wed, Jun 10, 2009 at 10:08 PM, retha pasalli re...@wacana-inti.comwrote: Hi everybody... I want to know whether I can call the AsyncCallback outside the entry point. I have tried to create a class named UserServiceCall to call all service to retrieve and insert/edit/delete User data. The class contain the code to call the service (AsyncCallback object with onFailure() and onSuccess process). Then I keep the result object in the attribute of that class. In entry point, I create an object of UserServiceCall class and call the service caller method and get the object by the attribute getter method of UserServiceCall class. But when I run the project, it shows me nothing in the html page. Can you help with this problem? Thx before... Regards, Retha --~--~-~--~~~---~--~~ 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: Server initialization
where you define your servlet in web.xml add load-on-startup1/load- on-startup servlet servlet-nameMyAppServiceImpl/servlet-name servlet-classmy.package.app.MyAppServiceImpl/servlet-class load-on-startup1/load-on-startup /servlet On Jun 10, 6:29 pm, Jamie jamiesharbor-sou...@yahoo.com wrote: You might try using the servlet configuration 'load-on-startup' setting in your web.xml servlet definition. You could also define your own base class and derive your servlets from that so you at least have the code in one place... Jamie. --- Search for analog and digital television broadcast antennas in your area:http://www.antennamap.com/ --~--~-~--~~~---~--~~ 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: ImageBundle reuse images
On 10 juin, 23:44, mrpantsuit kevin.peter.w...@gmail.com wrote: This might be a stupid question, but can I use the same Image created from an ImageBundle in multiple places on my page? I guess the more general question is can I use the same Image in multiple places in my page. I assume so. Image is a widget, so you can't reuse the same Image object (it'll be automatically removed from where it was before being added). But you can of course reuse the AbstractImagePrototype and call getImage() each time you need the Image. ...or you could use getHTML() and reuse it at will with setHTML on the appropriate widgets (not being an Image widget, you won't have event handlers though) --~--~-~--~~~---~--~~ 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: Server initialization
Personally I would say use a ServletContextListener if the structures you are creating will be shared by several of your Servlets. That way the init is finished before any of your Servlets are created. Load-on-startup always feels like a bit of a hack to me ;) Just my 2c Steve wrote: where you define your servlet in web.xml add load-on-startup1/load- on-startup servlet servlet-nameMyAppServiceImpl/servlet-name servlet-classmy.package.app.MyAppServiceImpl/servlet-class load-on-startup1/load-on-startup /servlet On Jun 10, 6:29 pm, Jamie jamiesharbor-sou...@yahoo.com wrote: You might try using the servlet configuration 'load-on-startup' setting in your web.xml servlet definition. You could also define your own base class and derive your servlets from that so you at least have the code in one place... Jamie. --- Search for analog and digital television broadcast antennas in your area:http://www.antennamap.com/ --~--~-~--~~~---~--~~ 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: GWT Support for other browsers
On 10 juin, 19:24, Jeff Chimene jchim...@gmail.com wrote: If you can't get the browser to send an alternate ident string, you might try hacking the *.nocache.js to handle the Galio browser ident string and instead reply with either the IE or Firefox branch to the client. Compile your GWT code as PRETTY to get code that's easier to understand. It's far easier to override the property-provider name=user.agent: copy it from UserAgent.gwt.xml (within gwt- user.jar) into your own *.gwt.xml and tweak it so that Galio is identified as another supported browser. --~--~-~--~~~---~--~~ 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: Where to put static content?
Oh... guess you just create a folder rather than a package for the resources... On 11 Juni, 11:23, Dalla dalla_man...@hotmail.com wrote: So if I get you right, I should have com/example/app/arrivaljournal/client, Sub-package containing all the client-side source code. com/example/app/arrivaljournal/server, Sub-package containing all the server-side source code com/example/app/arrivaljournal/public, Static resources But in Eclipse, when I try to create com/example/app/arrivaljournal/ public I get : 'public' is not a vaild java identifier Is that just an Eclipse bug then? On 11 Juni, 10:44, Thomas Broyer t.bro...@gmail.com wrote: On 11 juin, 10:02, Dalla dalla_man...@hotmail.com wrote: Onhttp://code.google.com/intl/sv/webtoolkit/doc/1.6/DevGuideOrganizingP... we can read the following about static content, specifically in the example an image called logo.gif An image file available to the application code. You might load this file programmatically using this URL: GWT.getModuleBaseURL() + logo.gif. I have a project called ArrivalJournal which I´m building in Eclipse. I´m running Jboss 4.2.2 on localhost for web server. Calling GWT.getModuleBaseURL() returns http://localhost:8080/ ArrivalJournal/arrivaljournal/ But if I put any content what so ever inside my war\arrivaljournal direcory, it gets deleted when I compile my project. What to do? You have two places where to put your static content: - in the output folder (war); use GWT.getHostPageBaseURL() as a prefix (or eventually no prefix at all, but I think using the host page base URL is safer...) - in the public subpackage of your module (where the name public can be overriden if you want); everything in there will be copied into war/arrivaljournal, so you should use GWT.getModuleBaseURL() as a prefix (in case you change the name of your module or its rename-to, you won't have to change your code). The advantage of public is that your resources are tied to your module; and if its a reusable module (rather than a full-fledge application for instance), you'll bring your resource with it with a simple inherits (that's what the themes in GWT do)- Dölj citerad text - - Visa citerad text -- Dölj citerad text - - Visa citerad text - --~--~-~--~~~---~--~~ 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: Possible to insert a widget into the DOM?
Hi, Widgets are added to widgets, elements are added to elements. If you want to put a widget into the dom, I'd use a RootPanel, since it will take care of the unloading that is needed: p = RootPanel.get(currentElement.getId()); p.add(someWidget); if currentElement doesn't have an Id, you could use currentElement.setId(DOM.createUniqueId()); to set one. Note that these are Elements, not Nodes; not every node is an element, and not every node is allowed to have children (which is probably why the appendChild fails, but without more information then an exception it is hard to be sure). Gert On Jun 10, 11:51 pm, peterk peter.ke...@gmail.com wrote: Hey Jason, Thanks for your reply! I'm afraid I'm still running into problems here. First, even just trying to insert an element. I have this code: SpanElement test_element = Document.get().createSpanElement(); test_element.setInnerText(Hello there); currentNode.appendChild(test_element); currentNode is of type Node. This compiles OK, but at run time I get an exception on the appendChild call. How can I add or append an element to a node like this? Secondly..I can't seem to find any wrap method in the Widget class? Any further insight would be greatly appreciated..thanks so much! On Jun 10, 8:41 pm, Jason Essington jason.essing...@gmail.com wrote: Probably the safest thing to do would be to insert an element, then use the widget's .wrap() method to promote that element to a widget. there are other ways, but they are prone to leaking memory. -jason On Jun 10, 2009, at 1:36 PM, peterk wrote: Hey all, I'm walking the DOM tree and would like to append a Widget to certain nodes where certain conditions are met, but I'm not having much success. appendChild expects a Node as its parameter, so I can't just append a type of Widget. It will accept Widget.getElement() as a parameter, but this leads to runtime errors. Is it possible to mix Widgets with the DOM like this or is the only way to add Widgets to a page via the RootPanel.get() ..? If so is there a way to add Widgets to the page based on a desired position in the DOM? I'd like to use a custom widget I've made, having everything wrapped neatly in a class, and not have to revert to lower level stuff.. Thanks for any help :) --~--~-~--~~~---~--~~ 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: Possible to insert a widget into the DOM?
Hey Gert, Thanks for the reply! I realised my problem with appending an Element..I was trying to append it to a TextNode which I think isn't allowed. So I've sorted that, I append to the text node's Parent now. On adding Widgets to a certain point in the DOM..this seems to work for me: I create the Widget, and add it to RootPanel. Then, I get its element and append that to the appropriate Node. This moves the widget to the correct place in the DOM, and at first glance I get the behaviours I would expect (e.g. the Widget's clicklisteners work etc.). Is it safe to do things this way or are there other 'gotchas' I should be aware of, when manipulating the position of a Widget's element in the page? Thanks again for all your help! On Jun 11, 10:48 am, gscholt gsch...@gmail.com wrote: Hi, Widgets are added to widgets, elements are added to elements. If you want to put a widget into the dom, I'd use a RootPanel, since it will take care of the unloading that is needed: p = RootPanel.get(currentElement.getId()); p.add(someWidget); if currentElement doesn't have an Id, you could use currentElement.setId(DOM.createUniqueId()); to set one. Note that these are Elements, not Nodes; not every node is an element, and not every node is allowed to have children (which is probably why the appendChild fails, but without more information then an exception it is hard to be sure). Gert On Jun 10, 11:51 pm, peterk peter.ke...@gmail.com wrote: Hey Jason, Thanks for your reply! I'm afraid I'm still running into problems here. First, even just trying to insert an element. I have this code: SpanElement test_element = Document.get().createSpanElement(); test_element.setInnerText(Hello there); currentNode.appendChild(test_element); currentNode is of type Node. This compiles OK, but at run time I get an exception on the appendChild call. How can I add or append an element to a node like this? Secondly..I can't seem to find any wrap method in the Widget class? Any further insight would be greatly appreciated..thanks so much! On Jun 10, 8:41 pm, Jason Essington jason.essing...@gmail.com wrote: Probably the safest thing to do would be to insert an element, then use the widget's .wrap() method to promote that element to a widget. there are other ways, but they are prone to leaking memory. -jason On Jun 10, 2009, at 1:36 PM, peterk wrote: Hey all, I'm walking the DOM tree and would like to append a Widget to certain nodes where certain conditions are met, but I'm not having much success. appendChild expects a Node as its parameter, so I can't just append a type of Widget. It will accept Widget.getElement() as a parameter, but this leads to runtime errors. Is it possible to mix Widgets with the DOM like this or is the only way to add Widgets to a page via the RootPanel.get() ..? If so is there a way to add Widgets to the page based on a desired position in the DOM? I'd like to use a custom widget I've made, having everything wrapped neatly in a class, and not have to revert to lower level stuff.. Thanks for any help :)- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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: Is it possible to call the GWT Service outside the entry point?
Hi Mr. Kushner, Thx for your reply. I've tried to call the service from a class extending Composite class. And it works! But I still can't find why it doesn't work when I call it in class extending nothing. But that's not an urgent problem for me for a while. Hehehe.. Once more thx... Regards, Retha --~--~-~--~~~---~--~~ 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: Server initialization
Yup. That does the ticket! Here's the code if anyone's interested... The listener... package com.inexas.test.server; import javax.servlet.*; public class AppStarter implements ServletContextListener { public void contextInitialized(ServletContextEvent event) { ServletContext sc = event.getServletContext(); System.out.println(sc.getServerInfo()) ; } public void contextDestroyed(ServletContextEvent event) { System.out.println(Bye!); } } In the web.xml file... web-app listener listener-class com.inexas.test.server.AppStarter /listener-class /listener ... On Jun 11, 2009, at 11:21 AM, Jason Morris wrote: Personally I would say use a ServletContextListener if the structures you are creating will be shared by several of your Servlets. That way the init is finished before any of your Servlets are created. Load-on-startup always feels like a bit of a hack to me ;) Just my 2c --~--~-~--~~~---~--~~ 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: LoginSecurityFAQ and sessionID/tokens
If you store the session ID in a cookie so that user logins can persist beyond browser refreshes (as suggested in the FAQ), then the session ID will end up in the header anyway. eags wrote: I am implementing user logins and authentication using the model presented in the login security FAQ. In particular I plan on manually maintaining a table of {sessionID,User,timeout} values for each active session and not using the normal servlet session functionality. So, my question is, where do I get the ID that is returned to the client? I know that I can get one from the servlet session using HttpServletRequest.getSession().getid() but it seems like I could just use any randomly generated key right? And maybe I if face should not use that technique because that sessionID is also in the header where it can be easily snooped right? So, what is a good technique for generating the sessionID? To avoid duplicates I would just check the sessionID table before returning the sessionID to the client and if it is already in use I just call generateSessionID() again. So my question is what should getSessionID() look like? I realize the recommended approach in the LoginSecurityFAQ is controversial and I've already read all that debate so I'm not really interested in more of that. I just need specific help regarding these questions assuming I am doing what is recommended in the FAQ. Thanks in advance for any help. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
This is pretty interesting...
Hi ! Your friend chhatrapal.sharma from , just invited you to his/her online photo albums and journals at Zorpia.com. So what is Zorpia? It is an online community that allows you to upload unlimited amount of photos, write journals and make friends. We also have a variety of skins in store for you so that you can customize your homepage freely. Join now for free! Please click the following link to join Zorpia: http://signup.zorpia.com/signup?invitation_key=200906af6eeda93b3c9f562eb817a2dbreferral=chhatrapalsharmatt=14hour=2009061107sub=13 This message was delivered with the chhatrapal.sharma's initiation. If you wish to discontinue receiving invitations from us, please click the following link: http://signup.zorpia.com/email/optout/Google-Web-Toolkit@googlegroups.com --~--~-~--~~~---~--~~ 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: Help with EventHandlers
I'm glad it works fine on your project. Saludos, Marcelo. On Jun 10, 6:43 pm, Iván López lopez.i...@gmail.com wrote: Thank you very much!. It works ok and now, with my code working I think I understand a little bit better how handlers works!. Muchas gracias compañero. Saludos, Ivá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 -~--~~~~--~~--~--~---
Re: Event handler for model ?
No clues anyone? On 10 Juni, 14:40, Dalla dalla_man...@hotmail.com wrote: Hi I´m having trouble understanding how to implement an event handler for my custom objects with the new event handler system. Let´s pretend I have a very simple model class like this one: public class ArrivalData { private Date date; private boolean processing = false; public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } } When setDate is called, I want to fire an event that my view components can listen on, and act on when called for. How would you go about doing that? Are there any existing handler interfaces that can be used? I found this tutorial (see link below), but it seems pretty complicated for what I´m trying to acheive.http://www.itsolut.com/chrismusings/2009/04/28/business-events-with-g... What´s best practice here? --~--~-~--~~~---~--~~ 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: no createDocumentFragment() in com.google.gwt.dom.client.Document
I'm running off trunk right now. There's no Document.createDocumentFragment() method either. Just wondering why that is. Could someone comment on issue 2955? -- http://code.google.com/p/google-web-toolkit/issues/detail?id=2955 The issue was created almost a year ago, but it's still in NEW status. (I just tried out OOPHM and it rocks! Thank you gwt team!) --~--~-~--~~~---~--~~ 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: This is pretty interesting...
If your friend (an invisible friend?) wants me on their list, why don't they ask me themselves? Preferably not via the GWT group. Ian http://examples.roughian.com 2009/6/11 chhatrapal.sharma chhatrapal.sha...@gmail.com Hi , I started using this and love it. If you use the link below you'll automatically be on my friend's list. http://signup.zorpia.com/signup?invitation_key=200906af6eeda93b3c9f562eb817a2dbreferral=chhatrapalsharmatt=14hour=2009061107sub=13 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Dialog Box Move Listener kind of thing
Hi, Is there any way by which I could know if my Dialog Box has moved? I mean at run time thru some listener or something? I am trying to find out the position of the Dialog Box when it has moved for which I need to know when it moved!!! regards, abhiram --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
gwt compiler... parameterized types with enums causing problems?
The following class appears to be legal java (eclipse accepts it ok) but it causes an internal error in the gwt compiler (java - javascript). Has anyone found a workaround to allow code like this to run? If you try to instantiate this class with public enum MyFormField { FIELD1, OTHER_FIELD; }; and then this declaration: public class MyFormErrorSet extends ErrorSetMyFormField { }; the compiler blows up with an internal error Thoughts? thanks ian smith package whatever.whatever; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public abstract class ErrorSetE extends EnumE { protected ListE errors = new ArrayListE(); public boolean hasNoErrors() { return errors.isEmpty(); } public E errorAtRow(int rowTarget) { IteratorE iter = errors.iterator(); while (iter.hasNext()) { E f = iter.next(); if (getRowForEnumItem(f) == rowTarget) { return f; } } return null; } public void add(E f) { if (errorAtRow(getRowForEnumItem(f)) != null) { return; } errors.add(f); } public int size() { return errors.size(); } public E get(int element) { return errors.get(element); } public abstract int getRowForEnumItem(E item); } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Gears Automatically generated Google Gears manifest and rpc files
Hello, I am currently developping an app using both GWT and GAE. I'd like this app to use Gears mostly to used offline and also to improve performance. Taking first steps with gwt-gears API I found quite convenient to have an automatically generated manifest for files needed to be downloaded. However I am using RPC and the Gears manifest generation includes the gwt.rpc files to the list of files to download. Unless I missed something, these files are useless to Gears localserver and over all the default configuration of App Engine doesn't allow to serve gwt.rpc files which results in a HTTP 404 error when trying to download them. I would like to know what solution could be found. I tried to let the rpc files being served which allowed Gears to dowload all the files listed in the manifest but I guess this would be quite unsecure to let this that way. Could we change the folder where the rpc files are generated ? I guess it is possible to make the manifest file manually but it seems to me it goes against a certain spirit of convenience GWT brought to me. Note that even with all files donwloaded I still have trouble in having my local server being able to serve. But this will be for later. Thanks for your interest. :) --~--~-~--~~~---~--~~ 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: Gears Automatically generated Google Gears manifest and rpc files
My thought on this is that we should modify the manifest generator to filter out these files, and also add a config option to allow users to specify files to exclude in case something else like this comes up - maybe through (yet another) annotation on the Gadget class? On Thu, Jun 11, 2009 at 5:19 AM, Tibotpou...@gmail.com wrote: Hello, I am currently developping an app using both GWT and GAE. I'd like this app to use Gears mostly to used offline and also to improve performance. Taking first steps with gwt-gears API I found quite convenient to have an automatically generated manifest for files needed to be downloaded. However I am using RPC and the Gears manifest generation includes the gwt.rpc files to the list of files to download. Unless I missed something, these files are useless to Gears localserver and over all the default configuration of App Engine doesn't allow to serve gwt.rpc files which results in a HTTP 404 error when trying to download them. I would like to know what solution could be found. I tried to let the rpc files being served which allowed Gears to dowload all the files listed in the manifest but I guess this would be quite unsecure to let this that way. Could we change the folder where the rpc files are generated ? I guess it is possible to make the manifest file manually but it seems to me it goes against a certain spirit of convenience GWT brought to me. Note that even with all files donwloaded I still have trouble in having my local server being able to serve. But this will be for later. Thanks for your interest. :) -- Eric Z. Ayers - GWT Team - Atlanta, GA USA http://code.google.com/webtoolkit/ --~--~-~--~~~---~--~~ 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: Unit testing GWT and App Engine in Eclipse
Thanks Jason. I thought it might be possible to do the round trip testing with app engine but this does not seem to be the case. Thanks for the code sample. /johan On Jun 10, 3:56 pm, Jason Parekh jasonpar...@gmail.com wrote: Hi Johan, I don't think there are any frameworks that can let you test a round-trip between the two. Instead, you'll likely want to test each side individually (seehttp://code.google.com/appengine/docs/java/howto/unittesting.htmlfor App Engine junit testing). If you're using the Eclipse plugin, I have a sample project that tests an App Engine project, seehttp://www.wuala.com/jasonparekh/Public/google/beingTested.zip/. Hope this helps, jason On Wed, Jun 10, 2009 at 8:10 AM, Johan Lundberg joe...@gmail.com wrote: Have been trying to make a unit test for my GWT and App Engine app but there is something I do wrong and I cannot find any documentation about this combination. http://code.google.com/webtoolkit/tutorials/1.6/appengine.htmlshows the relation between gwt and appengine but it doesn't explain how to set up the unit tests. http://code.google.com/webtoolkit/doc/1.6/DevGuideTesting.htmlis a great guide I have been using to make write my first tests, but it doesn't explain how I should invoke the local app engine server when making a unit test in hosted mode for my gwt app. Any suggestions or pointers to guides? /johan --~--~-~--~~~---~--~~ 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: Gears Automatically generated Google Gears manifest and rpc files
On Thu, Jun 11, 2009 at 9:43 AM, Eric Ayerszun...@google.com wrote: My thought on this is that we should modify the manifest generator to filter out these files, and also add a config option to allow users to specify files to exclude in case something else like this comes up - maybe through (yet another) annotation on the Gadget class? The gears linker should go ahead and exclude *.gwt.rpc* from being included in the manifest. Looking at upcoming changes for GWT 2.0, such as runAsync, the manifest linker is going to need to get smarter about generating multiple manifests, one for each permutation. -- Bob Vawter Google Web Toolkit Team --~--~-~--~~~---~--~~ 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: Gears Automatically generated Google Gears manifest and rpc files
It would be great :) ! I was saying at the end of my previous message that I still could get my local server to serve and I think I found why. I am also using GXT which needs its image folder to be in the war one. And looking at the generated manifest, it seems that files outside the projectname folder are not included in the list. So I am trying to do my own manifest by hand and to download all needed files including specific css and images. And I was thinking that some convenient methods to manually build the manifest would be awesome. For example, directly including an entire folder... I am going to try and write these. But for now I 'd like to get my local serve do what he is intended to. :) By the way, thanks for the quick reply. 2009/6/11 Eric Ayers zun...@google.com My thought on this is that we should modify the manifest generator to filter out these files, and also add a config option to allow users to specify files to exclude in case something else like this comes up - maybe through (yet another) annotation on the Gadget class? On Thu, Jun 11, 2009 at 5:19 AM, Tibotpou...@gmail.com wrote: Hello, I am currently developping an app using both GWT and GAE. I'd like this app to use Gears mostly to used offline and also to improve performance. Taking first steps with gwt-gears API I found quite convenient to have an automatically generated manifest for files needed to be downloaded. However I am using RPC and the Gears manifest generation includes the gwt.rpc files to the list of files to download. Unless I missed something, these files are useless to Gears localserver and over all the default configuration of App Engine doesn't allow to serve gwt.rpc files which results in a HTTP 404 error when trying to download them. I would like to know what solution could be found. I tried to let the rpc files being served which allowed Gears to dowload all the files listed in the manifest but I guess this would be quite unsecure to let this that way. Could we change the folder where the rpc files are generated ? I guess it is possible to make the manifest file manually but it seems to me it goes against a certain spirit of convenience GWT brought to me. Note that even with all files donwloaded I still have trouble in having my local server being able to serve. But this will be for later. Thanks for your interest. :) -- Eric Z. Ayers - GWT Team - Atlanta, GA USA http://code.google.com/webtoolkit/ --~--~-~--~~~---~--~~ 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: Gears Automatically generated Google Gears manifest and rpc files
I created an issue for the filtering problem: http://code.google.com/p/gwt-google-apis/issues/detail?id=280 Feel free to come over to the gwt-google-apis group and discuss a proposal for other changes to the gadget API that might help with the app you are building. -Eric. On Thu, Jun 11, 2009 at 9:56 AM, Thibault Pougettpou...@gmail.com wrote: It would be great :) ! I was saying at the end of my previous message that I still could get my local server to serve and I think I found why. I am also using GXT which needs its image folder to be in the war one. And looking at the generated manifest, it seems that files outside the projectname folder are not included in the list. So I am trying to do my own manifest by hand and to download all needed files including specific css and images. And I was thinking that some convenient methods to manually build the manifest would be awesome. For example, directly including an entire folder... I am going to try and write these. But for now I 'd like to get my local serve do what he is intended to. :) By the way, thanks for the quick reply. 2009/6/11 Eric Ayers zun...@google.com My thought on this is that we should modify the manifest generator to filter out these files, and also add a config option to allow users to specify files to exclude in case something else like this comes up - maybe through (yet another) annotation on the Gadget class? On Thu, Jun 11, 2009 at 5:19 AM, Tibotpou...@gmail.com wrote: Hello, I am currently developping an app using both GWT and GAE. I'd like this app to use Gears mostly to used offline and also to improve performance. Taking first steps with gwt-gears API I found quite convenient to have an automatically generated manifest for files needed to be downloaded. However I am using RPC and the Gears manifest generation includes the gwt.rpc files to the list of files to download. Unless I missed something, these files are useless to Gears localserver and over all the default configuration of App Engine doesn't allow to serve gwt.rpc files which results in a HTTP 404 error when trying to download them. I would like to know what solution could be found. I tried to let the rpc files being served which allowed Gears to dowload all the files listed in the manifest but I guess this would be quite unsecure to let this that way. Could we change the folder where the rpc files are generated ? I guess it is possible to make the manifest file manually but it seems to me it goes against a certain spirit of convenience GWT brought to me. Note that even with all files donwloaded I still have trouble in having my local server being able to serve. But this will be for later. Thanks for your interest. :) -- Eric Z. Ayers - GWT Team - Atlanta, GA USA http://code.google.com/webtoolkit/ -- Eric Z. Ayers - GWT Team - Atlanta, GA USA http://code.google.com/webtoolkit/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
eval() with ActiveXObject
Hi, i have a string that contain a javascript function. Within that function, there is a ActiveXObject(Microsoft.XMLDOM); object. When i pass that string to the eval function, i get an error automation server can't create object. I am using IE 6. Anyone have an idea ? --~--~-~--~~~---~--~~ 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: Return type of AsyncCallback methods
You can also have your async method return RequestBuilder which will not dispatch the RPC call, but rather returns the RequestBuilder already set up and ready to go. You can then make changes to it before making the call such as setting a timeout. Then you dispatch the RPC call which will return you the Request object you ask for above. RequestBuilder builder = service.myMethod(new AsyncCallback () {...}); builder.setTimeoutMillis(REQUEST_TIMEOUT); Request request = builder.send(); --~--~-~--~~~---~--~~ 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: ImageBundle reuse images
Images widgets at their core contain a DOM element and you can't have an element in two places at once. However the beauty of ImageBundle is that it caches that actual image so you don't incur additional bandwidth when you create multiple image widgets using the same image bundle. -jason On Jun 10, 2009, at 3:44 PM, mrpantsuit wrote: This might be a stupid question, but can I use the same Image created from an ImageBundle in multiple places on my page? I guess the more general question is can I use the same Image in multiple places in my page. I assume so. --~--~-~--~~~---~--~~ 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: ImageBundle reuse images
Awesome. Thanks guys. On Jun 11, 11:19 am, Jason Essington jason.essing...@gmail.com wrote: Images widgets at their core contain a DOM element and you can't have an element in two places at once. However the beauty of ImageBundle is that it caches that actual image so you don't incur additional bandwidth when you create multiple image widgets using the same image bundle. -jason On Jun 10, 2009, at 3:44 PM, mrpantsuit wrote: This might be a stupid question, but can I use the same Image created from an ImageBundle in multiple places on my page? I guess the more general question is can I use the same Image in multiple places in my page. I assume so. --~--~-~--~~~---~--~~ 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: Possible to insert a widget into the DOM?
You need to make sure that your node is an element. also .wrap() is not found in widget itself but rather in its subclasses (Label for instance) -jason On Jun 10, 2009, at 3:51 PM, peterk wrote: Hey Jason, Thanks for your reply! I'm afraid I'm still running into problems here. First, even just trying to insert an element. I have this code: SpanElement test_element = Document.get().createSpanElement(); test_element.setInnerText(Hello there); currentNode.appendChild(test_element); currentNode is of type Node. This compiles OK, but at run time I get an exception on the appendChild call. How can I add or append an element to a node like this? Secondly..I can't seem to find any wrap method in the Widget class? Any further insight would be greatly appreciated..thanks so much! On Jun 10, 8:41 pm, Jason Essington jason.essing...@gmail.com wrote: Probably the safest thing to do would be to insert an element, then use the widget's .wrap() method to promote that element to a widget. there are other ways, but they are prone to leaking memory. -jason On Jun 10, 2009, at 1:36 PM, peterk wrote: Hey all, I'm walking the DOM tree and would like to append a Widget to certain nodes where certain conditions are met, but I'm not having much success. appendChild expects a Node as its parameter, so I can't just append a type of Widget. It will accept Widget.getElement() as a parameter, but this leads to runtime errors. Is it possible to mix Widgets with the DOM like this or is the only way to add Widgets to a page via the RootPanel.get() ..? If so is there a way to add Widgets to the page based on a desired position in the DOM? I'd like to use a custom widget I've made, having everything wrapped neatly in a class, and not have to revert to lower level stuff.. Thanks for any help :) --~--~-~--~~~---~--~~ 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: Is it possible to call the GWT Service outside the entry point?
perhaps this little discussion would be of some help: http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/faca1575f306ba0f/3be719c021aa19bd -jason On Jun 11, 2009, at 4:05 AM, retha pasalli wrote: Hi Mr. Kushner, Thx for your reply. I've tried to call the service from a class extending Composite class. And it works! But I still can't find why it doesn't work when I call it in class extending nothing. But that's not an urgent problem for me for a while. Hehehe.. Once more thx... Regards, Retha --~--~-~--~~~---~--~~ 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: GWT Support for other browsers
On Thu, Jun 11, 2009 at 2:21 AM, Thomas Broyert.bro...@gmail.com wrote: On 10 juin, 19:24, Jeff Chimene jchim...@gmail.com wrote: If you can't get the browser to send an alternate ident string, you might try hacking the *.nocache.js to handle the Galio browser ident string and instead reply with either the IE or Firefox branch to the client. Compile your GWT code as PRETTY to get code that's easier to understand. It's far easier to override the property-provider name=user.agent: copy it from UserAgent.gwt.xml (within gwt- user.jar) into your own *.gwt.xml and tweak it so that Galio is identified as another supported browser. Nice solution. Does that mean that they will have to test all supoorted browsers for the best match? --~--~-~--~~~---~--~~ 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: Question about SuggestBox.wrap
It seems that is the only one to avoid it. Thanks! On Jun 11, 4:50 am, Thomas Broyer t.bro...@gmail.com wrote: On 11 juin, 00:38, Ben benzhe...@gmail.com wrote: I have a text box insides a FlexTable and I am trying to use SuggestBox.wrap to wrap the text box into a SuggestBox. Code snippet is like this. . FlexTable ft = new FlexTable(); TextBox tb = new TextBox(); ft.setWidget(0,0,tb); MultiWordSuggestOracle oracle = new MultiWordSuggestOracle(); suggest = SuggestBox.wrap(oracle, tb.getElement()); . But it throws error in hosted mode like this: java.lang.AssertionError: A widget that has an existing parent widget may not be added to the detach list at com.google.gwt.user.client.ui.RootPanel.detachOnWindowClose (RootPanel.java:122) at com.google.gwt.user.client.ui.SuggestBox.wrap(SuggestBox.java: 267)... But it does not have this problem when you compile it and run it in browsers. I look into the source code of SuggestBox, it throws error in this line. 266 suggestBox.onAttach(); 267 RootPanel.detachOnWindowClose(suggestBox); What is the problem? Is there a way to solve it? Do not use wrap(), use the ctor instead. FlexTable ft = new FlexTable(); TextBox tb = new TextBox(); MultiWordSuggestOracle oracle = new MultiWordSuggestOracle(); suggest = new SuggestBox(oracle, tb); ft.setWidget(0,0,suggest); --~--~-~--~~~---~--~~ 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: Event handler for model ?
Could you please post some examples will? Or maybe send me some code? mnenchevs example was good, but more examples never hurt :-) On 11 Juni, 14:08, Will wil...@gmail.com wrote: That's what I use as well. I created an Abstract Class with HashmapEventHander,HandlerRegistration for removing a handler (because HandlerManager.removeHandler(..) is depricated) and use that for all my UI components that create custom events. I then create sub- Classes of EventHandler for each logical group of events but that's just to help keep the project readable. Doing it once for the base UI class didn't seem overweight but we'll see how it performs once I get the project into a perf test. On Jun 10, 8:40 am, Dalla dalla_man...@hotmail.com wrote: Hi I´m having trouble understanding how to implement an event handler for my custom objects with the new event handler system. Let´s pretend I have a very simple model class like this one: public class ArrivalData { private Date date; private boolean processing = false; public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } } When setDate is called, I want to fire an event that my view components can listen on, and act on when called for. How would you go about doing that? Are there any existing handler interfaces that can be used? I found this tutorial (see link below), but it seems pretty complicated for what I´m trying to acheive.http://www.itsolut.com/chrismusings/2009/04/28/business-events-with-g... What´s best practice here? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Specify where Tomcat Lite is Installed
I'm using GWT 1.6.4, and when I run my JUnit test cases, the GWTShell installs Tomcat Lite in the tomcat directory under my project root directory. How can I specify where Tomcat Lite is installed? --~--~-~--~~~---~--~~ 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 when
Hi all, i'm newbie in techno thingsbut i'm now developing a UI with gwt ext. I develop on Windows XP. I'd like to call web services. i have a .wsdl file, compile it using cxf (wsdl2java) by maven to generate java sources from wsdl. I wrote a method to call this service in order to get a list of technical services like this: @Transactional public class SampleServiceImpl implements SampleService { public ListTechnicalServiceTO createServiceDescription()throws Exception { ServiceManagerImplService ssDr = new ServiceManagerImplService(); // wsdl service generated ServiceManager sm = ssDr.getServiceManagerImplPort(); ListTechnicalServiceTO sdragon = sm.getAllServices(); return sdragon; } in my presentation layer, i have GWTSampleServiceAsync, GWTSampleServiceImple... to link with the above service. once i compiled this layer, everything seems ok. but, when i click a button that invokes this service, there's problem of Class not found: javax/xml/ws/Service Then, i add a dependency of this class (jaxws.jar) into my pom.xml of presentation layerI compiled once again...there's still not work...and gave me another error which is: javax/xml/ws cannot be serialized. So, now I dont know what to do. Anyone has ideas how to solve such problem? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Large Data Set problems
I am having a performance problem. I am trying to build a page that allows the user to select from a fairly large list of objects (up to 20,000). We have filtering capabilities to trim the list so the user doesn't have to scroll through all of them. It's a reasonable UI. Unfortunately, I only get decent performance on Safari. IE6 is exceptionally miserable. It's okay when the list has 100 items, but it crashes as we exceed 300. So I've been experimenting, and I haven't found a way around it. So I created a sample app. All I did was populate an ArrayListString with 20,000 fairly short strings that I read out of the HTML file. Under Safari 4 on a G5 Mac Pro, this is almost instant. Under IE6 on a similar age Windows box, it's taking 4 minutes. Firefox on the G5 runs out of memory. Is it possible to store large amounts of data in my GWT applications? Or do I have to store fairly small amounts of data and go back and forth to the server a lot? If it's the latter, I may as well just go back to what we used to do (WebObjects). I'm including my little sample program. Maybe there's something obvious that I can do? -Joe --- GWTMinimum.java --- package com.missionmode.gwtminimum.client; import java.util.*; import com.google.gwt.core.client.*; import com.google.gwt.user.client.*; import com.google.gwt.user.client.ui.*; /** * Entry point classes define codeonModuleLoad()/code. */ public class GWTMinimum implements EntryPoint { public FlexTablepanel; public Button loadBtn; public Button displayBtn; public ListBox listBox; public Labellabel; public ArrayListStringusernames = new ArrayListString(); public String[] parts; /** * This is the entry point method. */ public void onModuleLoad() { panel = new FlexTable(); RootPanel.get(web2).add(panel); loadBtn = new Button(Click to start load); panel.setWidget(0, 0, loadBtn); loadBtn.addClickListener(new ClickListener() { public void onClick(Widget sender) { loadUsers(); } }); } /** * We've loaded the user table. Set up so they * can press another button to display the data. */ public void setupForDisplay() { displayBtn = new Button(Click to Display); panel.setWidget(0, 1, displayBtn); displayBtn.addClickListener(new ClickListener() { public void onClick(Widget sender) { showUsers(); } }); } /** * Load the users from the HTML page. */ public void loadUsers() { if (parts == null) { String str = stringFromDocument(users); parts = str.split(===); loadBtn.setText(Click me again); } else { for (String name : parts) { name = name.trim(); if (name.length() 0) { usernames.add(name); } } showCount(); setupForDisplay(); } } /** * Just show how many users were actually loaded. */ public void showCount() { label = new Label(Total user count: + usernames.size()); panel.setWidget(1, 0, label); } /** * Show the loaded users. */ public void showUsers() { try { listBox = new ListBox(); listBox.setVisibleItemCount(20); panel.setWidget(2, 0, listBox); for (String str : usernames) { listBox.addItem(str); } } catch (Exception e) { panel.setText(3, 0, Error: + e.getMessage()); } } /** * Return a string from the document. */ public String stringFromDocument(String elementName) { String retVal = ; Element params = DOM.getElementById(elementName); if (params != null) { retVal = DOM.getInnerText(params); } return retVal; } } --- Foo.html --- !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head meta http-equiv=content-type content=text/html; charset=UTF-8 titleGWTMinimum/title script type=text/javascript
Background image shows up in hosted mode but not in web mode
Hello, I have created the following css style to add a background image to the html page of my application. .bg { background: url(images/bg.gif) 50% 50% no-repeat; } and in the .java I have: RootPanel.get().addStyleName(bg); In hosted mode I can see the background image but in web mode (after compiling), although the application is up to date, the background image does not show up. Any ideas on why this might be happening? Thanks in advance, Manolis --~--~-~--~~~---~--~~ 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: Using Filters
I have implemented something similar using a filter. In the doFilter, you can cast the ServletRequest parameter to an HttpServletRequest. You will then have access to cookies and the container's session. For example, HttpServletRequest hRequest = (HttpServletRequest)request; Cookie[] cookies = hRequest.getCookies(); hRequest.getSession().setAttribute(someattr, object); (MyObject)myObject = hRequest.getSession().getAttribute(blap); You could store your sessionid in a cookie, or in the container session. This can provide a pretty decent auth mechanism, I think. 1. My filter takes an initialization parameter, named requiredrole. If set, then the user must have that role or else the request is denied or redirected or whatever. 2. If you use a cookie to send the sessionid, you can get it back using hRequest.getCookies(). 3. You can avoid sending your own sessionid to the client altogether, and instead, store it in the container's session if you wish, using hRequest.getSession().setAttribute(). (that is dependent on the container's session cookie coming from the browser.) You can stop there can continue on your way... The following is some detail on how I have used this to create my own login filter. As for the user logged in, I have implemented a class that implements java.security.Principal, This must implement getName(). To that I added a set of roles. public class MyPrincipal implements Principal { String name; SetString roles = new HashSetString(); etc... public String getName() { return name; } public boolean isUserInRole(String role) { return roles.contains (role); } } Additionally, I have a class that extends HttpServletRequestWrapper. private class UserPrincipalRequestWrapper extends HttpServletRequestWrapper { MyPrincipal p; public UserPrincipalRequestWrapper(HttpServletRequest arg0, MyPrincipal p) { super(arg0); this.p = p; } public Principal getUserPrincipal() { return p; } public boolean isUserInRole(String role) { return p.isUserInRole(role); } So! How does this all work? - A request comes in to the filter. - The filter looks in the container session for a MyPrincipal object - If not found, then redirect to the login page - If found, then - if requiresRole is set, verify the MyPrincipal object has that role. - create a UserPrincipalRequestWrapper using that MyPrincipal object - call chain.doFilter(wrapper, response); The login page is therefore required to assign a MyPrincipal object to the session using hRequest.getSession().setAttribute(principal, new MyPrincipal(...)); Inside the Servlet method, I can then call the standard auth methods, for example: // Get the request inside GWT servlet HttpServletRequest request = getThreadLocalRequest(); request.getUserPrincipal(); request.isUserInRole(admin); Finally, in my web.xml, I initialize multiple filters, with requiredRole set to different things; I then apply that to different servlets. EG., I have a servlet for admin functions, and another for user functions. For bonus points, you can implement a persistent cookie (random number?) that will reload the MyPrincipal into the container session, if the container session does not already have one. This is to support 'log in for two weeks' feature of many popular email sites for example. Well there you go, more detail than you ever needed to know... Jamie. --- Search for analog and digital television broadcast antennas in your area: http://www.antennamap.com/ --~--~-~--~~~---~--~~ 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: Large Data Set problems
Hi Joe, The trick is to not even try to load that much data into the browser. We use the SmartGWT widget library which has very good support for virtual pagination of lists and comboboxes. By default, it only loads the first 75 rows and then as the user scrolls down, calls are made back to the server to retrieve the desired data - which is then shown to the user. There is an occasional delay when the user sees blank space which is then filled in when the data comes in. But overall, it is a great solution -we're viewing tables with thousands of rows and seeing better performance than our old Swing-based application. Tom Joe Larson wrote: I am having a performance problem. I am trying to build a page that allows the user to select from a fairly large list of objects (up to 20,000). We have filtering capabilities to trim the list so the user doesn't have to scroll through all of them. It's a reasonable UI. Unfortunately, I only get decent performance on Safari. IE6 is exceptionally miserable. It's okay when the list has 100 items, but it crashes as we exceed 300. So I've been experimenting, and I haven't found a way around it. So I created a sample app. All I did was populate an ArrayListString with 20,000 fairly short strings that I read out of the HTML file. Under Safari 4 on a G5 Mac Pro, this is almost instant. Under IE6 on a similar age Windows box, it's taking 4 minutes. Firefox on the G5 runs out of memory. Is it possible to store large amounts of data in my GWT applications? Or do I have to store fairly small amounts of data and go back and forth to the server a lot? If it's the latter, I may as well just go back to what we used to do (WebObjects). I'm including my little sample program. Maybe there's something obvious that I can do? -Joe --- GWTMinimum.java --- package com.missionmode.gwtminimum.client; import java.util.*; import com.google.gwt.core.client.*; import com.google.gwt.user.client.*; import com.google.gwt.user.client.ui.*; /** * Entry point classes define codeonModuleLoad()/code. */ public class GWTMinimum implements EntryPoint { public FlexTablepanel; public Button loadBtn; public Button displayBtn; public ListBox listBox; public Labellabel; public ArrayListStringusernames = new ArrayListString(); public String[] parts; /** * This is the entry point method. */ public void onModuleLoad() { panel = new FlexTable(); RootPanel.get(web2).add(panel); loadBtn = new Button(Click to start load); panel.setWidget(0, 0, loadBtn); loadBtn.addClickListener(new ClickListener() { public void onClick(Widget sender) { loadUsers(); } }); } /** * We've loaded the user table. Set up so they * can press another button to display the data. */ public void setupForDisplay() { displayBtn = new Button(Click to Display); panel.setWidget(0, 1, displayBtn); displayBtn.addClickListener(new ClickListener() { public void onClick(Widget sender) { showUsers(); } }); } /** * Load the users from the HTML page. */ public void loadUsers() { if (parts == null) { String str = stringFromDocument(users); parts = str.split(===); loadBtn.setText(Click me again); } else { for (String name : parts) { name = name.trim(); if (name.length() 0) { usernames.add(name); } } showCount(); setupForDisplay(); } } /** * Just show how many users were actually loaded. */ public void showCount() { label = new Label(Total user count: + usernames.size()); panel.setWidget(1, 0, label); } /** * Show the loaded users. */ public void showUsers() { try { listBox = new ListBox(); listBox.setVisibleItemCount(20); panel.setWidget(2, 0, listBox); for (String str : usernames) { listBox.addItem(str); } } catch (Exception e) {
Re: HELLO MODERATOR
Hi eags, Sorry for the delay in moderation. Unfortunately I'm the primary moderator for the forum, and so posting in a different timezone does sometimes add a bit more delay than I'd like to a post. Perhaps I should try a polyphasic sleep schedule :-) Regarding moderated posts - you should be cleared for posting now that your first post has gone through. I only check the first post for new users registered to the forum for spam. If that clears, then you become free to post in the future without moderation. That said, I'm afraid there isn't much I can do about changing the timestamp on the previously moderated message. I'm guessing that this post referencing the previous post should get enough attention on it so that other group members will post up. Sorry again for the delay, -Sumit Chandel On Tue, Jun 9, 2009 at 11:03 AM, eags eagsala...@gmail.com wrote: Hi. I posted a comment last night starting a new thread called Very basic LoginSecurityFAQ and GWT-RPC questions. I guess because of the moderation it wasn't actually posted until about a half an hour ago but the timestamp on it still is for last night which means that it is buried in last nights conversations and no one is seeing it. So I have two questions: 1. Should I repost? Or is it possible for you to reset the timestamp so it gets seen? 2. How do I become a regular user and not get moderated anymore? Is it a certain number of posts? Or is it a certain average rating on my posts? 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 -~--~~~~--~~--~--~---
Passing bag of Serializable objects to RPC
Hi, I've read some past emails on this subject, but I want to know if anyone has a best practice for this. Lets say I have MyService(HashMapString,Serializable reportBag) . I've read it's advisable to narrow down the Serializable to a type that has a smaller set of implementations, such as using GXT2's serializable BeanModel or making up a marker like SerializaleDTO (or for that matter, the old IsSerializable) I'd be willing to do this, except I'd like to put ArrayListBeanModel in my HashMapString,Serializable reportBag When I start stuffing things in my bag from widgets like selections from grids, etc, these my come back as ArrayListBeanModel. This means if I want to do reportBag.put(StuffFromWidget1,myGrid.getSelection()); it won't work unless myGrid.getSelection() is null. I tried wrapping ArrayListBeanModel in a new implementation of BeanModel, but it still did not work (same error, even after cleaning). I guess what I'm looking for is a way to sent an object with an arbitrary number and combination of beans and lists of beans, where a bean is a Serializable object. I'd prefer to use some sort of map, so I can look up the objects in my service impl. i.e. reportBag = new HashMapString, Serializable(); reportBag.put(SomeText,JustText); reportBag.put(SomeBean,imaSerializableBean); reportBag.put(ListOBeans,thatListOBeansFromAWidget); reportBag.put(OneMoreBean,forGoodMeasureBean); etc etc then MyServiceAsync.RPC.runReport(reportBag, callback); Is this possible? I know topics on serialization get hashed and rehashed here and I sure don't want to bother people with noob questions. I must have read 40 threads on it today! Now I'm off to google code search to try and find something in the wild... --~--~-~--~~~---~--~~ 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: Please help! GWT out of the box examples stopped running correctly in hosted mode under Windows Vista
Hi sbarr10, Here is the previous thread where you posted about this issue: http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/54e1ffa04907b569 http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/54e1ffa04907b569I replied back on there recommending that you check if the Windows Firewall or new security mechanism is potentially blocking the hosted mode process. If that's the case, you should be getting a security popup prompting you to grant access to the process / allow it to connect to the network, unless it has been set to always allow processes to run (although I'm not quite sure if there exists a setting to do that). Feel free to get back on the previous thread if you're still having problems getting hosted mode working. Hope that helps, -Sumit Chandel On Sun, Jun 7, 2009 at 9:36 PM, sbar...@earthlink.net sbar...@earthlink.net wrote: I cannot find my previous post on this topic. I am new to Vista and for weeks have been happily coding away in GWT 1.6.4 using hosted mode. I strictly use DOS shells (no Eclipse). The issue is not specific to just my code, it affects the GWT sample applications out of the box too. When I type: %ant_home%\bin\ant clean -The relevant directories were cleaned. %ant_home%\bin\ant build -Yes, new files are being generated. %ant_home%\bin\ant hosted- I get two blank white screens and nothing happens. If I then bang the Compile/Browse button and wait a minute, the sample app will eventually launch - in a THIRD window. This did not used to happen! I looked at the Windows Update history and noticed that an IE8 install had failed, so I went and completed that. What is it that I am not understanding about Vista?!? --~--~-~--~~~---~--~~ 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: Rebind for Android/Webkit?
I think you have to specify an for each if in your replace-with. Try: replace-with class=com.hs.moose.common.client.widget.NextPreviousButtonCSS when-type-is class=com.hs.moose.common.client.widget.NextPreviousButton/ any when-property-is name=user.agent value=safari/ when-property-is name=WebKit value=yes/ /any /replace-with On Jun 10, 6:18 am, Evan Ruff evan.r...@gmail.com wrote: Hey guys, I'm trying to add some rebind parameters for an Android implementation of my application and I just can't seem to get it to work right. In my Application.gwt.xml I'm doing this: define-property name=WebKit values=yes,no/ property-provider name=WebKit![CDATA[ return navigator.userAgent.indexOf('WebKit') -1 ? 'yes' : 'no'; ]] /property-provider replace-with class=com.hs.moose.common.client.widget.NextPreviousButtonCSS when-type-is class=com.hs.moose.common.client.widget.NextPreviousButton/ when-property-is name=user.agent value=safari/ when-property-is name=WebKit value=yes/ /replace-with !-- Rebind the entry point if Gears is not installed -- replace-with class=com.hs.moose.app.client.Application when-type-is class=com.hs.moose.app.client.HasGearsEntry / when-property-is name=gears.installed value=false / /replace-with But $WebKit never gets set, either yes or no. I was wondering if anyone could help me out on this sort of thing (It's my first go at it.) Also, is there a way to do Android, iPhone and Chrome seperately, or am I only limited to Webkit? Thanks! Evan --~--~-~--~~~---~--~~ 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: Mouse Wheel Handler on a TextBox
Hi D L H, I'm guessing the browser you were testing on when you tried this out was Firefox 3? There is a known (and fixed) issue for this reported on the Issue Tracker. See Issue #2902 (link below). The fix for the issue has been committed all will be included in the next release. Issue #2902: http://code.google.com/p/google-web-toolkit/issues/detail?id=2902 If you're working from the GWT trunk, you can pick up and patch the issue with r5398. Hope that helps, -Sumit Chandel On Mon, Jun 8, 2009 at 7:09 AM, D L H thed2...@gmail.com wrote: hello. i'm trying to make a TextBox that will change value when someone scrolls the mouse wheel over it. specifically, my goal is for the number in the text box to increase when i scroll up, and decrease when i scroll down. however, i'm having trouble figuring out the MouseWheelHandler. i simplified my code to just change the value to UP or DOWN, but it just doesn't work. it compiles though. i also tried it with event.preventDefault(), but that didn't seem to have any effect. private TextBox valueField = new TextBox(); ... ... valueField.addMouseWheelHandler(new MouseWheelHandler() { public void onMouseWheel(MouseWheelEvent event) { //event.preventDefault(); if(event.isNorth()) { valueField.setText(UP); } else { valueField.setText(DOWN); } } }); --~--~-~--~~~---~--~~ 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: 404 error: gwt server can not be found
Hi I had a similar problem a few days ago. It was down to an entry in my web.xml file. Perhaps if you post your xml servlet-mapping entry, someone may be able to help you with it. I do not see why it should make a difference, I know it does not in standard browsers, but should there be an extra forward slash in /notamsearchpreference//searchService ? I am a novice and may be getting it all wrong. Sorry if I am. Paul - Original Message From: Linda linda.ctr.c...@faa.gov To: Google Web Toolkit Google-Web-Toolkit@googlegroups.com Sent: Thursday, 11 June, 2009 17:10:26 Subject: 404 error: gwt server can not be found I upgraded my project from gwt-1.5 to gwt-1.6 and updated my web.xml file. Now I am running a Error 404 problem after I get a warning : No file found for: /notamsearchpreference//searchService. I checked my WEB-INF/class/myClient folder, the searchService.class was there. here is the sample code how do I create the server: public static SearchServiceAsync searchService = (SearchServiceAsync) GWT .create(SearchService.class); static { ServiceDefTarget endpoint = (ServiceDefTarget) searchService; String moduleRelativeURL = GWT.getModuleBaseURL() + /searchService; endpoint.setServiceEntryPoint(moduleRelativeURL); } --~--~-~--~~~---~--~~ 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: GWT + hosted mode + jboss
Hi mmenchev, You should still be able to use hosted mode with -noserver through the plugin, although there are some steps you need to take first to get everything setup for hosted mode debugging on your server. Check out the FAQ link below. FAQ How do I use my own server instead of GWT's built-in Jetty instance: http://code.google.com/webtoolkit/doc/1.6/FAQ_DebuggingAndCompiling.html#How_do_I_use_my_own_server_in_hosted_mode_instead_of_GWT's http://code.google.com/webtoolkit/doc/1.6/FAQ_DebuggingAndCompiling.html#How_do_I_use_my_own_server_in_hosted_mode_instead_of_GWT'sOnce you've followed the steps outlined there, you should be able to launch hosted mode with the plugin and work with your own server for hosted mode debugging. Hope that helps, -Sumit Chandel On Sat, Jun 6, 2009 at 7:49 AM, mnenchev nenchev.mari...@gmail.com wrote: Hi, all, I dig the web, but i could not find how to run hosted mode with external jboss. Here is what i do: 1) Create web project with google plugin for eclipse, that creates me hello world project with gwt. 2) test it within the internal server and it works. 3) Add new server runtime jboss 4.2. 4) Change the project facets - runtimes check jboss. 5) run configurations - set the port 8080 and uncheck the use default server checkbox 6) Start the jboss from eclipse(view servers) 6) run the application with the google plugin When the hosted browser is displayed it says that it could not find the resource on the server. So my question is how to deploy on the server, if i have to do it every time when i change something this host mode is useless with external server. I also added -noserver, but the application is not deployed on the jboss so the effect is the same. How to manage this. I look all over the net but i could not find any complete example how to do this, every one just says use -noserver, but that does not solve the problem. Pls help me i am new with gwt. Regards. --~--~-~--~~~---~--~~ 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: gwt 1.6 Embedded Jetty log
Hi soncio69, Try setting the -logLevel DEBUG argument in your hosted mode launch configuration. It should tell you a lot more about the exception that was thrown in the hosted mode console. Simply select the exception in the upper pane of the console window and the exception stack trace should be displayed in the console window output in the lower pane. Hope that helps, -Sumit Chandel On Mon, Jun 8, 2009 at 2:45 AM, sonci...@gmail.com sonci...@gmail.comwrote: I'm trying to upgrade my project from GWT 1.5 to 1.6 Now everything sems to be ok on my client side but i'm having a problem running my serviceImpl on the server side. My AsyncCallback on failure mathod get executed with the following message: The call failed on the server; see server log for details I'm new to Jetty, where can i find server log? The same application on GWT 1.5 and embedded tomcat runs without problems. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
GWT architecture MVP/EventBus (mentioned at Google I/O)
I did not attend Google I/O but as soon as the video Google I/O 2009 - Best Practices for Architecting GWT App (http://www.youtube.com/ watch?v=PDuhR18-EdM) was posted I reviewed it and was a bit confused by the idea of an EventBus. From what I can tell the idea is that UI widgets requiring data from the server are able to fire off requests for some form of data like void getTransactionsForAccount(Account acct) then at some unknown later time (ms to seconds ussually) when a response comes in from the RPC call the eventbus is what actually directly recives the data and then it is dispatched Client UI: Hey call some RPC method with these parameters, my AsyncCallback is this EventBus thing ...some unknown time passes while the server does magic... Client Event Bus: A response came in of type X/Y/Z I should fire an event to all interested parties Client UI: According to this event I just recieved some of my UI code needs to change A few things are still very hazy for me... 1- What is missing here is when would the Client UI typically subscribe/unsubscribe from the event bus. If this were a desktop application I would simply use weak reference so I would not have to unsubscribe my UI manually to prevent a memory leak. 2- Is there some EventBus code I should be using that already exists in the GWT SDK? Is this the same code that is used for handling widget events like clicking a button? 3- Would you typically have one eventbus code for everything? 4- How does this tie in with the MVP pattern? If anybody else watched the video I would be curious what they have to say. Also Ray Ryan mentioned he was going to be creating a new demo application for GWT developers to see this sort of thing in action. That would be awesome, does anybody have any thoughts on this as well? Thanks in advance for your comments. --~--~-~--~~~---~--~~ 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: Can`t use HttpServlet in hosted mode debugger after migrating to GWT 1.6
Thanks for your feedback. The WEB-INFO (instead of WEB-INF) was a typo. The issue is resolved. Here is an explanation of why it failed. First, the request that I wanted to send to my HttpServlet looked like the following: String url = GWT.getModuleBaseURL() + RESTProxy/system; RequestBuilder requestBuilder = new RequestBuilder (RequestBuilder.GET, url); requestBuilder.sendRequest(, new RequestCallback() On the other hand, my web.xml looked like the following: servlet servlet-nameRESTProxyServlet/servlet-name servlet-classcom.foo.bar.server.RESTProxy/servlet-class /servlet servlet-mapping servlet-nameRESTProxyServlet/servlet-name url-pattern/foobar/RESTProxy/url-pattern /servlet-mapping As you can see, there is no wildcard in my url-pattern. I had to modify my url-pattern to the following url-pattern/foobar/RESTProxy/*/url-pattern After this change, everything goes fine. Regards, Maxime --~--~-~--~~~---~--~~ 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: GWT app with Spring Security caching/refresh issue
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/9e41d90e33fd294e/668f9b62079b8f0e?lnk=gstq=blank+until+refresh#668f9b62079b8f0e This thread also seems to have run into the issue. Seems to be a tomcat issue. Odd though that I haven't been able to find more instances of it. Has anyone else had this problem and fixed it with a method other than renaming the entry point from .html to .jsp? Tim On Jun 11, 2:27 pm, tim.clymer tim.cly...@gmail.com wrote: I've been having an odd caching/refresh issue with my application. I have my GWT (1.6.4) app secured with Spring Security (2.0.4). For the most part, this works perfectly. I have a login page which redirects to my entry point page once authenticated, and any attempt to access my entry point page without being authenticated redirects to the login page. However sometimes when the redirect is performed on login I get a blank entry point page and the browser shows that loading is complete. When I look at the page source, the entry point HTML is there along with the reference to the generated nocache js. However, my app doesn't load and the page title doesn't appear in the browser tab, just the URL. I'm wondering if this is caching related, but this is just my best guess. If I refresh the page, the app always pops right up. It's happening across all browsers. Any ideas? What I'm using: GWT 1.6.4 SmartGWT 1.1 Tomcat 6 Thanks, Tim --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
invoking a GWT service from a J2SE app
Hi all, has somebody tried to invoke a GWT service from a J2SE app? When trying to invoke the service as the same way in a GWT client app I get the following: Exception in thread AWT-EventQueue-0 java.lang.UnsupportedOperationException: ERROR: GWT.create() is only usable in client code! It cannot be called, for example, from server code. If you are running a unit test, check that your test case extends GWTTestCase and that GWT.create() is not called from within an initializer or constructor. at com.google.gwt.core.client.GWT.create(GWT.java:91) thanks! Alfredo --~--~-~--~~~---~--~~ 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: Eclipse Classic 3.5
Any news on the progress of the 3.5 support? Can we expect a working plugin in time for the final release of Galileo in two weeks? On 28 Maj, 20:37, Miguel Méndez mmen...@google.com wrote: The plugin code is not open sourced at this time, but we do plan to open source it. On Tue, May 26, 2009 at 7:50 PM, acabler acab...@gmail.com wrote: This will be really nice to have. Is the plugin code available in svn yet? I would like to check it out so I can contribute patches for issues like these. thanks, adam On May 23, 10:40 am, Alex Rudnick a...@google.com wrote: Hey LiR, The plugin doesn't supportEclipse3.5yet. We're aware of the incompatibility, and it'll be fixed in an upcoming release -- likely soon before Galileo gets officially released. Thanks! On Fri, May 22, 2009 at 11:46 PM, LiR kirill...@gmail.com wrote: EclipseClassic3.5is available but google plugin (for 3.4 version) doesn`t want to install in new version. I have a Install Details message in top of window: The operation cannot be completed. See the details. And details block: Cannot complete the install because one or more required items could not be found. Software being installed: com.google.gdt.eclipse.suite.e34.feature.feature.group 1.0.1.v200905131143 Missing requirement: com.google.gdt.eclipse.suite.e34.feature.feature.group 1.0.1.v200905131143 requires 'org.eclipse.platform.feature.group [3.4.0,3.5.0)' but it could not be found -- Alex Rudnick swe, gwt, atl -- Miguel --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Name a function that will not get changed when compliling?
Hello, How can I name a function like start() and it will not change while compliling so that other javascript can call it? 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 -~--~~~~--~~--~--~---
Re: Mysql access dienied in GWT hosted mode
never mind On 10 jun, 17:35, Bonor bono...@gmail.com wrote: When doing a RPC call my Service get's an Access Denied error when trying to connect with mysql. java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup) Where do i grant access? Suggestions? --~--~-~--~~~---~--~~ 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: Name a function that will not get changed when compliling?
Search for GWT Exporter and use that. On Thu, Jun 11, 2009 at 10:58 AM, Shedokanshedok...@gmail.com wrote: Hello, How can I name a function like start() and it will not change while compliling so that other javascript can call it? 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 -~--~~~~--~~--~--~---
Re: Name a function that will not get changed when compliling?
Hey Shedokan, The approach I've used for that is to attach a GWT function to the window object ($wnd). There's an example in the docs over here: http://code.google.com/webtoolkit/doc/1.6/DevGuideCodingBasics.html#DevGuideJavaScriptNativeInterface Check under the subsection Calling a Java Method from Handwritten JavaScript. Like Ian said, you could also use GWT Exporter. Hope this helps! On Thu, Jun 11, 2009 at 1:58 PM, Shedokanshedok...@gmail.com wrote: Hello, How can I name a function like start() and it will not change while compliling so that other javascript can call it? thanks. -- Alex Rudnick swe, gwt, atl --~--~-~--~~~---~--~~ 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: wow, total newbie question
Hi Steve, Typically, you wouldn't want to define multiple entrypoints but instead use a single entrypoint, and potentially divide your project into multiple modules. More replies inlined to your post below: Should this be implemented as 4 separate entry points? Should it be one entry point and one page with all interfaces on it, showing and hiding them as appropriate? If so won't this get bulky? Using a single EntryPoint class, you could define four main panels that represent each of the four pages you described above. You could then add these panels to a TabPanel, for example, where each tab corresponds to one of the four panels, and clicking on the tab opens up that panel. There are many other options for how you can set this up, but the TabPanel example is one that is hopefully easiest to visualize and understand. From the functionality you described so far, designing the application this way would probably not be too bulky, in terms of both size of your code base and initial download size of your application for your user. However, as your code base grows and you add features, you might want to start separating your code into different modules to make clearer distinctions between them and also make modules reusable in other components of your application. This is when you can consider splitting your code into multiple modules, where the module containing your entry point class inherits from whichever other modules it needs to use. You can read more about creating more modules for your application by checking out the doc linked below. See Dividing code into multiple modules section: http://code.google.com/webtoolkit/doc/1.6/DevGuideOrganizingProjects.html#DevGuideModuleXml For the question about whether this will become bulky for the user, the answer is, it will. Which is why we're working on the new code splitting runAsync() feature in GWT 2.0. Using the runAsync() feature, you can control you can split up your code into individual parts and control when they get loaded. This way, you might have the login and add new member panel coded to load as soon as the user visits your application, but split out the edit existing user and reminder email panels downloaded as separate fragments in the background to reduce the initial download of your application. Until GWT 2.0 releases and you can use the feature in a stable release, you can either work from GWT trunk if you want to use the feature now (probably not the best thing to do since you're just getting started with GWT), or design your application following the principle of on-demand widget creation (link below). Your user will still pay for the initial download size, but at least you will cut down on rendering time and memory usage at a given moment. You should also be able to revisit areas of your code where you lazily loaded your components and replace these by runAsync() calls when GWT 2.0 lands. On-demand widget creation: http://googlewebtoolkit.blogspot.com/2008/11/improving-performance-with-on-demand.html Are the HTML pages I add after the main entrypoint always pure html? or can I add GWT goodness to them? In general, you won't be adding HTML pages to an GWT application through the entrypoint. Once you've coded your GWT application and run the GWT compiler over the code base, it will generate a number of JavaScript and HTML files, one of which is the JS bootstrap file. Your main HTML page (the page your users land on when they visit your site) will include a script tag referencing this JS bootstrap file and load your GWT application in the page. You could instead add another HTML page into your GWT module through a Frame widget, but that would only be done in very specific situations. You can add a GWT component to an existing part of an application by defining an element in your host HTML page that your GWT component can bind to. For example: index.html: div id='gwtComponent'/div MyEntryPoint.java: public class MyEntryPoint implements EntryPoint { public void onModuleLoad() { VerticalPanel mainPanel = new VerticalPanel(); // Add components to the main panel, and other stuff... RootPanel.get(gwtComponent).add(mainPanel); } } Hope that helps, -Sumit Chandel In general it would be great to have some guidance as to entry points, multiple entry points and how they should be used. I've read all the documentation I can find and haven't seen this explained for someone at a basic level as me. Thanks in Advance Steve --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Preventing JavaScript Injection cient/server side solutions
I am trying to figure out what the best way is to handle JavaScript injection cases. Since any client side input validation handling doesn't truly prevent one from injecting JS such as using tools like Firebug to re-post RPC calls etc. I am wondering if anybody has attempted to intercept JS injection on the server side by scanning RPC calls . I could imagine using a servlet filter to do this or or some other way. Any ideas/feeback is greatly appreciated. Best, -- Thomas Amsler --~--~-~--~~~---~--~~ 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: Preventing JavaScript Injection cient/server side solutions
On 06/11/2009 04:18 PM, tamsler wrote: I am trying to figure out what the best way is to handle JavaScript injection cases. Since any client side input validation handling doesn't truly prevent one from injecting JS such as using tools like Firebug to re-post RPC calls etc. I am wondering if anybody has attempted to intercept JS injection on the server side by scanning RPC calls . I could imagine using a servlet filter to do this or or some other way. Any ideas/feeback is greatly appreciated. It's a good question, but it's not really GWT related. You're talking about server-side code. The JS code generated by GWT executes in the browser. I may be completely missing your point, but perhaps these articles may be apropos: http://code.google.com/webtoolkit/articles/using_gwt_for_json_mashups.html and http://code.google.com/webtoolkit/articles/put_your_gwt_app_on_facebook.html --~--~-~--~~~---~--~~ 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: Couldn't run the Getting Started example with JSON
Anyway I got it working. On Jun 8, 12:19 am, Dagvadorj Galbadrakh dagvad...@gmail.com wrote: Hello everybody, I am totally new to GWT. I Couldn't run the Getting Started example with JSON implementation at address,http://code.google.com/webtoolkit/tutorials/1.6/JSON.html. The problem is that the code doesn't identify id field with getId method of GroupData class. Does anybody has a working full codes left from your walk through? I'd be appreciated with any help. 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 -~--~~~~--~~--~--~---
Browser memory usage grows
Hello All, We've built an application using GWT 1.5.4 that calls a json server and the memory usage for the browser that it is running in keeps going up, I've tested this in IE, Firefox and Chrome with the same result. This application is a widget based application, we have a map widget(open street maps) and some list widgets but it doesn't seem to matter which widgets that we use the memory seems to grow. I've tried using each widget individually with the same result. The json that is returned is big, Firebug doesn't give me a value. Our application polls for new information. I've also tried to use this tool: http://blogs.msdn.com/gpde/pages/javascript-memory-leak-detector.aspx But it didn't detect any leak in javascript. Unfortunatley this is an internal application so I can't point you to our application. If it would be helpful I'll try and knock up a test case. Has anyone else had this problem? If so what was the solution? Thanks, Craig Spry --~--~-~--~~~---~--~~ 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: Is it possible to call the GWT Service outside the entry point?
perhaps this little discussion would be of some help:http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa... -jason Great illustration!! Thx jason.. --~--~-~--~~~---~--~~ 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: Preventing JavaScript Injection cient/server side solutions
It's a good question, but it's not really GWT related. Sure it is. You're talking about server-side code. The JS code generated by GWT executes in the browser. RPC calls execute where? http://code.google.com/webtoolkit/articles/security_for_gwt_applications.html --~--~-~--~~~---~--~~ 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: App engine data types
okay, so I dug into this a bit and figured out how to port existing code to GWT compliant standards. I also included _CustomFieldSerializers. I am currently only using Key and Text in my test code, but I ported Key, Text, Blob, ShortBlob, Link and User however I haven't tested much beyond the Key and Text classes. here is a link to the jars and some notes about them: www.resmarksystems.com/code I hope it is helpful :) -bryce On May 14, 11:22 am, bcottam bcot...@gmail.com wrote: yeah, I actually posted there first:http://groups.google.com/group/google-appengine-java/browse_thread/th... and they suggested that I cross-post here :) I actually started using the persisteddataclasses and sending them across the gwt rpc channel, and that was fine until the datanucleus JDO started putting fields on my classes that were instances of Object [] (which don't serialize all that well). That, and I know there is going to be a performance hit with sending a lot ofdataover the channel. So, I am thinking that doing a lite DTO just for transport would possibly be my best option. I will check out Ray Cromwells posts, mainly I guess what I am looking for at this point is a good reference for using the super-source tag and how to make custom wrappers for non GWT classes (in the same manner that the java.util api is wrapped with com.google.emul etc. Any pointers in that direction would be great. thanks! On May 13, 7:59 pm, Alyxandor a.revolution.ultra.b...@gmail.com wrote: I'm really not sure, but I'd recommend checking out theAppengine google group first...http://groups.google.com/group/google-appengine-java?hl=en There's over a hundred posts a day there, so I'm sure someone there with a little more expertise than yours truly will be of more help. Out of curiosity, have you already tried sending your persistentdata classes down the wire? Cos There's a lot of discussion about it, and some workarounds {basically, the only ways I could do it was with Ray Cromwell's various hacks, or a drop-in called Gilead}. You might find that using the same beans to be nigh impossible without making them non-detachable {read: you can send an object to the client, modify it and send it back to the server to save without copying the object, or manually copying thedatafrom every field}. ...Check the other group, like I said... I'm no expert. Of course, Ray Cromwell IS, so if you can find his Google-Groups profile, try clicking on some of the threads he posts on... You'll be glad you did! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[gwt-contrib] Re: Moving PagingScrollTable Friends to Trunk
I'd definitely like to see the paging ability as an extension (read that as you will: interface implementation, derived class, plug-in behavior, whatever) to the scrolling behavior. I don't really like how the incubator has two totally separate, unrelated classes. I wonder if some performance enhancements could be made by having a TableModel interface which is just read-only, and then only if you need editing would you use a MutableTableModel. I'm just wondering here...I really don't know. Though I'm sure it would have other implications, like a change to the ColumnDefinition (e.g., making it read-only, and having a MutableColumnDefinition?) jay On Jun 10, 9:55 am, Isaac Truett itru...@gmail.com wrote: Re: Bruce's point about expectations and features vs. performance. Has there been (or should we start) discussion for the public record of different facets/features of tables, their impact on performance, and their possible class structure? What I'm thinking of specifically is bulk rendering vs. dynamic model-backed tables, scrolling, paging, and all the combinatorial permutations thereof. Will supported features be part of a single class hierarchy as they are in Incubator (i.e., PagingScrollTable extends ScrollTable; paging code is bound to scrolling code, although scrolling can be disabled it would still add code to the compiled app)? Or will they be pluggable features into a base Table class (like MonthSelectors for DatePickers)? Or separate implementations of a common Table interface? - Isaac On Wed, Jun 10, 2009 at 11:27 AM, Bruce Johnson br...@google.com wrote: I'll be the bad guy and try to lower expectations: whatever we end up doing, it has to be fast. We've seen some *horrible* usability problems with fancy tables -- even at a small number of rows -- and so don't be surprised if we have to pare back features and reduce API flexibility to ensure that a few key use cases are sufficiently high performance. -- Bruce On Tue, Jun 9, 2009 at 10:12 AM, John LaBanca jlaba...@google.com wrote: We'll definitely keep these things in mind when moving stuff over to GWT trunk. We've also found a lot of general usability problems, such as the fact the the table doesn't layout naturally, which means apps require active layout. During the transfer, we'll refactor quite a few things to make them more usable. Specifically, we'd like to provide a version that allows you to bulk renderer the header and footer into the same table element, eliminated the three separate tables and fixed layout. You would lose the scrolling feature, but you would not have to use active layout. When we start moving stuff into trunk or while its in my branch (as in right now), thats a good time to point out specific problems or requests. Its much harder to change the API after we make an official release. Thanks, John LaBanca jlaba...@google.com On Tue, Jun 9, 2009 at 5:01 AM, David david.no...@gmail.com wrote: Jay, We are experiencing the same ideas here. We store column ordering and widths on the server but we have no way of getting events in the UI to know when changes have been complete. wouldn't it be nice that the dnd was included as well, I could really use the DND of columns! Was it hard to implement ? We did not yet bother to investigate since we have to focus on getting functionality complete first. David On Tue, Jun 9, 2009 at 10:00 AM, jayjay.gin...@gmail.com wrote: As I see that this has begun (yeah), I'd like to throw out a few requests: * Please, please, please -- ensure that this is as extensible as possible. Here's just one example--I've integrated the gwt-dnd library to allow drag-n-drop re-ordering of columns. There are a couple of funny corner cases, though, because I have no way of knowing when a column resize has completed. Obviously, if you're resizing the column, you're not interested in dragging it to a new location. I strongly encourage you to think three, four, five times about making a method private or package protected. Liberal use of JavaDoc with strongly worded warnings to those of us who need to customize the widgets. I know this cuts down on your ability to make under-the-cover changes from release to release, but it makes it so that folks like me don't have to resort to things like JSNI trickery or copying the entire class or set of classes into our own code base. * As a direct follow up to #1, fire some more events. For example, fire an event when a column resize starts and when it ends. * Flexibility is great, but often I'm just interested in the simple cases...simple. My example here is the multiple-row header stuff. It's GREAT! I LOVE it! (And better yet, our customers have been screaming for this!) But, I don't always need/want it. And, it can make things more complex. One idea would be to overload methods like
[gwt-contrib] Re: Changing JsArrayT extends JavaScriptObject to JsArrayT
+1 Ray. Now here's the really tricky question. Is there any way we can take advantage of Javascript's for (x in y) { ... } syntax (and should we, given its spotty performance)? My intuition tells me that the only way we could use it would be through a callback, because there's nothing like .NET generators/yield in Javascript. On Wed, Jun 10, 2009 at 7:26 PM, Ray Cromwell cromwell...@gmail.com wrote: My take on this is that there is many places where I'd like to avoid JRE collections, but the basic JsArray is too much of a downgrade. I don't mind changing it to T if it doesn't effect performance cause then I could subclass it, but as an example of the stuff I would like in a 'FastArrayList' that is not a collections derivative: 1) add() instead of just set(length(), item) (e.g. push) 2) addAll(anotherFastArrayList) (e.g. concat) 3) splice 4) toArray() (webmode is reinterpret cast op) 5) remove 6) shift/unshift (useful for queue when combined with pop) I use the following pattern all over GQuery to avoid JRE collections but preserve for-each for(Foo f : fooList.elements()) { ... } where fooList is my own JsArrayT class, and elements() returns T[] via reinterpret cast in webmode. -Ray On Thu, Jun 11, 2009 at 2:43 AM, Lex Spoonsp...@google.com wrote: Bah, mis-send. What I was typing was: I though the point was to get rid of JRE collections? Anyway, the collection in question is used as a queue. I would hate to see its performance get worse when there' ...when there's a known, straightforward alternative, and when that alternative provides a class people have been wanting for separate purposes. Lex --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Optimize if statements to conditionals and boolean ops if possible
FWIW: http://code.google.com/p/google-web-toolkit/wiki/BooleanIfExpressionOptimization http://code.google.com/p/google-web-toolkit/wiki/IfToTernaryExpressionOptimization Thanks again for banging on these. I've been meaning to do it for ages... On Wed, Jun 10, 2009 at 9:11 PM, mmastrac.altern...@gmail.com wrote: Reviewers: scottb, Description: As suggested by scottb, we can optimize certain if statements to their boolean equivalents, ie: if (a()) {b()} else {c()} - a()?b():c() if (a()) {b()} - a()b() if (a()) {} else {b()} - a()||b() Please review this at http://gwt-code-reviews.appspot.com/36801 Affected files: dev/core/src/com/google/gwt/dev/js/JsStaticEval.java dev/core/test/com/google/gwt/dev/js/JsStaticEvalTest.java --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: ant improvements, round 1
w00t indeed. This just saved me serious time this morning already. On Wed, Jun 10, 2009 at 6:35 PM, Scott Blum sco...@google.com wrote: w00t!! On Wed, Jun 10, 2009 at 5:47 PM, Freeland Abbott fabb...@google.comwrote: As of r5537, my no-change ant build takes 1:55 instead of 19:43, and there's still some easy work to do, albeit with obviously diminishing returns Most of that difference is due to a rather annoying timestamp consideration with directory entries in jars; my patch introduces a new Ant task, LatestTimeJar, to resolve it. The issue is---was---that in general, we jar both .../src/com/google/gwt/.../Foo.java and also build/out/.../com/google/gwt/.../Foo.class. The jar file will have one directory entry for com/, the existence of which is actually important to GWT as Scott pointed out in the first-round review comments. But the two directories have different touch dates, and we archived the first-named, which was usually from .../src/..., with an old date by svn. The second build would therefore notice that the *second* instance of com/ was newer than the archived com/, and therefore jar it again. (Because we did updates, the entry would have been new after that second cycle. In some cases, notably the servet API classes in alldeps.jar, we had up to four such duplicates, though.) Worse, everything downstream of that error also had to be redone... including the samples. --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] [google-web-toolkit commit] r5538 - Fixes typo that confused __MODULE_NAME__ with __MODULE_FUNC__, leading to
Author: j...@google.com Date: Thu Jun 11 06:24:20 2009 New Revision: 5538 Modified: trunk/dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js Log: Fixes typo that confused __MODULE_NAME__ with __MODULE_FUNC__, leading to startup failures in pre-1.6-hosted-mode. Review: http://gwt-code-reviews.appspot.com/37802 (TBR) Modified: trunk/dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js == --- trunk/dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js (original) +++ trunk/dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js Thu Jun 11 06:24:20 2009 @@ -347,7 +347,7 @@ // onScriptLoad()). var win = scriptFrame.contentWindow; if (isHostedMode()) { -win.name = '__MODULE_NAME__'; +win.name = '__MODULE_FUNC__'; } // Set this *before* calling doc.write(), because the linux hosted-mode --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Changing JsArrayT extends JavaScriptObject to JsArrayT
On Thu, Jun 11, 2009 at 7:51 AM, Joel Webber j...@google.com wrote: +1 Ray. Now here's the really tricky question. Is there any way we can take advantage of Javascript's for (x in y) { ... } syntax (and should we, given its spotty performance)? My intuition tells me that the only way we could use it would be through a callback, because there's nothing like .NET generators/yield in Javascript. First problem is you have to have some knowledge of the key domain in order to use the keys as raw JS attributes. Ie, basically they need to be integers or strings that don't conflict with particular reserved words like __proto (or you prefix all the keys, like what is done in FastStringMap). I think assuming the keys are safe is ok for specific use cases, but not ok for a general purpose data structure (so I agree with prefixing keys in FastStringMap while avoiding them in CurrencyList for example). Regarding the for(x in y) construct, it seems conceivable the compiler could recognize the code generated by the normal Java-JS compile of for(x : y.elements()) and rewrite it to the native JS code where appropriate as a peephole optimization. -- John A. Tamplin Software Engineer (GWT), Google --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: ant improvements, round 1
Well, if I've saved serious time by 10:30am, I'm happy indeed. I've got another depends-on-your-hardware-but-I-saw-4min-saving (for work-to-do rebuild of samples, so no gain if you use buildonly) out to scott already, though it's small enough that anyone who wants to review at http://gwt-code-reviews.appspot.com/36802/show can help Scott do real work instead of ant file review. 2009/6/11 Joel Webber j...@google.com w00t indeed. This just saved me serious time this morning already. On Wed, Jun 10, 2009 at 6:35 PM, Scott Blum sco...@google.com wrote: w00t!! On Wed, Jun 10, 2009 at 5:47 PM, Freeland Abbott fabb...@google.comwrote: As of r5537, my no-change ant build takes 1:55 instead of 19:43, and there's still some easy work to do, albeit with obviously diminishing returns Most of that difference is due to a rather annoying timestamp consideration with directory entries in jars; my patch introduces a new Ant task, LatestTimeJar, to resolve it. The issue is---was---that in general, we jar both .../src/com/google/gwt/.../Foo.java and also build/out/.../com/google/gwt/.../Foo.class. The jar file will have one directory entry for com/, the existence of which is actually important to GWT as Scott pointed out in the first-round review comments. But the two directories have different touch dates, and we archived the first-named, which was usually from .../src/..., with an old date by svn. The second build would therefore notice that the *second* instance of com/ was newer than the archived com/, and therefore jar it again. (Because we did updates, the entry would have been new after that second cycle. In some cases, notably the servet API classes in alldeps.jar, we had up to four such duplicates, though.) Worse, everything downstream of that error also had to be redone... including the samples. --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Changing JsArrayT extends JavaScriptObject to JsArrayT
On 11 juin, 16:11, John Tamplin j...@google.com wrote: On Thu, Jun 11, 2009 at 7:51 AM, Joel Webber j...@google.com wrote: +1 Ray. Now here's the really tricky question. Is there any way we can take advantage of Javascript's for (x in y) { ... } syntax (and should we, given its spotty performance)? My intuition tells me that the only way we could use it would be through a callback, because there's nothing like .NET generators/yield in Javascript. I'm afraid I don't understand the relationship between JsArray/ JsArrayList and for (x in y) { ... } https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Statements/for...in Although it may be tempting to use this as a way to iterate over an Array, this is a bad idea. The for...in statement iterates over user- defined properties in addition to the array elements, so if you modify the array's non-integer or non-positive properties (e.g. by adding a foo property to it or even by adding a method or property to Array.prototype), the for...in statement will return the name of your user-defined properties in addition to the numeric indexes. Also, because order of iteration is arbitrary, iterating over an array may not visit elements in numeric order. Thus it is better to use a traditional for loop with a numeric index when iterating over arrays. Similar arguments might be used against even using for...in at all (at least without propertyIsEnumerable() or hasOwnProperty() checks), since it will also iterate over Object.prototype (which, though usually discouraged, can, as in the case of Array.prototype, be usefully extended by the user where are no namespacing concerns caused by inclusion of other libraries which might not perform the above checks on such iterations and where they are aware of the effect such extension will have on their own use of iterators such as for...in). And Nicholas C. Zakas recently confirmed that for (var i=0, l = arr.length; i l; i++) { ... } is the fastest way of iterating through an array's values: http://google-code-updates.blogspot.com/2009/06/nicholas-c-zakas-speed-up-your.html (starts at slide #40) (and this construct is the one generated by GWT from a Java for (T i : arr) { ... }, thus also with Ray's proposed for (T i : jsarr.elements()) { ... }; but beware if the jsarr can be modified --in length-- during the loop!) See also the toArray()s in http://code.google.com/p/gwt-in-the-air/source/browse/trunk/src/net/ltgt/gwt/jscollections/client/JsArrays.java Those methods (toArray(), elements()) are for people who really know what they do, so I'm not sure they so should be included in the core GWT... (the toJavaArray() from some Utils class in GALGWT always copies the array, which is slower but always safe) Regarding the for(x in y) construct, it seems conceivable the compiler could recognize the code generated by the normal Java-JS compile of for(x : y.elements()) and rewrite it to the native JS code where appropriate as a peephole optimization. What the compiler could eventually do is optimize the l=arr.length out of the for-loop when used several times in a row. E.g. void f(T[] arr) { this.sb = new StringBuilder(); for (T i : arr) { this.sb.append(i.toString()); } this.count = 0; for (T i : arr) { this.count++; } } to be compiled into (pseudo): function f(arr) { var l = arr.length; this.sb = new StringBuilder(); for (var i = 0; i l; i++) { this.sb.append(arr[i].toString()); } this.count = 0; for (var i = 0; i l; i++) { this.count++; } } --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Changing JsArrayT extends JavaScriptObject to JsArrayT
On Thu, Jun 11, 2009 at 3:42 PM, Thomas Broyer t.bro...@gmail.com wrote: On 11 juin, 16:11, John Tamplin j...@google.com wrote: On Thu, Jun 11, 2009 at 7:51 AM, Joel Webber j...@google.com wrote: +1 Ray. Now here's the really tricky question. Is there any way we can take advantage of Javascript's for (x in y) { ... } syntax (and should we, given its spotty performance)? My intuition tells me that the only way we could use it would be through a callback, because there's nothing like .NET generators/yield in Javascript. I'm afraid I don't understand the relationship between JsArray/ JsArrayList and for (x in y) { ... } Javascript arrays are sparse. There are use case (such as protocol buffers with extension fields) where this is relevant and for(x in y) may be faster. I agree we should avoid this in the general case, though. https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Statements/for...in Although it may be tempting to use this as a way to iterate over an Array, this is a bad idea. The for...in statement iterates over user- defined properties in addition to the array elements, so if you modify the array's non-integer or non-positive properties (e.g. by adding a foo property to it or even by adding a method or property to Array.prototype), the for...in statement will return the name of your user-defined properties in addition to the numeric indexes. Also, because order of iteration is arbitrary, iterating over an array may not visit elements in numeric order. Thus it is better to use a traditional for loop with a numeric index when iterating over arrays. Similar arguments might be used against even using for...in at all (at least without propertyIsEnumerable() or hasOwnProperty() checks), since it will also iterate over Object.prototype (which, though usually discouraged, can, as in the case of Array.prototype, be usefully extended by the user where are no namespacing concerns caused by inclusion of other libraries which might not perform the above checks on such iterations and where they are aware of the effect such extension will have on their own use of iterators such as for...in). And Nicholas C. Zakas recently confirmed that for (var i=0, l = arr.length; i l; i++) { ... } is the fastest way of iterating through an array's values: http://google-code-updates.blogspot.com/2009/06/nicholas-c-zakas-speed-up-your.html (starts at slide #40) (and this construct is the one generated by GWT from a Java for (T i : arr) { ... }, thus also with Ray's proposed for (T i : jsarr.elements()) { ... }; but beware if the jsarr can be modified --in length-- during the loop!) See also the toArray()s in http://code.google.com/p/gwt-in-the-air/source/browse/trunk/src/net/ltgt/gwt/jscollections/client/JsArrays.java Those methods (toArray(), elements()) are for people who really know what they do, so I'm not sure they so should be included in the core GWT... (the toJavaArray() from some Utils class in GALGWT always copies the array, which is slower but always safe) Regarding the for(x in y) construct, it seems conceivable the compiler could recognize the code generated by the normal Java-JS compile of for(x : y.elements()) and rewrite it to the native JS code where appropriate as a peephole optimization. What the compiler could eventually do is optimize the l=arr.length out of the for-loop when used several times in a row. E.g. void f(T[] arr) { this.sb = new StringBuilder(); for (T i : arr) { this.sb.append(i.toString()); } this.count = 0; for (T i : arr) { this.count++; } } to be compiled into (pseudo): function f(arr) { var l = arr.length; this.sb = new StringBuilder(); for (var i = 0; i l; i++) { this.sb.append(arr[i].toString()); } this.count = 0; for (var i = 0; i l; i++) { this.count++; } } -- Stefan Haustein Google UK Limited Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ; Registered in England Number: 3977902 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: ant improvements, round 1
Nice job Freeland! You're an ant-master! On Thu, Jun 11, 2009 at 10:40 AM, Freeland Abbott fabb...@google.comwrote: Well, if I've saved serious time by 10:30am, I'm happy indeed. I've got another depends-on-your-hardware-but-I-saw-4min-saving (for work-to-do rebuild of samples, so no gain if you use buildonly) out to scott already, though it's small enough that anyone who wants to review at http://gwt-code-reviews.appspot.com/36802/show can help Scott do real work instead of ant file review. 2009/6/11 Joel Webber j...@google.com w00t indeed. This just saved me serious time this morning already. On Wed, Jun 10, 2009 at 6:35 PM, Scott Blum sco...@google.com wrote: w00t!! On Wed, Jun 10, 2009 at 5:47 PM, Freeland Abbott fabb...@google.comwrote: As of r5537, my no-change ant build takes 1:55 instead of 19:43, and there's still some easy work to do, albeit with obviously diminishing returns Most of that difference is due to a rather annoying timestamp consideration with directory entries in jars; my patch introduces a new Ant task, LatestTimeJar, to resolve it. The issue is---was---that in general, we jar both .../src/com/google/gwt/.../Foo.java and also build/out/.../com/google/gwt/.../Foo.class. The jar file will have one directory entry for com/, the existence of which is actually important to GWT as Scott pointed out in the first-round review comments. But the two directories have different touch dates, and we archived the first-named, which was usually from .../src/..., with an old date by svn. The second build would therefore notice that the *second* instance of com/ was newer than the archived com/, and therefore jar it again. (Because we did updates, the entry would have been new after that second cycle. In some cases, notably the servet API classes in alldeps.jar, we had up to four such duplicates, though.) Worse, everything downstream of that error also had to be redone... including the samples. --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Changing JsArrayT extends JavaScriptObject to JsArrayT
On Thu, Jun 11, 2009 at 10:42 AM, Thomas Broyer t.bro...@gmail.com wrote: On 11 juin, 16:11, John Tamplin j...@google.com wrote: On Thu, Jun 11, 2009 at 7:51 AM, Joel Webber j...@google.com wrote: +1 Ray. Now here's the really tricky question. Is there any way we can take advantage of Javascript's for (x in y) { ... } syntax (and should we, given its spotty performance)? My intuition tells me that the only way we could use it would be through a callback, because there's nothing like .NET generators/yield in Javascript. I'm afraid I don't understand the relationship between JsArray/ JsArrayList and for (x in y) { ... } I was thinking more of a Map implementation to iterate over the key set. -- John A. Tamplin Software Engineer (GWT), Google --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Optimize if statements to conditionals and boolean ops if possible
No problem... I haven't handled the common super-expression case (if (test) { return a; } else {return b; } - return test ? a : b), but that one should be pretty easy to tackle for a limited set of common super-expressions. On 11-Jun-09, at 5:53 AM, Joel Webber wrote: FWIW: http://code.google.com/p/google-web-toolkit/wiki/BooleanIfExpressionOptimization http://code.google.com/p/google-web-toolkit/wiki/IfToTernaryExpressionOptimization Thanks again for banging on these. I've been meaning to do it for ages... On Wed, Jun 10, 2009 at 9:11 PM, mmastrac.altern...@gmail.com wrote: Reviewers: scottb, Description: As suggested by scottb, we can optimize certain if statements to their boolean equivalents, ie: if (a()) {b()} else {c()} - a()?b():c() if (a()) {b()} - a()b() if (a()) {} else {b()} - a()||b() Please review this at http://gwt-code-reviews.appspot.com/36801 Affected files: dev/core/src/com/google/gwt/dev/js/JsStaticEval.java dev/core/test/com/google/gwt/dev/js/JsStaticEvalTest.java --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: ant improvements, round 1
Thanks... I think. On Thu, Jun 11, 2009 at 11:53 AM, Rajeev Dayal rda...@google.com wrote: Nice job Freeland! You're an ant-master! On Thu, Jun 11, 2009 at 10:40 AM, Freeland Abbott fabb...@google.comwrote: Well, if I've saved serious time by 10:30am, I'm happy indeed. I've got another depends-on-your-hardware-but-I-saw-4min-saving (for work-to-do rebuild of samples, so no gain if you use buildonly) out to scott already, though it's small enough that anyone who wants to review at http://gwt-code-reviews.appspot.com/36802/show can help Scott do real work instead of ant file review. 2009/6/11 Joel Webber j...@google.com w00t indeed. This just saved me serious time this morning already. On Wed, Jun 10, 2009 at 6:35 PM, Scott Blum sco...@google.com wrote: w00t!! On Wed, Jun 10, 2009 at 5:47 PM, Freeland Abbott fabb...@google.comwrote: As of r5537, my no-change ant build takes 1:55 instead of 19:43, and there's still some easy work to do, albeit with obviously diminishing returns Most of that difference is due to a rather annoying timestamp consideration with directory entries in jars; my patch introduces a new Ant task, LatestTimeJar, to resolve it. The issue is---was---that in general, we jar both .../src/com/google/gwt/.../Foo.java and also build/out/.../com/google/gwt/.../Foo.class. The jar file will have one directory entry for com/, the existence of which is actually important to GWT as Scott pointed out in the first-round review comments. But the two directories have different touch dates, and we archived the first-named, which was usually from .../src/..., with an old date by svn. The second build would therefore notice that the *second* instance of com/ was newer than the archived com/, and therefore jar it again. (Because we did updates, the entry would have been new after that second cycle. In some cases, notably the servet API classes in alldeps.jar, we had up to four such duplicates, though.) Worse, everything downstream of that error also had to be redone... including the samples. --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] reworking ant targets to allow single-platform use
Reviewers: scottb, Description: Shaves 10min off a dist-one build vs dist (aka old build). Please review this at http://gwt-code-reviews.appspot.com/37803 Affected files: build.xml --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: initial load sequence for runAsync's
Thanks, Bob! I have several things to change; my plans are in the line-by-line comments. http://gwt-code-reviews.appspot.com/33848/diff/1/4 File dev/core/src/com/google/gwt/core/ext/soyc/impl/SplitPointRecorder.java (right): http://gwt-code-reviews.appspot.com/33848/diff/1/4#newcode107 Line 107: MapInteger, String names = new HashMapInteger, String(); I'll sort them. It will work to have recordSplitPoints() loop from 1..size instead of looping over the map's key set. http://gwt-code-reviews.appspot.com/33848/diff/1/5 File dev/core/src/com/google/gwt/core/linker/SoycReportLinker.java (right): http://gwt-code-reviews.appspot.com/33848/diff/1/5#newcode43 Line 43: if (soycFiles.getDepFile() != null) { It's a new requirement. A StandardCompilationAnalysis is now always added even when -soyc is turned off, because it's both useful and fast to generate. When -soyc is off, the SCA will include the split point map but not the other two files. http://gwt-code-reviews.appspot.com/33848/diff/1/10 File dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java (right): http://gwt-code-reviews.appspot.com/33848/diff/1/10#newcode327 Line 327: Will do. http://gwt-code-reviews.appspot.com/33848/diff/1/10#newcode363 Line 363: System.out.println(Completed SOYC phase in Will do. I missed that one. http://gwt-code-reviews.appspot.com/33848/diff/1/11 File dev/core/src/com/google/gwt/dev/jjs/ast/JProgram.java (right): http://gwt-code-reviews.appspot.com/33848/diff/1/11#newcode231 Line 231: private MapInteger, RunAsyncReplacement runAsyncReplacements = new HashMapInteger, RunAsyncReplacement(); It could be d.u.c.Maps.create(). The setter might not be called, in which case an empty map leads to simpler code. http://gwt-code-reviews.appspot.com/33848/diff/1/11#newcode1051 Line 1051: splitPointInitialSequence.addAll(list); It should only be called once. I'll add an assert that the existing sequence is empty. http://gwt-code-reviews.appspot.com/33848/diff/1/6 File dev/core/src/com/google/gwt/dev/jjs/impl/CodeSplitter.java (right): http://gwt-code-reviews.appspot.com/33848/diff/1/6#newcode340 Line 340: * TODO(spoon) accept a labeled runAsync call, once runAsyncs can be labeled Some kind of annotation at the runAsync call site. The details are TBD. http://gwt-code-reviews.appspot.com/33848/diff/1/6#newcode349 Line 349: + PROP_INITIAL_SEQUENCE + : + refString); Yes! http://gwt-code-reviews.appspot.com/33848/diff/1/6#newcode380 Line 380: Method includes multiple runAsync calls, so it's ambiguous which one is meant: On 2009/06/10 23:08:17, bobv wrote: Split the string literal to improve formatting. Sure. This happens after pruning, right? I'll pull up the code and double check, but it shouldn't be called after optimization starts. It should run pre-optimization, so that the jsni references can actually be looked up. This method converts the JSNI reference to an integer, which will be stable for the whole compile. http://gwt-code-reviews.appspot.com/33848/diff/1/6#newcode451 Line 451: MapJMethod, ListInteger revmap = new java.util.HashMapJMethod, ListInteger(); I'll change it to use GWT's hash map. http://gwt-code-reviews.appspot.com/33848/diff/1/8 File dev/core/src/com/google/gwt/dev/jjs/impl/ReplaceRunAsyncs.java (right): http://gwt-code-reviews.appspot.com/33848/diff/1/8#newcode36 Line 36: * by calls to a fragment loader. Will delete. http://gwt-code-reviews.appspot.com/33848 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: configurable -localWorkers for samples
LGTM, we've been needing this for a while. :) http://gwt-code-reviews.appspot.com/36802 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: reworking ant targets to allow single-platform use
http://gwt-code-reviews.appspot.com/37803/diff/1/2 File build.xml (right): http://gwt-code-reviews.appspot.com/37803/diff/1/2#newcode21 Line 21: target name=dist-one depends=buildonly, tools, samples, doc description=Make this platform's distributions Now would be a good opportunity to add comments to document what these different targets are intended to do. I like to have a summary of the 'user oriented' targets at the top of the ant file. I think that 'one' refers to build a distribution for just one platform, but someone else might think it means building one permutation of the samples or something like that. http://gwt-code-reviews.appspot.com/37803/diff/1/2#newcode72 Line 72: antcall target=buildtools Maybe a macrodef would help shrink the amount of code after getting rid of the -do construct? macrodef name=call-checkstyle attribute name=target / sequential antcall targ...@{target} param name=target value=checkstyle / /antcall /sequential /macrodef call-checkstyle target=buildtools / call-checkstyle target=dev / ... (I wish I could find something like a for loop) http://gwt-code-reviews.appspot.com/37803/diff/1/2#newcode93 Line 93: antcall target=buildtools same here - consider a macrodef. http://gwt-code-reviews.appspot.com/37803 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: reworking ant targets to allow single-platform use
http://gwt-code-reviews.appspot.com/37803/diff/1/2 File build.xml (right): http://gwt-code-reviews.appspot.com/37803/diff/1/2#newcode21 Line 21: target name=dist-one depends=buildonly, tools, samples, doc description=Make this platform's distributions On 2009/06/11 17:41:56, zundel wrote: Now would be a good opportunity to add comments to document what these different targets are intended to do. I like to have a summary of the 'user oriented' targets at the top of the ant file. I think that 'one' refers to build a distribution for just one platform, but someone else might think it means building one permutation of the samples or something like that. I was actually planning to resort them (separately, and after this approval, rather than introducing gratuitous diffs) so that ant -p would have the sorting you describe, yes. (Currently it's at least mostly alphabetical, which is readily computable but not particularly useful...) And the description is intended to suggest one - this platform, though I can obviously rework that wording. I'd rather have a good description than rely on comments (which, after all, might not be read, aren't displayed by ant -p, etc.) http://gwt-code-reviews.appspot.com/37803/diff/1/2#newcode72 Line 72: antcall target=buildtools On 2009/06/11 17:41:56, zundel wrote: Maybe a macrodef would help shrink the amount of code after getting rid of the -do construct? macrodef name=call-checkstyle attribute name=target / sequential antcall targ...@{target} param name=target value=checkstyle / /antcall /sequential /macrodef call-checkstyle target=buildtools / call-checkstyle target=dev / ... (I wish I could find something like a for loop) There's a foreach in ant-contrib, but it invokes a target as its body, which I've always found really annoying and counter-clarifying. But yes, we can make a macro (and parameterize both the subproject, what you're calling target there, and the target within it, so the macro can be reused below). http://gwt-code-reviews.appspot.com/37803 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] [google-web-toolkit commit] r5539 - Merge trunk 5538 to the 6/2 snapshot branch.
Author: j...@google.com Date: Thu Jun 11 11:36:32 2009 New Revision: 5539 Modified: branches/snapshot-2009.06.02-r5498/branch-info.txt branches/snapshot-2009.06.02-r5498/dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js Log: Merge trunk 5538 to the 6/2 snapshot branch. r5538 | j...@google.com | 2009-06-11 09:24:20 -0400 (Thu, 11 Jun 2009) | 4 lines Fixes typo that confused __MODULE_NAME__ with __MODULE_FUNC__, leading to startup failures in pre-1.6-hosted-mode. Review: http://gwt-code-reviews.appspot.com/37802 (TBR) svn merge -c5538 https://google-web-toolkit.googlecode.com/svn/trunk . Modified: branches/snapshot-2009.06.02-r5498/branch-info.txt == --- branches/snapshot-2009.06.02-r5498/branch-info.txt (original) +++ branches/snapshot-2009.06.02-r5498/branch-info.txt Thu Jun 11 11:36:32 2009 @@ -24,3 +24,5 @@ svn merge -c5530 https://google-web-toolkit.googlecode.com/svn/trunk . /trunk 5532 was merged into this branch (yet more fixes from 5523) svn merge -c5532 https://google-web-toolkit.googlecode.com/svn/trunk . +/trunk 5538 was merged into this branch (final(?) fix from 5523) + svn merge -c5538 https://google-web-toolkit.googlecode.com/svn/trunk . Modified: branches/snapshot-2009.06.02-r5498/dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js == --- branches/snapshot-2009.06.02-r5498/dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js (original) +++ branches/snapshot-2009.06.02-r5498/dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js Thu Jun 11 11:36:32 2009 @@ -347,7 +347,7 @@ // onScriptLoad()). var win = scriptFrame.contentWindow; if (isHostedMode()) { -win.name = '__MODULE_NAME__'; +win.name = '__MODULE_FUNC__'; } // Set this *before* calling doc.write(), because the linux hosted-mode --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: initial load sequence for runAsync's
How about now? In addition to the requested changes, I changed two other things: 1. The SOYC timings use PerfLogger now, rather than inlined timing code 2. There is a check for the same split point being specified multiple times in the initial sequence http://gwt-code-reviews.appspot.com/33848 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] [google-web-toolkit commit] r5540 - JsStaticEval now optimizes certain if statements to conditional operators.
Author: sco...@google.com Date: Thu Jun 11 12:08:45 2009 New Revision: 5540 Modified: trunk/dev/core/src/com/google/gwt/dev/js/JsStaticEval.java trunk/dev/core/test/com/google/gwt/dev/js/JsStaticEvalTest.java Log: JsStaticEval now optimizes certain if statements to conditional operators. if (a()) {b()} else {c()} - a()?b():c() if (a()) {b()} - a()b() if (a()) {} else {b()} - a()||b() Patch by: mmastrac Suggested by: me Review by: me Modified: trunk/dev/core/src/com/google/gwt/dev/js/JsStaticEval.java == --- trunk/dev/core/src/com/google/gwt/dev/js/JsStaticEval.java (original) +++ trunk/dev/core/src/com/google/gwt/dev/js/JsStaticEval.java Thu Jun 11 12:08:45 2009 @@ -352,32 +352,50 @@ } else { boolean thenIsEmpty = isEmpty(thenStmt); boolean elseIsEmpty = isEmpty(elseStmt); - +JsExpression thenExpr = extractExpression(thenStmt); +JsExpression elseExpr = extractExpression(elseStmt); + if (thenIsEmpty elseIsEmpty) { + // Convert if (a()) {} = a(). ctx.replaceMe(expr.makeStmt()); +} else if (thenExpr != null elseExpr != null) { + // Convert if (a()) {b()} else {c()} = a()?b():c(). + sourceInfo = x.getSourceInfo().makeChild(StaticEvalVisitor.class, + Replaced if statement with conditional); + + JsConditional cond = new JsConditional(sourceInfo, x.getIfExpr(), + thenExpr, elseExpr); + ctx.replaceMe(accept(cond.makeStmt())); +} else if (thenIsEmpty elseExpr != null) { + // Convert if (a()) {} else {b()} = a()||b(). + sourceInfo = x.getSourceInfo().makeChild(StaticEvalVisitor.class, + Replaced if statement with ||); + + JsBinaryOperation op = new JsBinaryOperation(sourceInfo, + JsBinaryOperator.OR, x.getIfExpr(), elseExpr); + ctx.replaceMe(accept(op.makeStmt())); } else if (thenIsEmpty !elseIsEmpty) { - /* - * If the then block is blank, but the else statement has statements, - * invert the test - */ + // Convert if (a()) {} else {stuff} = if (!a()) {stuff}. sourceInfo = x.getSourceInfo().makeChild(StaticEvalVisitor.class, Simplified if with empty then statement); JsUnaryOperation negatedOperation = new JsPrefixOperation(sourceInfo, JsUnaryOperator.NOT, x.getIfExpr()); JsIf newIf = new JsIf(sourceInfo, negatedOperation, elseStmt, null); - ctx.replaceMe(accept(newIf)); +} else if (elseIsEmpty thenExpr != null) { + // Convert if (a()) {b()} = a()b(). + sourceInfo = x.getSourceInfo().makeChild(StaticEvalVisitor.class, + Replaced if statement with ); + + JsBinaryOperation op = new JsBinaryOperation(sourceInfo, + JsBinaryOperator.AND, x.getIfExpr(), thenExpr); + ctx.replaceMe(accept(op.makeStmt())); } else if (elseIsEmpty elseStmt != null) { - /* - * If the else statement is present but has no effective statements, - * prune it - */ + // Convert if (a()) {b()} else {} = if (a()) {b()}. sourceInfo = x.getSourceInfo().makeChild(StaticEvalVisitor.class, Pruned empty else statement); - JsIf newIf = new JsIf(sourceInfo, x.getIfExpr(), thenStmt, null); - ctx.replaceMe(accept(newIf)); } } @@ -583,6 +601,26 @@ public static boolean exec(JsProgram program) { return (new JsStaticEval(program)).execImpl(); + } + + /** + * Attempts to extract a single expression from a given statement and returns + * it. If no such expression exists, returns codenull/code. + */ + protected static JsExpression extractExpression(JsStatement stmt) { +if (stmt == null) { + return null; +} + +if (stmt instanceof JsExprStmt) { + return ((JsExprStmt) stmt).getExpression(); +} + +if (stmt instanceof JsBlock ((JsBlock) stmt).getStatements().size() == 1) { + return extractExpression(((JsBlock) stmt).getStatements().get(0)); +} + +return null; } protected static boolean isEmpty(JsStatement stmt) { Modified: trunk/dev/core/test/com/google/gwt/dev/js/JsStaticEvalTest.java == --- trunk/dev/core/test/com/google/gwt/dev/js/JsStaticEvalTest.java (original) +++ trunk/dev/core/test/com/google/gwt/dev/js/JsStaticEvalTest.java Thu Jun 11 12:08:45 2009 @@ -33,8 +33,13 @@ assertEquals(a();, optimize(if (a()) { })); } + public void testIfWithEmptyThenAndElseExpression() throws Exception { +assertEquals(a()||b();, optimize(if (a()) { } else { b(); })); + } + public void testIfWithEmptyThenAndElse() throws Exception { -
[gwt-contrib] -draftCompile optimizes less
Reviewers: scottb, Description: In trunk, -draftCompile does one full outer loop of the optimization loop. This patch pares that one loop down much further. A one-permutation draft compile of Showcase now takes about 25 seconds, as compared to 27 seconds before. Additionally, the actual optimization step is reduced from about 2.5 seconds to about 500 milliseconds. Most of the remaining optimization time is in MakeCallsStatic, and that would be possible to pare down further. The only calls that really need to be static are those to methods in a few key classes including String and Object. I coded that up, but backed it out of this patch because it looks too complicated for the speedup involved. At this point the bottleneck looks like the front end: running the JDT type check and converting the results to GWT internal ASTs. Here are some key parts of a perf log on my machine: ModuleDef.normalize 764ms CompilationState.compile 8837ms Precompile 9759ms Build AST 2877ms draft optimize 549ms The entire compile takes 24424ms. Please review this at http://gwt-code-reviews.appspot.com/38801 Affected files: dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java Index: dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java === --- dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java (revision 5538) +++ dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java (working copy) @@ -366,11 +366,11 @@ toReturn.getArtifacts().add( new StandardCompilationAnalysis(dependencies, stories, splitPoints)); - + System.out.println(Completed SOYC phase in + (System.currentTimeMillis() - soycStart) + ms); } - + System.out.println(Permutation took + (System.currentTimeMillis() - permStart) + ms); return toReturn; @@ -542,6 +542,10 @@ } } + /** + * Perform the minimal amount of optimization to make sure the compile + * succeeds. + */ protected static void draftOptimize(JProgram jprogram) { /* * Record the beginning of optimizations; this turns on certain checks that @@ -550,14 +554,17 @@ */ jprogram.beginOptimizations(); -optimizeLoop(jprogram, false); +PerfLogger.start(draft optimize); -/* - * Ensure that references to dead clinits are removed. Otherwise, the - * application won't run reliably. - */ -jprogram.typeOracle.recomputeAfterOptimizations(); -DeadCodeElimination.exec(jprogram); +PerfLogger.start(Finalizer); +Finalizer.exec(jprogram); +PerfLogger.end(); + +PerfLogger.start(MakeCallsStatic); +MakeCallsStatic.exec(jprogram); +PerfLogger.end(); + +PerfLogger.end(); } protected static void optimize(JJSOptions options, JProgram jprogram) --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Optimize if statements to conditionals and boolean ops if possible
LGTM. Committed at r5540 with minor tweaks. http://gwt-code-reviews.appspot.com/36801 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Optimize if statements to conditionals and boolean ops if possible
Matt, Could you review these two follow-on patches? The second depends on the first. This is mostly non-functional cleanup to make things a little simpler to read. The only substantive change is this: Presently, if we have a CanBooleanEval that fails to resolve, we do nothing else. My second patch allows the failure case to fall through and check for more simplifications. Thanks, Scott --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~--- cleanup2.patch Description: Binary data cleanup1.patch Description: Binary data
[gwt-contrib] Re: -draftCompile optimizes less
LGTM. By the way, instant hosted mode should reduce CompilationState.compile drastically, so help is on the way! http://gwt-code-reviews.appspot.com/38801 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Optimize if statements to conditionals and boolean ops if possible
Both LGTM. Good catch, thanks. :) On 11-Jun-09, at 1:15 PM, Scott Blum wrote: Matt, Could you review these two follow-on patches? The second depends on the first. This is mostly non-functional cleanup to make things a little simpler to read. The only substantive change is this: Presently, if we have a CanBooleanEval that fails to resolve, we do nothing else. My second patch allows the failure case to fall through and check for more simplifications. --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] [google-web-toolkit commit] r5541 - Simple refactoring of SourceInfo generation in JsStaticEval.
Author: sco...@google.com Date: Thu Jun 11 13:01:10 2009 New Revision: 5541 Modified: trunk/dev/core/src/com/google/gwt/dev/js/JsStaticEval.java Log: Simple refactoring of SourceInfo generation in JsStaticEval. Review by: mmastrac Modified: trunk/dev/core/src/com/google/gwt/dev/js/JsStaticEval.java == --- trunk/dev/core/src/com/google/gwt/dev/js/JsStaticEval.java (original) +++ trunk/dev/core/src/com/google/gwt/dev/js/JsStaticEval.java Thu Jun 11 13:01:10 2009 @@ -15,6 +15,7 @@ */ package com.google.gwt.dev.js; +import com.google.gwt.dev.jjs.HasSourceInfo; import com.google.gwt.dev.jjs.SourceInfo; import com.google.gwt.dev.js.ast.CanBooleanEval; import com.google.gwt.dev.js.ast.JsBinaryOperation; @@ -222,17 +223,14 @@ if (condExpr instanceof CanBooleanEval) { CanBooleanEval condEval = (CanBooleanEval) condExpr; if (condEval.isBooleanTrue()) { - // e.g. (true() ? then : else) - true() then - JsBinaryOperation binOp = new JsBinaryOperation( - x.getSourceInfo().makeChild(StaticEvalVisitor.class, - Simplified always-true condition), JsBinaryOperator.AND, + JsBinaryOperation binOp = new JsBinaryOperation(makeSourceInfo(x, + Simplified always-true condition), JsBinaryOperator.AND, condExpr, thenExpr); ctx.replaceMe(accept(binOp)); } else if (condEval.isBooleanFalse()) { // e.g. (false() ? then : else) - false() || else - JsBinaryOperation binOp = new JsBinaryOperation( - x.getSourceInfo().makeChild(StaticEvalVisitor.class, - Simplified always-false condition), JsBinaryOperator.OR, + JsBinaryOperation binOp = new JsBinaryOperation(makeSourceInfo(x, + Simplified always-false condition), JsBinaryOperator.OR, condExpr, elseExpr); ctx.replaceMe(accept(binOp)); } @@ -256,8 +254,8 @@ FindBreakContinueStatementsVisitor visitor = new FindBreakContinueStatementsVisitor(); visitor.accept(x.getBody()); if (!visitor.hasBreakContinueStatements()) { -JsBlock block = new JsBlock(x.getSourceInfo().makeChild( -StaticEvalVisitor.class, Simplified always-false condition)); +JsBlock block = new JsBlock(makeSourceInfo(x, +Simplified always-false condition)); block.getStatements().add(x.getBody()); block.getStatements().add(expr.makeStmt()); ctx.replaceMe(accept(block)); @@ -290,8 +288,8 @@ // If false, replace with initializers and condition. if (cond.isBooleanFalse()) { - JsBlock block = new JsBlock(x.getSourceInfo().makeChild( - StaticEvalVisitor.class, Simplified always-false condition)); + JsBlock block = new JsBlock(makeSourceInfo(x, + Simplified always-false condition)); if (x.getInitExpr() != null) { block.getStatements().add(x.getInitExpr().makeStmt()); } @@ -318,21 +316,19 @@ JsExpression expr = x.getIfExpr(); JsStatement thenStmt = x.getThenStmt(); JsStatement elseStmt = x.getElseStmt(); - SourceInfo sourceInfo; if (expr instanceof CanBooleanEval) { +SourceInfo sourceInfo; CanBooleanEval cond = (CanBooleanEval) expr; JsStatement onlyStmtToExecute; JsStatement removed; if (cond.isBooleanTrue()) { onlyStmtToExecute = thenStmt; removed = elseStmt; - sourceInfo = x.getSourceInfo().makeChild(StaticEvalVisitor.class, - Simplified always-true condition); + sourceInfo = makeSourceInfo(x, Simplified always-true condition); } else if (cond.isBooleanFalse()) { onlyStmtToExecute = elseStmt; removed = thenStmt; - sourceInfo = x.getSourceInfo().makeChild(StaticEvalVisitor.class, - Simplified always-false condition); + sourceInfo = makeSourceInfo(x, Simplified always-false condition); } else { return; } @@ -360,42 +356,36 @@ ctx.replaceMe(expr.makeStmt()); } else if (thenExpr != null elseExpr != null) { // Convert if (a()) {b()} else {c()} = a()?b():c(). - sourceInfo = x.getSourceInfo().makeChild(StaticEvalVisitor.class, - Replaced if statement with conditional); - - JsConditional cond = new JsConditional(sourceInfo, x.getIfExpr(), + JsConditional cond = new JsConditional(makeSourceInfo(x, + Replaced if statement with conditional), x.getIfExpr(), thenExpr, elseExpr); ctx.replaceMe(accept(cond.makeStmt())); } else if (thenIsEmpty elseExpr != null) { // Convert if (a()) {} else
[gwt-contrib] [google-web-toolkit commit] r5542 - Refactor JsStaticEval to allow additional simplification when static eval of the conditio...
Author: sco...@google.com Date: Thu Jun 11 13:01:57 2009 New Revision: 5542 Modified: trunk/dev/core/src/com/google/gwt/dev/js/JsStaticEval.java Log: Refactor JsStaticEval to allow additional simplification when static eval of the condition fails. Review by: mmastrac Modified: trunk/dev/core/src/com/google/gwt/dev/js/JsStaticEval.java == --- trunk/dev/core/src/com/google/gwt/dev/js/JsStaticEval.java (original) +++ trunk/dev/core/src/com/google/gwt/dev/js/JsStaticEval.java Thu Jun 11 13:01:57 2009 @@ -313,81 +313,55 @@ public void endVisit(JsIf x, JsContextJsStatement ctx) { evalBooleanContext.remove(x.getIfExpr()); - JsExpression expr = x.getIfExpr(); - JsStatement thenStmt = x.getThenStmt(); - JsStatement elseStmt = x.getElseStmt(); - if (expr instanceof CanBooleanEval) { -SourceInfo sourceInfo; -CanBooleanEval cond = (CanBooleanEval) expr; -JsStatement onlyStmtToExecute; -JsStatement removed; -if (cond.isBooleanTrue()) { - onlyStmtToExecute = thenStmt; - removed = elseStmt; - sourceInfo = makeSourceInfo(x, Simplified always-true condition); -} else if (cond.isBooleanFalse()) { - onlyStmtToExecute = elseStmt; - removed = thenStmt; - sourceInfo = makeSourceInfo(x, Simplified always-false condition); -} else { + JsExpression condExpr = x.getIfExpr(); + if (condExpr instanceof CanBooleanEval) { +if (tryStaticEvalIf(x, (CanBooleanEval) condExpr, ctx)) { return; } -JsBlock block = new JsBlock(sourceInfo); -block.getStatements().add(expr.makeStmt()); - -if (onlyStmtToExecute != null) { - // We'll see this if the expression is always false and no else - block.getStatements().add(onlyStmtToExecute); -} + } -JsStatement decls = ensureDeclarations(removed); -if (decls != null) { - block.getStatements().add(decls); -} -ctx.replaceMe(accept(block)); - } else { -boolean thenIsEmpty = isEmpty(thenStmt); -boolean elseIsEmpty = isEmpty(elseStmt); -JsExpression thenExpr = extractExpression(thenStmt); -JsExpression elseExpr = extractExpression(elseStmt); - -if (thenIsEmpty elseIsEmpty) { - // Convert if (a()) {} = a(). - ctx.replaceMe(expr.makeStmt()); -} else if (thenExpr != null elseExpr != null) { - // Convert if (a()) {b()} else {c()} = a()?b():c(). - JsConditional cond = new JsConditional(makeSourceInfo(x, - Replaced if statement with conditional), x.getIfExpr(), - thenExpr, elseExpr); - ctx.replaceMe(accept(cond.makeStmt())); -} else if (thenIsEmpty elseExpr != null) { - // Convert if (a()) {} else {b()} = a()||b(). - JsBinaryOperation op = new JsBinaryOperation(makeSourceInfo(x, - Replaced if statement with ||), JsBinaryOperator.OR, - x.getIfExpr(), elseExpr); - ctx.replaceMe(accept(op.makeStmt())); -} else if (thenIsEmpty !elseIsEmpty) { - // Convert if (a()) {} else {stuff} = if (!a()) {stuff}. - JsUnaryOperation negatedOperation = new JsPrefixOperation( - makeSourceInfo(x, Simplified if with empty then statement), - JsUnaryOperator.NOT, x.getIfExpr()); - JsIf newIf = new JsIf(makeSourceInfo(x, - Simplified if with empty then statement), negatedOperation, - elseStmt, null); - ctx.replaceMe(accept(newIf)); -} else if (elseIsEmpty thenExpr != null) { - // Convert if (a()) {b()} = a()b(). - JsBinaryOperation op = new JsBinaryOperation(makeSourceInfo(x, - Replaced if statement with ), JsBinaryOperator.AND, - x.getIfExpr(), thenExpr); - ctx.replaceMe(accept(op.makeStmt())); -} else if (elseIsEmpty elseStmt != null) { - // Convert if (a()) {b()} else {} = if (a()) {b()}. - JsIf newIf = new JsIf( - makeSourceInfo(x, Pruned empty else statement), x.getIfExpr(), - thenStmt, null); - ctx.replaceMe(accept(newIf)); -} + JsStatement thenStmt = x.getThenStmt(); + JsStatement elseStmt = x.getElseStmt(); + boolean thenIsEmpty = isEmpty(thenStmt); + boolean elseIsEmpty = isEmpty(elseStmt); + JsExpression thenExpr = extractExpression(thenStmt); + JsExpression elseExpr = extractExpression(elseStmt); + + if (thenIsEmpty elseIsEmpty) { +// Convert if (a()) {} = a(). +ctx.replaceMe(condExpr.makeStmt()); + } else if (thenExpr != null elseExpr != null) { +// Convert if (a()) {b()} else {c()} = a()?b():c(). +JsConditional cond = new JsConditional(makeSourceInfo(x, +