Stopwatch Example
Dear GWT Group, Is there code that already exists or do you have another suggestion in formatting a seconds value into a stopwatch style string? // Example call: String stopwatch = buildStopwatch(350); // returns 00:05:50 private String formatDigits(int s) { if(s < 10) { return "0" + Integer.toString(s); } else { return Integer.toString(s); } } // Pass seconds. Returns 00:00:00 stop watch format. private String buildStopwatch(int s) { if (s < 60) { return "00" + ":" + "00" + ":" + formatDigits(s); } int minutes = s / 60; int seconds = s % 60; if (minutes < 60) { return "00" + ":" + formatDigits(minutes) + ":" + formatDigits (seconds); } int hours = minutes / 60; minutes = hours % 60; return formatDigits(hours) + ":" + formatDigits(minutes) + ":" + formatDigits(seconds); } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
iGoogle Panels Question
iGoogle has some cool looking sizable panels for storing different apps in. Are those panels available yet in GWT? Thanks Scott --~--~-~--~~~---~--~~ 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: Parent Window using Splitters and DialogBox Question
Ok. I figured out what the root cause of the dialog box blending with the parent widget was: If you show the dialog box first before adding the parent widget to the root panel that's when the blending of the dialog box with the parent widget (window) happens. The easy fix is to just add the parent window to the root panel first. Example: // Working way: RootPanel.get().add(_mainPane); LoginDialog login = new LoginDialog(_mainPane, _security); // Bad Blending way: LoginDialog login = new LoginDialog(_mainPane, _security); RootPanel.get().add(_mainPane); On Jan 21, 4:50 pm, "sjn...@gmail.com" wrote: > I have a created a main window that uses vertical and horizontal > splitters, VerticalSplitPanel and HorizontalSpiltPanel. There's 5 > separate panes in the main view. If I try to open a dialog box, > DialogBox in the main window the dialog box isn't usable and the app > freezes. The only way I found to get around this is to show the > DialogBox first and then not add the main screen to the root panel > until after the user has finished in the DialogBox. Any ideas how to > show a DialogBox in a window using splitters? > > Thanks, > Scott Nichols --~--~-~--~~~---~--~~ 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: Parent Window using Splitters and DialogBox Question
Nevermind on this question. The dialog box is working fine now, but I don't know how it was fixed. The problem was that the dialog box and the parent widget with vertical panel splitters seemed to be blending into each other. Scott On Jan 21, 4:50 pm, "sjn...@gmail.com" wrote: > I have a created a main window that uses vertical and horizontal > splitters, VerticalSplitPanel and HorizontalSpiltPanel. There's 5 > separate panes in the main view. If I try to open a dialog box, > DialogBox in the main window the dialog box isn't usable and the app > freezes. The only way I found to get around this is to show the > DialogBox first and then not add the main screen to the root panel > until after the user has finished in the DialogBox. Any ideas how to > show a DialogBox in a window using splitters? > > Thanks, > Scott Nichols --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Parent Window using Splitters and DialogBox Question
I have a created a main window that uses vertical and horizontal splitters, VerticalSplitPanel and HorizontalSpiltPanel. There's 5 separate panes in the main view. If I try to open a dialog box, DialogBox in the main window the dialog box isn't usable and the app freezes. The only way I found to get around this is to show the DialogBox first and then not add the main screen to the root panel until after the user has finished in the DialogBox. Any ideas how to show a DialogBox in a window using splitters? Thanks, Scott Nichols --~--~-~--~~~---~--~~ 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: Hosted Mode Configuration Question
I'll look into the the -noserver option since hosted tomcat is going away. In GWT 1.5.3 copying the web.xml file from the tomcat server to the GWT's application directory: tomcat/webapss/ROOT/WEB-INF/ worked really well. On Jan 9, 12:58 pm, Sumit Chandel wrote: > Hello everyone, > > Just a note that you would probably want to use hosted mode with the > -noserver option before bulking up the server-side on the embedded Tomcat > server. A few reasons to do this: > > 1) The embedded Tomcat server is somewhat custom built, meaning you can't > expect everything that would work in your plain vanilla Tomcat server to > also work in the embedded Tomcat server. The server is really there as a > means for quickly getting into hosted mode rather than to provide an actual > development application server. > > 2) The embedded Tomcat server is going to be replaced by an embedded Jetty > server in GWT 1.6 for performance reasons. > > You can check out how to use hosted mode with the -noserver option on the > FAQ doc linked below. > > Using hosted mode with the -noserver > option:http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=goog... > > Hope that helps, > -Sumit Chandel > > On Tue, Jan 6, 2009 at 5:18 PM, Joe Cole wrote: > > > > > Just remember that each time you upgrade gwt, or checkout your project > > from source control gwt will overwrite your web.xml. > > We get around this by logging a statement on initialisation that shows > > in the gwt console - if that doesn't appear we know somethings gone > > wrong and check the web.xml. > > > On Jan 7, 2:07 pm, "sjn...@gmail.com" wrote: > > > To answer my own question, existing web.xml files work fine with > > > hosted mode. I was able to setup log4j, jdom, my singleton and other > > > third party server side configuration by just copying the config into > > > the generated GWT web.xml in ./tomcat/webapss/ROOT/WEB-INF/web.xml and > > > I created a subdirectory called lib and put my third party server side > > > JARS in there and the hosted mode tomcat found them fine. > > > > On Jan 6, 6:20 pm, "sjn...@gmail.com" wrote: > > > > > I want to port a small tomcat application to use GWT hosted mode, but > > > > I want to know if I can port the following setting to the *.gwt.xml > > > > file from the web.xml file? See below. > > > > > > > > > > > > com.toyota.agentstatus.server.controller.FlatFileReaderFactory > > > > > > > > > > > > > > > > > csv.start.hour > > > > 05 > > > > java.lang.Integer > > > > > > > > > The first setting is a class that gets loaded on the server at start > > > > up as a singleton. As its name suggest it caches the data read from a > > > > CSV file. The environment entry tells the singleton to load the cache > > > > run at 5:00 AM daily. > > > > > I didn't see in the docs how to add this to my gwt.xml file. Is there > > > > away to add these settings? > > > > > Thanks > > > > Scott --~--~-~--~~~---~--~~ 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: same-origin security restriction
The light bulb finally lit for me. There's browser security rules in place that only allow Ajax to communicate with the same server as the main page. If GWT hosted mode allowed it then in the future when you deployed to production your app wouldn't work. I'm going to change my implementation to have the external data sources route through the server, but may need to add load balancing because of the extra load now on the server. Nothings ever to easy. On Jan 6, 1:10 pm, Scooter wrote: > Please allow this to either be a configurable option or a prompt when > accessing external URL. I test against a variety of complex data > sources for our web server where duplicating on my development machine > is almost impossible. It is also an issue when we get a bug report in > production that I can point to the appropriate web server and debug > the problem. I can't upgrade to the latest 1.5 and really want to > avoid the proxy overhead. --~--~-~--~~~---~--~~ 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: Best way to add App configuration properties
Gregor, I was able to get around it by what Joe Cole mentioned above by just overwriting the GWT applications generated web.xml. It works fine. I even created a subdirectory called lib under WEB-INF and put my third party server side JARs there. The seems the way to go if you need to start up singletons when tomcat starts or need env properties in the web.xml Scott On Jan 6, 9:49 pm, Joe Cole wrote: > Hi Gregor, > > We don't hack the web.xml in the jar file, but that's a good idea! > Obviously the only pitfall is when gwt versions change or you checkout > on another computer and gwt overwrites the web.xml - you just have to > remember to update it. Our structure of the tomcat/webapps/ROOT/WEB- > INF directory is: > web.xml > web.xml.custom > readme.txt > > readme.txt is: > The web.xml here _must not be directly changed_. Instead, change > web.xml.custom > and put the contents of that in web.xml. Then mark web.xml readonly, > and commit > everything. If you don't do this, GWT will overwrite web.xml, > everything will > break, and it'll get committed, and it's a pain to track down the > cause. > > The reason for the .custom is so that when this happens, there is an > up-to-date > source of what the file should contain handy. > > :) > > Joe > > On Jan 7, 2:58 pm, gregor wrote: > > > Oh, I see now what Joe's done. Hack the web.xml in the gwt-dev-xxx > > jar. Make sure to do it again when you upgrade GWT versions. That's a > > cool way to get round it. > > > On Jan 7, 1:36 am, gregor wrote: > > > > Hi Scott, > > > > If you want to use features like this kicked off from web.xml then you > > > probably need to run hosted mode with the -noserver option. You cannot > > > access and modify web.xml for hosted mode embedded Tomcat. To run > > > using -noserver efectively you just need an Ant build file you can > > > easily run from your IDE to deploy your RPC servlets etc to your own > > > Tomcat instance when you change them, and then set a remote debugging > > > session on it so you can debug them if needed. > > > > Another way to get round this problem it is to instantiate all your > > > start up stuff from a static method in some class that when deployed > > > that gets called from a simple startup servlet instead of using > > > web.xml tags. Now that won't get called in GWT hosted mode (because > > > you can't edit web.xml to add a startup servlet...). But if you add a > > > static boolean to that start up class which gets set when its static > > > config method is run, then you can test for this in an init() method > > > of the first RPC servlet your application calls (or you can add a new > > > RPC service that specifically calls it using an if (!GWT.isScript()) > > > clause in onModuleLoad() which will be ignored in deployed mode). It > > > will then pick this up in hosted mode and call the config method, but > > > ignore it in deployed mode. It's a crude workaround, but it does work. > > > > Basically, if you want to use web.xml based conveniences they won't > > > work in normal GWT hosted mode. I don't think there are any plans to > > > change that, I guess because doing so would complicate things for > > > normal hosted mode operation and require a lot of work to do. > > > > regards > > > gregor > > > > On Jan 7, 12:42 am, "sjn...@gmail.com" > > > wrote: > > > > > It's great we got this figured out, but how come GWT hosted mode > > > > doesnt work with exisitng web.xml files so we dont have to code > > > > special configuration for development and production deployment? > > > > > Scott > > > > > On Dec 12 2008, 4:26 pm, Joe Cole > > > > wrote: > > > > > > Oh, and in your web.xml's that you ship to your production environment > > > > > you would have a different listener setup. > > > > > > > > > > > > > > > > com.yourcompany.ProductionConfiguration > > > > > > > > > > > On Dec 13, 11:00 am, Joe Cole wrote: > > > > > > > Here is our way: > > > > > > > In: > > > > > > tomcat/webapps/ROOT/WEB-INF/web.xml > > > > > > > > > > > > > jdbc/dbsource > > > > > > javax.sql.DataSource > > > > > > Container > > > > > > > > > > > > > > > >
Re: Hosted Mode Configuration Question
To answer my own question, existing web.xml files work fine with hosted mode. I was able to setup log4j, jdom, my singleton and other third party server side configuration by just copying the config into the generated GWT web.xml in ./tomcat/webapss/ROOT/WEB-INF/web.xml and I created a subdirectory called lib and put my third party server side JARS in there and the hosted mode tomcat found them fine. On Jan 6, 6:20 pm, "sjn...@gmail.com" wrote: > I want to port a small tomcat application to use GWT hosted mode, but > I want to know if I can port the following setting to the *.gwt.xml > file from the web.xml file? See below. > > > > com.toyota.agentstatus.server.controller.FlatFileReaderFactory > > > > > csv.start.hour > 05 > java.lang.Integer > > > The first setting is a class that gets loaded on the server at start > up as a singleton. As its name suggest it caches the data read from a > CSV file. The environment entry tells the singleton to load the cache > run at 5:00 AM daily. > > I didn't see in the docs how to add this to my gwt.xml file. Is there > away to add these settings? > > Thanks > Scott --~--~-~--~~~---~--~~ 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: Best way to add App configuration properties
To answer my own question. It works fine with existing web.xml file. Just copy them over the generated file as mentioned above. On Jan 6, 6:42 pm, "sjn...@gmail.com" wrote: > It's great we got this figured out, but how come GWT hosted mode > doesnt work with exisitng web.xml files so we dont have to code > special configuration for development and production deployment? > > Scott > > On Dec 12 2008, 4:26 pm, Joe Cole > wrote: > > > Oh, and in your web.xml's that you ship to your production environment > > you would have a different listener setup. > > > > > > > com.yourcompany.ProductionConfiguration > > > > > On Dec 13, 11:00 am, Joe Cole wrote: > > > > Here is our way: > > > > In: > > > tomcat/webapps/ROOT/WEB-INF/web.xml > > > > > > > jdbc/dbsource > > > javax.sql.DataSource > > > Container > > > > > > > > > com.yourcompany.LocalConfiguration > > > class> > > > > > > > The only gotcha with this is that when you upgrade gwt it changes the > > > web.xml - we just revert it from version control and all works well. > > > > That listener sets up the entire servlet side, including properties & > > > guice bindings: > > > > public class LocalConfiguration extends AbstractConfiguration { > > > protected IPropertyManager createPropertyManager( > > > final ServletContext context) { > > > return new LocalPropertyManager(); > > > } > > > public IBindings getBindings() { > > > return new LocalBindings(); > > > } > > > > } > > > > This allows us to ship different setups to the system depending on > > > where it's being used (one for hosted mode, production, test, staging > > > etc). > > > The datasource is container managed which is why it's defined in the > > > file. > > > > The other file you will need for hosted mode is: > > > tomcat/conf/gwt/localhost/ROOT.xml > > > > > antiJARLocking="false" debug="1" reloadable="true" > > > path=""> > > > > > > > > > > > > > type="javax.sql.DataSource" /> > > > > > > > > > > > factory > > > > > > > org.apache.commons.dbcp.BasicDataSourceFactory > > > > > > > > > > > > > username > > > YOURDBUSERNAME > > > > > > > > > password > > > SECRET > > > > > > > > > driverClassName > > > org.postgresql.Driver > > > > > > > > > url > > > jdbc:postgresql://URL/DB > > > > > > > > > > > > > > Let me know if this is useful - it took us a while to get this right, > > > and we have used it in multiple deployed apps and it works well. --~--~-~--~~~---~--~~ 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: Best way to add App configuration properties
It's great we got this figured out, but how come GWT hosted mode doesnt work with exisitng web.xml files so we dont have to code special configuration for development and production deployment? Scott On Dec 12 2008, 4:26 pm, Joe Cole wrote: > Oh, and in your web.xml's that you ship to your production environment > you would have a different listener setup. > > > com.yourcompany.ProductionConfiguration > > > On Dec 13, 11:00 am, Joe Cole wrote: > > > Here is our way: > > > In: > > tomcat/webapps/ROOT/WEB-INF/web.xml > > > > > jdbc/dbsource > > javax.sql.DataSource > > Container > > > > > > com.yourcompany.LocalConfiguration class> > > > > > The only gotcha with this is that when you upgrade gwt it changes the > > web.xml - we just revert it from version control and all works well. > > > That listener sets up the entire servlet side, including properties & > > guice bindings: > > > public class LocalConfiguration extends AbstractConfiguration { > > protected IPropertyManager createPropertyManager( > > final ServletContext context) { > > return new LocalPropertyManager(); > > } > > public IBindings getBindings() { > > return new LocalBindings(); > > } > > > } > > > This allows us to ship different setups to the system depending on > > where it's being used (one for hosted mode, production, test, staging > > etc). > > The datasource is container managed which is why it's defined in the > > file. > > > The other file you will need for hosted mode is: > > tomcat/conf/gwt/localhost/ROOT.xml > > > antiJARLocking="false" debug="1" reloadable="true" path=""> > > > > > > > > > type="javax.sql.DataSource" /> > > > > > > > > factory > > > > > org.apache.commons.dbcp.BasicDataSourceFactory > > > > > > > > > username > > YOURDBUSERNAME > > > > > > password > > SECRET > > > > > > driverClassName > > org.postgresql.Driver > > > > > > url > > jdbc:postgresql://URL/DB > > > > > > > > > > Let me know if this is useful - it took us a while to get this right, > > and we have used it in multiple deployed apps and it works well. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Hosted Mode Configuration Question
I want to port a small tomcat application to use GWT hosted mode, but I want to know if I can port the following setting to the *.gwt.xml file from the web.xml file? See below. com.toyota.agentstatus.server.controller.FlatFileReaderFactory csv.start.hour 05 java.lang.Integer The first setting is a class that gets loaded on the server at start up as a singleton. As its name suggest it caches the data read from a CSV file. The environment entry tells the singleton to load the cache run at 5:00 AM daily. I didn't see in the docs how to add this to my gwt.xml file. Is there away to add these settings? Thanks Scott --~--~-~--~~~---~--~~ 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: same-origin security restriction
I don't get the error and why special configuration is needed. This is truly wasting many developers time. I'm able to access the local URL anywhere except in GWT hosted mode. It works fine from other browsers and scripts. On Nov 19 2008, 7:33 pm, Sumit Chandel wrote: > Hi Danny, > > The issue you ran into is not actually a bug but an improvement in 1.5.3 in > terms of browser security compliance. > > Basically, the remote data you are fetching is indeed violating the single > origin policy, which is why you are seeing the error message come up in the > hosted mode console. > > The two ways to enable cross-site communication would be to use -noserver > with a proxy that could delegate the calls or using the JSONP technique. > Both are described in a bit more detail on the Groups post linked below: > > http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa... > > Hope that helps, > -Sumit Chandel > > On Thu, Nov 13, 2008 at 5:05 PM, Danny wrote: > > > Just thought I'd post an update... > > > I downgraded from 1.5.3 to 1.5.2 and its now working so I guess this > > is a bug with 1.5.3. > > > Regards, > > Danny > > > On Nov 14, 12:40 am, Danny wrote: > > > Hi All, > > > > I finally got round to making my app run in 1.5 and all is looking > > > good. However I often use hosted mode with remote data, which helps > > > massively when debugging issues. I am using RequestBuilder. > > > > I'm getting a weird error in 1.5, if I switch back to 1.4 it works > > > perfectly. I get the following when in hosted mode. > > > > The URLhttp://x.x.x.x/.zzzisinvalid or violates the same-origin > > > security restriction > > > > I've enabled cross-brower communication in Internet Explorer and added > > > the site to my Local Intranet, but still not joy. > > > > Can anyone shed any light on this? > > > > Many thanks, > > > Danny --~--~-~--~~~---~--~~ 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: same-origin security restriction
This is not an improvement and wasting many developers time. Scott On Nov 19 2008, 7:33 pm, Sumit Chandel wrote: > Hi Danny, > > The issue you ran into is not actually a bug but an improvement in 1.5.3 in > terms of browser security compliance. > > Basically, the remote data you are fetching is indeed violating the single > origin policy, which is why you are seeing the error message come up in the > hosted mode console. > > The two ways to enable cross-site communication would be to use -noserver > with a proxy that could delegate the calls or using the JSONP technique. > Both are described in a bit more detail on the Groups post linked below: > > http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa... > > Hope that helps, > -Sumit Chandel > > On Thu, Nov 13, 2008 at 5:05 PM, Danny wrote: > > > Just thought I'd post an update... > > > I downgraded from 1.5.3 to 1.5.2 and its now working so I guess this > > is a bug with 1.5.3. > > > Regards, > > Danny > > > On Nov 14, 12:40 am, Danny wrote: > > > Hi All, > > > > I finally got round to making my app run in 1.5 and all is looking > > > good. However I often use hosted mode with remote data, which helps > > > massively when debugging issues. I am using RequestBuilder. > > > > I'm getting a weird error in 1.5, if I switch back to 1.4 it works > > > perfectly. I get the following when in hosted mode. > > > > The URLhttp://x.x.x.x/.zzzisinvalid or violates the same-origin > > > security restriction > > > > I've enabled cross-brower communication in Internet Explorer and added > > > the site to my Local Intranet, but still not joy. > > > > Can anyone shed any light on this? > > > > Many thanks, > > > Danny --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---