Re: onLoad method of Composite is not called.
The LoadEvent is a native browser event that will be fired once the browser has downloaded some resources. So it does not apply to a GWT widget. But every GWT widget (and thus Composite as well) has a protected onLoad / onUnload method that you can override to execute code once the widget has been attached/detached to/from the DOM. -- J. -- You received this message because you are subscribed to the Google Groups "GWT Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at https://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
onLoad method of Composite is not called.
Hello all, I have a class that extends Composite. I want to do some action when the component is loaded. The class implements the HasLoadHandlers and a LoadHandler is defined and added to the component. The problem is that the onLoad method is never called. Am I missing something? Thanks -- You received this message because you are subscribed to the Google Groups "GWT Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at https://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: Why is getOffsetWidth/getOffsetHeight returning 0 even after onLoad is called for LayoutPanel children?
after updating chrome and FF to latest version, I am having the same problem. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/NcZg1o2nM3MJ. 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: getOffsetHeight returns 0 although onload has been called
getOffsetHeight() of an element which *display* property was set to *none*will always return 0 -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/0X-b56QdlBQJ. 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: getOffsetHeight returns 0 although onload has been called
Make sure your widget is attached (check the attached property) before requesting the widget for any dimensions. Example: in my animation components I always first check that the widget is attached as otherwise the animations are based on (most of the time) incorrect dimensions as the browser didn't had time to render them correctly. This check overcomes a lot of 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.
Re: getOffsetHeight returns 0 although onload has been called
Thank you for your suggestions, however, the display property is not set to none, actually is not set at all. Thanks, G -- Please consider the environment before printing this e-mail The Newspaper Marketing Agency: Opening Up Newspapers: http://www.nmauk.co.uk/ This e-mail and any attachments are confidential, may be legally privileged and are the property of NI Group Limited (which is the holding company for the News International group, is registered in England under number 81701 and whose registered office is 3 Thomas More Square, London E98 1XY, VAT number GB 243 8054 69), on whose systems they were generated. If you have received this e-mail in error, please notify the sender immediately and do not use, distribute, store or copy it in any way. Statements or opinions in this e-mail or any attachment are those of the author and are not necessarily agreed or authorised by NI Group Limited or any member of its group. NI Group Limited may monitor outgoing or incoming emails as permitted by law. It accepts no liability for viruses introduced by this e-mail or attachments. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/7EoLdpEd_REJ. 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: getOffsetHeight returns 0 although onload has been called
t @Vitrums I am convinced that my problem is caused because the property display is set to none, however I don't know how to solve it. I could add an AnimationCallback on the decklayoutPanel to find out when the widget is finally being displayed, but that kinda defeats the use of Activity.start() LazyLoading and how to implement this? Any suggestions? Many thanks for your help so far! -G -- Please consider the environment before printing this e-mail The Newspaper Marketing Agency: Opening Up Newspapers: http://www.nmauk.co.uk/ This e-mail and any attachments are confidential, may be legally privileged and are the property of NI Group Limited (which is the holding company for the News International group, is registered in England under number 81701 and whose registered office is 3 Thomas More Square, London E98 1XY, VAT number GB 243 8054 69), on whose systems they were generated. If you have received this e-mail in error, please notify the sender immediately and do not use, distribute, store or copy it in any way. Statements or opinions in this e-mail or any attachment are those of the author and are not necessarily agreed or authorised by NI Group Limited or any member of its group. NI Group Limited may monitor outgoing or incoming emails as permitted by law. It accepts no liability for viruses introduced by this e-mail or attachments. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/-JrQ5PYjQcAJ. 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: getOffsetHeight returns 0 although onload has been called
Use firebug to analyze your problem. If it's your display property then change this by widget.getElement().getStyle().setDisplay(Display.BLOCK) (can be little different). By default the Display property is set to auto so if you aren't setting it, it wouldn't give you any problem. On Nov 30, 1:19 pm, George Agiasoglou george.agiasog...@newsint.co.uk wrote: t @Vitrums I am convinced that my problem is caused because the property display is set to none, however I don't know how to solve it. I could add an AnimationCallback on the decklayoutPanel to find out when the widget is finally being displayed, but that kinda defeats the use of Activity.start() LazyLoading and how to implement this? Any suggestions? Many thanks for your help so far! -G -- Please consider the environment before printing this e-mail The Newspaper Marketing Agency: Opening Up Newspapers: http://www.nmauk.co.uk/ This e-mail and any attachments are confidential, may be legally privileged and are the property of NI Group Limited (which is the holding company for the News International group, is registered in England under number 81701 and whose registered office is 3 Thomas More Square, London E98 1XY, VAT number GB 243 8054 69), on whose systems they were generated. If you have received this e-mail in error, please notify the sender immediately and do not use, distribute, store or copy it in any way. Statements or opinions in this e-mail or any attachment are those of the author and are not necessarily agreed or authorised by NI Group Limited or any member of its group. NI Group Limited may monitor outgoing or incoming emails as permitted by law. It accepts no liability for viruses introduced by this e-mail or attachments. -- 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: getOffsetHeight returns 0 although onload has been called
The problem is that I call getOffsetHeight/Width on a panel which belongs to a widget which has display property set to none. The display property is set to none because that widget is not currently displayed by the decklayoutpanel but it is attached to it, which is the desired behaviour. I am using firebug and chrome dev tools extensively. To use those tools, that means that your view is layed out in the browser so everything is fine. The DeckLayoutPanel sets disiplay: none to all its children apart from the one currently being displayed. I tried, to postpone the call to getOffsetHeight after deckLayoutPanel.setWidget(widget) but still returned 0. Thanks, G pulls his hair :( -- Please consider the environment before printing this e-mail The Newspaper Marketing Agency: Opening Up Newspapers: http://www.nmauk.co.uk/ This e-mail and any attachments are confidential, may be legally privileged and are the property of NI Group Limited (which is the holding company for the News International group, is registered in England under number 81701 and whose registered office is 3 Thomas More Square, London E98 1XY, VAT number GB 243 8054 69), on whose systems they were generated. If you have received this e-mail in error, please notify the sender immediately and do not use, distribute, store or copy it in any way. Statements or opinions in this e-mail or any attachment are those of the author and are not necessarily agreed or authorised by NI Group Limited or any member of its group. NI Group Limited may monitor outgoing or incoming emails as permitted by law. It accepts no liability for viruses introduced by this e-mail or attachments. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/yWhVRKHQDakJ. 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: getOffsetHeight returns 0 although onload has been called
getOffsetHeight/Width only returns a value other than 0 if the element has been successfully rendered by the browser (possibly including elements that have visibility:hidden css). When you call DeckLayoutPanel.setWidget(w) the DeckLayoutPanel schedules a layout command which will be executed after all of your code has been executed and just before the browser takes back control (see: Scheduler.get().scheduleFinally()). I think this has been done because you could call DeckLayoutPanel.setWidget() multiple times in your code, but when your code is done, the necessary DOM operations will be executed only once. You can force the DOM operations by calling DeckLayoutPanel.forceLayout() just after you have called DeckLayoutPanel.setWidget() and then try to do your calculations. But I am not quite sure if its enough. If not, your best bet is to defer your calculations until everything has been rendered by the browser: final Panel p = ... Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { public void run() { p.getOffsetHeight() ... //calculate your stuff } }); Using a deferred command should definitely work. -- J. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/OdIl5VrlkJMJ. 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: getOffsetHeight returns 0 although onload has been called
You don't need getOffsetHeight to achieve what you want. There are two solutions: 1. Use LayoutPanel instead of DockLayoutPanel. LayoutPanel allows you to add two widgets that occupy the same space. If you don't specify the position of each child widget, each child widget will occupy the entire space available. From this moment all you need to do is hide one of them depending on where users clicks. 2. When necessary, detach one widget and attach the other one. In each case these widgets should pick up their size automatically from their parent widget - there is no need to set their size explicitly as long as you use widgets that support resize. -- 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: getOffsetHeight returns 0 although onload has been called
Unfortunately, I need the width and height of the area because I append that information on a url. I will try the deferred command and let you know. Many thanks, G -- Please consider the environment before printing this e-mail The Newspaper Marketing Agency: Opening Up Newspapers: http://www.nmauk.co.uk/ This e-mail and any attachments are confidential, may be legally privileged and are the property of NI Group Limited (which is the holding company for the News International group, is registered in England under number 81701 and whose registered office is 3 Thomas More Square, London E98 1XY, VAT number GB 243 8054 69), on whose systems they were generated. If you have received this e-mail in error, please notify the sender immediately and do not use, distribute, store or copy it in any way. Statements or opinions in this e-mail or any attachment are those of the author and are not necessarily agreed or authorised by NI Group Limited or any member of its group. NI Group Limited may monitor outgoing or incoming emails as permitted by law. It accepts no liability for viruses introduced by this e-mail or attachments. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/RDqZBFHY9mcJ. 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: getOffsetHeight returns 0 although onload has been called
Absolutely brilliant, the deferred command worked like a charm. Many thanks to all of you! -G -- Please consider the environment before printing this e-mail The Newspaper Marketing Agency: Opening Up Newspapers: http://www.nmauk.co.uk/ This e-mail and any attachments are confidential, may be legally privileged and are the property of NI Group Limited (which is the holding company for the News International group, is registered in England under number 81701 and whose registered office is 3 Thomas More Square, London E98 1XY, VAT number GB 243 8054 69), on whose systems they were generated. If you have received this e-mail in error, please notify the sender immediately and do not use, distribute, store or copy it in any way. Statements or opinions in this e-mail or any attachment are those of the author and are not necessarily agreed or authorised by NI Group Limited or any member of its group. NI Group Limited may monitor outgoing or incoming emails as permitted by law. It accepts no liability for viruses introduced by this e-mail or attachments. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/x_-jcUPFoc0J. 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.
getOffsetHeight returns 0 although onload has been called
Hi group, Consider an application which has a *DeckLayoutPanel* as a shell, and has two DockLayoutPanel as children, which means only one child is shown at any time. I am using MVP with Activities and Places, there are two places and each place corresponds to displaying a child. When the app is initialised both children are injected (by gin) and added to the *DeckLayoutPanel.* And looks like class MyApplication { MyApplication(DockLayoutPanel child1, DockLayoutPanel child2) { ... } ... } Application displays child1, user changes to other place to display child2. Everything is displayed fine however I need to calculate an area using getOffsetHeight and getOffsetWidth, however both calls return 0. If now I change the token of the place in the url to another valid token both calls return actual values. Any ideas why this is happening? Thanks, G -- Please consider the environment before printing this e-mail The Newspaper Marketing Agency: Opening Up Newspapers: http://www.nmauk.co.uk/ This e-mail and any attachments are confidential, may be legally privileged and are the property of NI Group Limited (which is the holding company for the News International group, is registered in England under number 81701 and whose registered office is 3 Thomas More Square, London E98 1XY, VAT number GB 243 8054 69), on whose systems they were generated. If you have received this e-mail in error, please notify the sender immediately and do not use, distribute, store or copy it in any way. Statements or opinions in this e-mail or any attachment are those of the author and are not necessarily agreed or authorised by NI Group Limited or any member of its group. NI Group Limited may monitor outgoing or incoming emails as permitted by law. It accepts no liability for viruses introduced by this e-mail or attachments. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/fCUPHJxuNY0J. 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.
what is the difference between onAttach() and onLoad()?
for a widget,what is the difference of usage between onAttach() and onLoad()? -- 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: Image onLoad doesn't fire in production
Just an idea, could it be your prefetch is already finished by the time you are registering the onload handler? So you would have missed the event. Try putting the addLoadHandler before the image.prefetch. cheers Geert -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/r7S30qEE9nAJ. 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.
Image onLoad doesn't fire in production
Greetings gentlemen, So my app is working perfectly on development but not on production and i can't figure out why. Here's a view class and it's supposed to load an image and then with that data draw it on a canvas, problem is on production my onLoad event isn't firing. Here's the class(it's quite messy, sorry for that.) http://pastebin.com/FsfDTRSk Is there any reason why it's not loading on production? The link i'm providing looks like this: http://lh5.ggpht.com/31_b6Vv_Py7kLvRuKUicwAKZ3n9Eps4nQE9EgRLe2KFVlbYfPT6lG8yAknlKuOc6tvMGVQP8neJP4WZ9j7QAT5blChyE Any and all help is much appreciated! Rohan -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/O4IYhZwMIGIJ. 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] [google-web-toolkit] r9851 committed - Fix bug on IE where onload events don't fire for IFrames....
Revision: 9851 Author: p...@google.com Date: Mon Mar 14 09:06:35 2011 Log: Fix bug on IE where onload events don't fire for IFrames. This is a bugfix for http://code.google.com/p/google-web-toolkit/issues/detail?id=1720 Review at http://gwt-code-reviews.appspot.com/1294801 http://code.google.com/p/google-web-toolkit/source/detail?r=9851 Added: /trunk/user/test/com/google/gwt/dom/public-test/iframetest.html Modified: /trunk/user/src/com/google/gwt/user/client/impl/DOMImplTrident.java /trunk/user/src/com/google/gwt/user/client/ui/Frame.java /trunk/user/test/com/google/gwt/dom/DOMSuite.java /trunk/user/test/com/google/gwt/dom/client/FrameTests.java === --- /dev/null +++ /trunk/user/test/com/google/gwt/dom/public-test/iframetest.html Mon Mar 14 09:06:35 2011 @@ -0,0 +1,10 @@ +html + head +title + IFRAME TEST +/title + /head + body +IFRAME TEST + /body +/html === --- /trunk/user/src/com/google/gwt/user/client/impl/DOMImplTrident.java Tue Mar 1 06:29:34 2011 +++ /trunk/user/src/com/google/gwt/user/client/impl/DOMImplTrident.java Mon Mar 14 09:06:35 2011 @@ -30,6 +30,9 @@ @SuppressWarnings(unused) private static JavaScriptObject callDispatchDblClickEvent; + @SuppressWarnings(unused) + private static JavaScriptObject callDispatchOnLoadEvent; + @SuppressWarnings(unused) private static JavaScriptObject callDispatchUnhandledEvent; @@ -168,15 +171,18 @@ $wnd['__gwt_dispatchEvent_' + moduleName] = dispatchEvent; @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchEvent = new Function('w', 'return function() { w.__gwt_dispatchEvent_' + moduleName + '.call(this) }')($wnd); - + $wnd['__gwt_dispatchDblClickEvent_' + moduleName] = dispatchDblClickEvent; @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchDblClickEvent = new Function('w', 'return function() { w.__gwt_dispatchDblClickEvent_' + moduleName + '.call(this)}')($wnd); - + $wnd['__gwt_dispatchUnhandledEvent_' + moduleName] = dispatchUnhandledEvent; @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchUnhandledEvent = new Function('w', 'return function() { w.__gwt_dispatchUnhandledEvent_' + moduleName + '.call(this)}')($wnd); + @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchOnLoadEvent = new Function('w', + 'return function() { w.__gwt_dispatchUnhandledEvent_' + moduleName + '.call(w.event.srcElement)}')($wnd); + // We need to create these delegate functions to fix up the 'this' context. // Normally, 'this' is the firing element, but this is only true for // 'onclick = ...' event handlers, not for handlers setup via attachEvent(). @@ -268,8 +274,18 @@ @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchEvent : null; if (chMask 0x04000) elem.onscroll = (bits 0x04000) ? @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchEvent : null; -if (chMask 0x08000) elem.onload= (bits 0x08000) ? - @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchUnhandledEvent : null; +if (chMask 0x08000) { + if (elem.nodeName == IFRAME) { +if (bits 0x08000) { + elem.attachEvent('onload', @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchOnLoadEvent); +} else { + elem.detachEvent('onload', @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchOnLoadEvent); +} + } else { + elem.onload = (bits 0x08000) ? + @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchUnhandledEvent : null; + } +} if (chMask 0x1) elem.onerror = (bits 0x1) ? @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchEvent : null; if (chMask 0x2) elem.onmousewheel = (bits 0x2) ? === --- /trunk/user/src/com/google/gwt/user/client/ui/Frame.java Tue Mar 1 06:29:34 2011 +++ /trunk/user/src/com/google/gwt/user/client/ui/Frame.java Mon Mar 14 09:06:35 2011 @@ -19,6 +19,10 @@ import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.FrameElement; import com.google.gwt.dom.client.IFrameElement; +import com.google.gwt.event.dom.client.HasLoadHandlers; +import com.google.gwt.event.dom.client.LoadEvent; +import com.google.gwt.event.dom.client.LoadHandler; +import com.google.gwt.event.shared.HandlerRegistration; /** * A widget that wraps an IFRAME element, which can contain an arbitrary web @@ -37,7 +41,7 @@ * h3Example/h3 {@example com.google.gwt.examples.FrameExample} * /p */ -public class Frame extends Widget { +public class Frame extends Widget implements HasLoadHandlers { static final String DEFAULT_STYLENAME = gwt-Frame; @@ -91,6 +95,17 @@ IFrameElement.as(element); setElement(element); } + + /** + * Adds
[gwt-contrib] Re: Fix bug on IE where onload events don't fire for IFrames. (issue1294801)
http://gwt-code-reviews.appspot.com/1294801/diff/17001/user/src/com/google/gwt/user/client/ui/Frame.java File user/src/com/google/gwt/user/client/ui/Frame.java (right): http://gwt-code-reviews.appspot.com/1294801/diff/17001/user/src/com/google/gwt/user/client/ui/Frame.java#newcode78 user/src/com/google/gwt/user/client/ui/Frame.java:78: sinkEvents(Event.ONLOAD); Don't sink in the constructor unless its used by the Widget itself. addDomHandler will lazily sink the load event automatically. This is important because sinking events is expensive. http://gwt-code-reviews.appspot.com/1294801/diff/17001/user/src/com/google/gwt/user/client/ui/Frame.java#newcode110 user/src/com/google/gwt/user/client/ui/Frame.java:110: return addHandler(handler, LoadEvent.getType()); Use addDomHandler() for events that wrap native events. It will sink ONLOAD the first time it is called. http://gwt-code-reviews.appspot.com/1294801/diff/17001/user/test/com/google/gwt/dom/public-test/iframetest.html File user/test/com/google/gwt/dom/public-test/iframetest.html (right): http://gwt-code-reviews.appspot.com/1294801/diff/17001/user/test/com/google/gwt/dom/public-test/iframetest.html#newcode3 user/test/com/google/gwt/dom/public-test/iframetest.html:3: /html This doesn't look right http://gwt-code-reviews.appspot.com/1294801/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Fix bug on IE where onload events don't fire for IFrames. (issue1294801)
LGTM http://gwt-code-reviews.appspot.com/1294801/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Fix bug on IE where onload events don't fire for IFrames. (issue1294801)
http://gwt-code-reviews.appspot.com/1294801/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Fix bug on IE where onload events don't fire for IFrames. (issue1294801)
iframetest.html still looks weird. I'll assume it looks correct on your system. http://gwt-code-reviews.appspot.com/1294801/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Fix bug on IE where onload events don't fire for IFrames. (issue1294801)
http://gwt-code-reviews.appspot.com/1294801/diff/17001/user/src/com/google/gwt/user/client/ui/Frame.java File user/src/com/google/gwt/user/client/ui/Frame.java (right): http://gwt-code-reviews.appspot.com/1294801/diff/17001/user/src/com/google/gwt/user/client/ui/Frame.java#newcode78 user/src/com/google/gwt/user/client/ui/Frame.java:78: sinkEvents(Event.ONLOAD); On 2011/03/14 15:10:05, jlabanca wrote: Don't sink in the constructor unless its used by the Widget itself. addDomHandler will lazily sink the load event automatically. This is important because sinking events is expensive. Done. http://gwt-code-reviews.appspot.com/1294801/diff/17001/user/src/com/google/gwt/user/client/ui/Frame.java#newcode110 user/src/com/google/gwt/user/client/ui/Frame.java:110: return addHandler(handler, LoadEvent.getType()); On 2011/03/14 15:10:05, jlabanca wrote: Use addDomHandler() for events that wrap native events. It will sink ONLOAD the first time it is called. Done. http://gwt-code-reviews.appspot.com/1294801/diff/17001/user/test/com/google/gwt/dom/public-test/iframetest.html File user/test/com/google/gwt/dom/public-test/iframetest.html (right): http://gwt-code-reviews.appspot.com/1294801/diff/17001/user/test/com/google/gwt/dom/public-test/iframetest.html#newcode3 user/test/com/google/gwt/dom/public-test/iframetest.html:3: /html On 2011/03/14 15:10:05, jlabanca wrote: This doesn't look right svn diff!! :( fixed :) http://gwt-code-reviews.appspot.com/1294801/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Fix bug on IE where onload events don't fire for IFrames. (issue1294801)
http://gwt-code-reviews.appspot.com/1294801/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Fix bug on IE where onload events don't fire for IFrames. (issue1294801)
LGTM http://gwt-code-reviews.appspot.com/1294801/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Fix bug on IE where onload events don't fire for IFrames. (issue1294801)
http://gwt-code-reviews.appspot.com/1294801/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Fix bug for IE frames where onload events don't fire. (issue1353801)
Step-by-step how I was running the tests: 1) Open Eclipse and go to Run-Run Configurations 2) Select GWT JUnit Test on the left and click the new test icon. 3) Put anything for the name, but for the Project put gwt-user and for the Test Class put com.google.gwt.user.client.ui.ImageTest 4) Click the Arguments tab and under the VM Arguments put: -Dgwt.args=-runStyle Manual:1 -web -standardsMode 5) Click Apply, then click Run. 6) After a minute or so, you should see the following in your console: Please navigate your browser to this URL: http://XXYYZZ:58926/com.google.gwt.user.UserTest.JUnit/junit-standards.html; 7) Open IE8 and navigate to the URL, then switch back to Eclipse and watch the tests run. 8) There will be several failures. http://gwt-code-reviews.appspot.com/1353801/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] [google-web-toolkit] r9785 committed - Fix bug for IE frames where onload events don't fire....
Revision: 9785 Author: p...@google.com Date: Tue Mar 1 05:24:17 2011 Log: Fix bug for IE frames where onload events don't fire. Issue: http://code.google.com/p/google-webtoolkit/issues/detail?id=1720 Review at http://gwt-code-reviews.appspot.com/1353801 Review by: jlaba...@google.com http://code.google.com/p/google-web-toolkit/source/detail?r=9785 Added: /trunk/user/test/com/google/gwt/dom/public-test/iframetest.html Modified: /trunk/user/src/com/google/gwt/user/client/impl/DOMImplOpera.java /trunk/user/src/com/google/gwt/user/client/impl/DOMImplStandard.java /trunk/user/src/com/google/gwt/user/client/impl/DOMImplTrident.java /trunk/user/src/com/google/gwt/user/client/ui/Frame.java /trunk/user/src/com/google/gwt/user/client/ui/Image.java /trunk/user/src/com/google/gwt/user/client/ui/impl/ClippedImageImpl.java /trunk/user/src/com/google/gwt/user/client/ui/impl/ClippedImageImplIE6.java /trunk/user/test/com/google/gwt/dom/DOMSuite.java /trunk/user/test/com/google/gwt/dom/client/FrameTests.java === --- /dev/null +++ /trunk/user/test/com/google/gwt/dom/public-test/iframetest.html Tue Mar 1 05:24:17 2011 @@ -0,0 +1,10 @@ +html +body +IFRAME TEST +/body +/html +html +body +IFRAME TEST +/body +/html === --- /trunk/user/src/com/google/gwt/user/client/impl/DOMImplOpera.java Fri Nov 20 16:10:50 2009 +++ /trunk/user/src/com/google/gwt/user/client/impl/DOMImplOpera.java Tue Mar 1 05:24:17 2011 @@ -59,7 +59,7 @@ elem.onscroll = (bits 0x04000) ? @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; elem.onload= (bits 0x08000) ? - @com.google.gwt.user.client.impl.DOMImplStandard::dispatchUnhandledEvent : null; + @com.google.gwt.user.client.impl.DOMImplStandard::dispatchOnLoadEvent : null; elem.onerror = (bits 0x1) ? @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; elem.onmousewheel = (bits 0x2) ? === --- /trunk/user/src/com/google/gwt/user/client/impl/DOMImplStandard.java Tue Nov 23 11:35:12 2010 +++ /trunk/user/src/com/google/gwt/user/client/impl/DOMImplStandard.java Tue Mar 1 05:24:17 2011 @@ -39,7 +39,7 @@ private static JavaScriptObject dispatchEvent; @SuppressWarnings(unused) - private static JavaScriptObject dispatchUnhandledEvent; + private static JavaScriptObject dispatchOnLoadEvent; @Override public Element eventGetFromElement(Event evt) { @@ -167,8 +167,8 @@ return true; }); - @com.google.gwt.user.client.impl.DOMImplStandard::dispatchUnhandledEvent = $entry(function(evt) { - this.__gwtLastUnhandledEvent = evt.type; +@com.google.gwt.user.client.impl.DOMImplStandard::dispatchOnLoadEvent = $entry(function(evt) { + this.__gwtLastOnLoadEvent = evt.type; @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent.call(this, evt); }); @@ -248,7 +248,7 @@ if (chMask 0x04000) elem.onscroll = (bits 0x04000) ? @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; if (chMask 0x08000) elem.onload= (bits 0x08000) ? - @com.google.gwt.user.client.impl.DOMImplStandard::dispatchUnhandledEvent : null; + @com.google.gwt.user.client.impl.DOMImplStandard::dispatchOnLoadEvent : null; if (chMask 0x1) elem.onerror = (bits 0x1) ? @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; if (chMask 0x2) elem.onmousewheel = (bits 0x2) ? === --- /trunk/user/src/com/google/gwt/user/client/impl/DOMImplTrident.java Wed Jan 19 06:51:52 2011 +++ /trunk/user/src/com/google/gwt/user/client/impl/DOMImplTrident.java Tue Mar 1 05:24:17 2011 @@ -31,7 +31,7 @@ private static JavaScriptObject callDispatchDblClickEvent; @SuppressWarnings(unused) - private static JavaScriptObject callDispatchUnhandledEvent; + private static JavaScriptObject callDispatchOnLoadEvent; /** * Let every GWT app on the page preview the current event. If any app cancels @@ -154,8 +154,8 @@ } }); -var dispatchUnhandledEvent = $entry(function() { - this.__gwtLastUnhandledEvent = $wnd.event.type; +var dispatchOnLoadEvent = $entry(function() { + this.__gwtLastOnLoadEvent = $wnd.event.type; dispatchEvent.call(this); }); @@ -173,9 +173,9 @@ @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchDblClickEvent = new Function('w', 'return function() { w.__gwt_dispatchDblClickEvent_' + moduleName + '.call(this)}')($wnd); -$wnd['__gwt_dispatchUnhandledEvent_' + moduleName] = dispatchUnhandledEvent; - @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchUnhandledEvent = new Function('w', - 'return function() { w.__gwt_dispatchUnhandledEvent_
[gwt-contrib] Re: Fix bug for IE frames where onload events don't fire. (issue1353801)
During testing, I found this patch causes several timeout errors in ImageTest.java on IE8: testChangeImageToClipped() testCreateImage() testSetUrlAndVisiblerectOnUnclippedImage() testNoEventOnReattachInHandler() http://gwt-code-reviews.appspot.com/1353801/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Fix bug for IE frames where onload events don't fire. (issue1353801)
LGTM Thanks for this fix. Can you fill out a CLA so we can use the patch? If you scroll to the bottom of the link below, you can fill it out online: http://code.google.com/legal/individual-cla-v1.0.html http://gwt-code-reviews.appspot.com/1353801/diff/1/user/test/com/google/gwt/dom/client/FrameTests.java File user/test/com/google/gwt/dom/client/FrameTests.java (right): http://gwt-code-reviews.appspot.com/1353801/diff/1/user/test/com/google/gwt/dom/client/FrameTests.java#newcode44 user/test/com/google/gwt/dom/client/FrameTests.java:44: int delayMillis = 3000; You can abstract this to a static final variable: private static final int FRAME_LOAD_DELAY = 3000; http://gwt-code-reviews.appspot.com/1353801/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Fix bug for IE frames where onload events don't fire. (issue1353801)
Thank you for the patch! LGTM with a few nits. Lets get this into 2.3 and end this travesty of broken onload events forever :) http://gwt-code-reviews.appspot.com/1353801/diff/1/user/src/com/google/gwt/user/client/ui/Frame.java File user/src/com/google/gwt/user/client/ui/Frame.java (right): http://gwt-code-reviews.appspot.com/1353801/diff/1/user/src/com/google/gwt/user/client/ui/Frame.java#newcode124 user/src/com/google/gwt/user/client/ui/Frame.java:124: Add javadoc and move this method and move it below the protected Frame(Element element) method. (If Eclipse is set up to do it, Source-Sort Members will do the trick.) http://gwt-code-reviews.appspot.com/1353801/diff/1/user/test/com/google/gwt/dom/client/FrameTests.java File user/test/com/google/gwt/dom/client/FrameTests.java (right): http://gwt-code-reviews.appspot.com/1353801/diff/1/user/test/com/google/gwt/dom/client/FrameTests.java#newcode68 user/test/com/google/gwt/dom/client/FrameTests.java:68: @Override Remove this @Override. Sadly, until GWT2.3 is released, Java 1.5 compatibility is required which doesn't like @Override's on interfaces. http://gwt-code-reviews.appspot.com/1353801/diff/1/user/test/com/google/gwt/dom/client/FrameTests.java#newcode85 user/test/com/google/gwt/dom/client/FrameTests.java:85: @Override Remove this @Override (see above) http://gwt-code-reviews.appspot.com/1353801/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] [google-web-toolkit] r9567 committed - Fix bug on IE where onload events don't fire for IFrames....
Revision: 9567 Author: p...@google.com Date: Wed Jan 19 05:47:41 2011 Log: Fix bug on IE where onload events don't fire for IFrames. This is a bugfix for http://code.google.com/p/google-web-toolkit/issues/detail?id=1720 Review at http://gwt-code-reviews.appspot.com/1294801 http://code.google.com/p/google-web-toolkit/source/detail?r=9567 Added: /trunk/user/test/com/google/gwt/dom/public-test/iframetest.html Modified: /trunk/user/src/com/google/gwt/user/client/impl/DOMImplTrident.java /trunk/user/test/com/google/gwt/dom/client/FrameTests.java === --- /dev/null +++ /trunk/user/test/com/google/gwt/dom/public-test/iframetest.html Wed Jan 19 05:47:41 2011 @@ -0,0 +1,5 @@ +html +body +IFRAME TEST +/body +/html === --- /trunk/user/src/com/google/gwt/user/client/impl/DOMImplTrident.java Tue Jun 22 06:26:45 2010 +++ /trunk/user/src/com/google/gwt/user/client/impl/DOMImplTrident.java Wed Jan 19 05:47:41 2011 @@ -30,6 +30,9 @@ @SuppressWarnings(unused) private static JavaScriptObject callDispatchDblClickEvent; + @SuppressWarnings(unused) + private static JavaScriptObject callDispatchOnLoadEvent; + @SuppressWarnings(unused) private static JavaScriptObject callDispatchUnhandledEvent; @@ -168,11 +171,14 @@ $wnd['__gwt_dispatchEvent_' + moduleName] = dispatchEvent; @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchEvent = new Function('w', 'return function() { w.__gwt_dispatchEvent_' + moduleName + '.call(this) }')($wnd); - + + @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchOnLoadEvent = new Function('w', + 'return function() { w.__gwt_dispatchEvent_' + moduleName + '.call(w.event.srcElement) }')($wnd); + $wnd['__gwt_dispatchDblClickEvent_' + moduleName] = dispatchDblClickEvent; @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchDblClickEvent = new Function('w', 'return function() { w.__gwt_dispatchDblClickEvent_' + moduleName + '.call(this)}')($wnd); - + $wnd['__gwt_dispatchUnhandledEvent_' + moduleName] = dispatchUnhandledEvent; @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchUnhandledEvent = new Function('w', 'return function() { w.__gwt_dispatchUnhandledEvent_' + moduleName + '.call(this)}')($wnd); @@ -268,8 +274,13 @@ @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchEvent : null; if (chMask 0x04000) elem.onscroll = (bits 0x04000) ? @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchEvent : null; -if (chMask 0x08000) elem.onload= (bits 0x08000) ? - @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchUnhandledEvent : null; +if (chMask 0x08000) { + if (bits 0x08000) { +elem.attachEvent('onload', @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchOnLoadEvent); + } else { +elem.detachEvent('onload', @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchOnLoadEvent); + } +} if (chMask 0x1) elem.onerror = (bits 0x1) ? @com.google.gwt.user.client.impl.DOMImplTrident::callDispatchEvent : null; if (chMask 0x2) elem.onmousewheel = (bits 0x2) ? === --- /trunk/user/test/com/google/gwt/dom/client/FrameTests.java Wed Oct 28 09:10:53 2009 +++ /trunk/user/test/com/google/gwt/dom/client/FrameTests.java Wed Jan 19 05:47:41 2011 @@ -16,12 +16,14 @@ package com.google.gwt.dom.client; import com.google.gwt.junit.client.GWTTestCase; +import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.ui.Frame; +import com.google.gwt.user.client.ui.RootPanel; /** * Tests for the FrameElement and IFrameElement classes. */ public class FrameTests extends GWTTestCase { - @Override public String getModuleName() { return com.google.gwt.dom.DOMTest; @@ -34,4 +36,23 @@ doc.getBody().appendChild(iframe); assertNotNull(iframe.getContentDocument()); } -} + + public void testOnloadEventFires() { +int delayMillis = 3000; +delayTestFinish(delayMillis); + +Frame frame = new Frame() { + @Override + public void onBrowserEvent(Event event) { +if (event.getTypeInt() == Event.ONLOAD) { + super.onBrowserEvent(event); + finishTest(); +} + } +}; + +frame.sinkEvents(Event.ONLOAD); +frame.setUrl(iframetest.html); +RootPanel.get().add(frame); + } +} -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Fix bug on IE where onload events don't fire for IFrames. (issue1294801)
http://gwt-code-reviews.appspot.com/1294801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Fix bug on IE where onload events don't fire for IFrames. (issue1294801)
http://gwt-code-reviews.appspot.com/1294801/diff/3001/4002 File user/test/com/google/gwt/dom/client/FrameTests.java (right): http://gwt-code-reviews.appspot.com/1294801/diff/3001/4002#newcode49 user/test/com/google/gwt/dom/client/FrameTests.java:49: final Timer timer = new Timer() { On 2011/01/14 19:14:48, jlabanca wrote: Do you need this timer? The test will time out if onload is never triggered. Done. http://gwt-code-reviews.appspot.com/1294801/diff/3001/4002#newcode75 user/test/com/google/gwt/dom/client/FrameTests.java:75: delayTestFinish(2 * delayMillis); On 2011/01/14 19:14:48, jlabanca wrote: Move this above the line where you create the iframe to avoid timing issues, especially in HtmlUnit. If the iframe happens to load synchronously or very quickly, the onload event might fire before delayTestFinish. In general, always call delayTestFinish() before calling the thing that will trigger an asynchronous event. Done. http://gwt-code-reviews.appspot.com/1294801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Fix bug on IE where onload events don't fire for IFrames. (issue1294801)
LGTM http://gwt-code-reviews.appspot.com/1294801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Fix bug on IE where onload events don't fire for IFrames. (issue1294801)
Reviewers: jlabanca, rjrjr, Description: Fix bug on IE where onload events don't fire for IFrames. This is a bugfix for http://code.google.com/p/google-web-toolkit/issues/detail?id=1720 Please review this at http://gwt-code-reviews.appspot.com/1294801/show Affected files: M user/src/com/google/gwt/user/client/impl/DOMImplTrident.java M user/test/com/google/gwt/dom/client/FrameTests.java A user/test/com/google/gwt/dom/public-test/iframetest.html -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Fix bug on IE where onload events don't fire for IFrames. (issue1294801)
http://gwt-code-reviews.appspot.com/1294801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Fix bug on IE where onload events don't fire for IFrames. (issue1294801)
http://gwt-code-reviews.appspot.com/1294801/diff/3001/4002 File user/test/com/google/gwt/dom/client/FrameTests.java (right): http://gwt-code-reviews.appspot.com/1294801/diff/3001/4002#newcode49 user/test/com/google/gwt/dom/client/FrameTests.java:49: final Timer timer = new Timer() { Do you need this timer? The test will time out if onload is never triggered. http://gwt-code-reviews.appspot.com/1294801/diff/3001/4002#newcode75 user/test/com/google/gwt/dom/client/FrameTests.java:75: delayTestFinish(2 * delayMillis); Move this above the line where you create the iframe to avoid timing issues, especially in HtmlUnit. If the iframe happens to load synchronously or very quickly, the onload event might fire before delayTestFinish. In general, always call delayTestFinish() before calling the thing that will trigger an asynchronous event. http://gwt-code-reviews.appspot.com/1294801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Why is getOffsetWidth/getOffsetHeight returning 0 even after onLoad is called for LayoutPanel children?
I posted this over on the normal group but hopefully I can get some useful responses here. I am attempting to use the new GWT LayoutPanels and unfortunately they are causing me some grief. We are using the layout panels (RootLayoutPanel, DockLayoutPanel, LayoutPanel, etc) to arrange the overall layout of the panel. Then, the children of one of these panels needs to know how big it is so that it can size one of its children properly to cause a scroll bar to appear. As far as I can tell, the only way to do this is by calling getOffsetWidth and getOffsetHeight. I know that these methods will return 0 if the widget is not attached but I am finding that in even putting the calls in onLoad, these methods are still returning 0. Clearly I don't understand when GWT and/or the browser figures out what the sizes of these layout panels are. Below is a simplification of my problem. The widget added to the RootLayoutPanel cannot determine its size when it is attached to the DOM. I made sure the widget had something in it and to prove that it ends up with a size, I added the call to the deferred command to display the size again. If you simply replace RootLayoutPanel with RootPanel then it will output the full window width. What am I doing wrong here? final FlowPanel testWidget = new FlowPanel() { protected void onLoad() { int width = getOffsetWidth(); Window.alert(width= + width); // Outputs 0 } }; testWidget.add(new Label(Something)); RootLayoutPanel.get().add(testWidget); Window.alert(width= + width); // Outputs 0 DeferredCommand.add(new Command() { public void execute() { int width = testWidget.getElement().getOffsetWidth(); Window.alert(width= + width); // Outputs non-zero } } The value of 0 comes from FF 3.6. IE6 has almost the same problem except that in the cases where FF returns 0, IE6 is returning 60 (presumably the default size of the label). In both cases, it returns the full Window width in the DeferredCommand. -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
Re: [gwt-contrib] Why is getOffsetWidth/getOffsetHeight returning 0 even after onLoad is called for LayoutPanel children?
getOffsetWidth/Height() always read the current state of the widget's backing element, which won't be updated until the layout panels are done laying themselves out. All the layout panels have the potential to be animated, and defer actually laying things out until the end of the current event (in this case, the current event is likely the module startup). This is pretty important for optimization, because layout can be expensive, and you don't want to do any layout work until the app's done fiddling with its structure. That's why you're seeing the correct value in a DeferredCommand -- it's guaranteed to run after the current event. If you really need to force layout earlier, you can call LayoutPanel.forceLayout(). But be careful with this, because you can end up forcing more layouts than you mean to (in the example you show, it would be fine, but if you were to take a similar structure and nest it within another that *also* called forceLayout(), you would end up doing extra work). Hope that helps, joel. Le 27 septembre 2010 11:20, Damon Lundin damon.lun...@gmail.com a écrit : I posted this over on the normal group but hopefully I can get some useful responses here. I am attempting to use the new GWT LayoutPanels and unfortunately they are causing me some grief. We are using the layout panels (RootLayoutPanel, DockLayoutPanel, LayoutPanel, etc) to arrange the overall layout of the panel. Then, the children of one of these panels needs to know how big it is so that it can size one of its children properly to cause a scroll bar to appear. As far as I can tell, the only way to do this is by calling getOffsetWidth and getOffsetHeight. I know that these methods will return 0 if the widget is not attached but I am finding that in even putting the calls in onLoad, these methods are still returning 0. Clearly I don't understand when GWT and/or the browser figures out what the sizes of these layout panels are. Below is a simplification of my problem. The widget added to the RootLayoutPanel cannot determine its size when it is attached to the DOM. I made sure the widget had something in it and to prove that it ends up with a size, I added the call to the deferred command to display the size again. If you simply replace RootLayoutPanel with RootPanel then it will output the full window width. What am I doing wrong here? final FlowPanel testWidget = new FlowPanel() { protected void onLoad() { int width = getOffsetWidth(); Window.alert(width= + width); // Outputs 0 } }; testWidget.add(new Label(Something)); RootLayoutPanel.get().add(testWidget); Window.alert(width= + width); // Outputs 0 DeferredCommand.add(new Command() { public void execute() { int width = testWidget.getElement().getOffsetWidth(); Window.alert(width= + width); // Outputs non-zero } } The value of 0 comes from FF 3.6. IE6 has almost the same problem except that in the cases where FF returns 0, IE6 is returning 60 (presumably the default size of the label). In both cases, it returns the full Window width in the DeferredCommand. -- http://groups.google.com/group/Google-Web-Toolkit-Contributors -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Why is getOffsetWidth/getOffsetHeight returning 0 even after onLoad is called for LayoutPanel children?
On Sep 27, 10:29 am, Joel Webber j...@google.com wrote: getOffsetWidth/Height() always read the current state of the widget's backing element, which won't be updated until the layout panels are done laying themselves out. All the layout panels have the potential to be animated, and defer actually laying things out until the end of the current event (in this case, the current event is likely the module startup). This is pretty important for optimization, because layout can be expensive, and you don't want to do any layout work until the app's done fiddling with its structure. That's why you're seeing the correct value in a DeferredCommand -- it's guaranteed to run after the current event. If you really need to force layout earlier, you can call LayoutPanel.forceLayout(). But be careful with this, because you can end up forcing more layouts than you mean to (in the example you show, it would be fine, but if you were to take a similar structure and nest it within another that *also* called forceLayout(), you would end up doing extra work). Hope that helps, joel. Yes Joel, that does help. You're definitely right in that we need to be careful about executing relayouts in the GWT panels or by the browser. The reason the DeferredCommand is not optimal is because it allows the browser to display the UI before all of it has been properly sized (the bits that need to call getOffset*) which results in the browser jumping. The user sees un-initialized panels briefly and then it redraws correctly which can be unpleasant. I think we want to avoid that. I just tried a quick experiment to try your suggestion but the next question is on which component to call forceLayout. In my simple example, just calling RootLayoutPanel.get().forceLayout() inside the onLoad method works but if that FlowPanel is buried somewhere deep in the app, what then? Do I rely on the very top component (onModuleLoad) to call forceLayout/onResize. Does my onLoad call forceLayout on the entire RootLayoutPanel regardless of how deep it is or just its parent? What should happen if the FlowPanel in question is lazily created and added to the DOM later (in which case it's onLoad method is the one place that knows for sure it's been attached). Unless there is some discussion I have missed, I think that perhaps this is worth starting a Best Practices thread. I have some ideas on how to use onLoad and onResize and avoid some of the performance issues and now forceLayout needs to be included in the mix but I won't pretend to have the right or best answer. -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
Re: Why is getOffsetWidth/getOffsetHeight returning 0 even after onLoad is called for LayoutPanel children?
On Sep 21, 10:28 pm, Didier DURAND durand.did...@gmail.com wrote: Did you check if you have the issue on all browsers: I have it on Webkit based browsers (Safari + Chrome) but not on IE and FF. I was remiss in leaving that info out. I am having this problem on both IE 6 and FF 3.6. Although IE 6 doesn't return 0 for the first call but rather 60 which is the width of the label. It does return the full window width in the second call like FF. So you're saying that you see different behavior than I am on IE and FF? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Why is getOffsetWidth/getOffsetHeight returning 0 even after onLoad is called for LayoutPanel children?
I am attempting to use the new GWT LayoutPanels and unfortunately they are causing me some grief. We are using the layout panels (RootLayoutPanel, DockLayoutPanel, LayoutPanel, etc) to arrange the overall layout of the panel. Then, the children of one of these panels needs to know how big it is so that it can size one of its children properly to cause a scroll bar to appear. Generally you do this by calling getOffsetWidth and getOffsetHeight. I know that these methods will return 0 if the widget is not attached but I am finding that in even putting the calls in onLoad, these methods are still returning 0. Clearly I don't understand when GWT and/or the browser figures out what the sizes of these layout panels are. Below is a simplification of my problem. The widget added to the RootLayoutPanel cannot determine its size when it is attached to the DOM. I made sure the widget had something in it and to prove that it ends up with a size, I added the call to the deferred command to display the size again. If you simply replace RootLayoutPanel with RootPanel then it will output a size. What am I doing wrong here? final FlowPanel testWidget = new FlowPanel() { protected void onLoad() { int width = getOffsetWidth(); System.out.println(width= + width); // Outputs 0 } }; testWidget.add(new Label(Something)); RootLayoutPanel.get().add(testWidget); DeferredCommand.add(new Command() { public void execute() { int width = testWidget.getElement().getOffsetWidth(); System.out.println(width= + width); // Outputs a non-zero value } }); -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Why is getOffsetWidth/getOffsetHeight returning 0 even after onLoad is called for LayoutPanel children?
try with onAttach() On Tue, Sep 21, 2010 at 5:13 PM, Damon Lundin damon.lun...@gmail.comwrote: I am attempting to use the new GWT LayoutPanels and unfortunately they are causing me some grief. We are using the layout panels (RootLayoutPanel, DockLayoutPanel, LayoutPanel, etc) to arrange the overall layout of the panel. Then, the children of one of these panels needs to know how big it is so that it can size one of its children properly to cause a scroll bar to appear. Generally you do this by calling getOffsetWidth and getOffsetHeight. I know that these methods will return 0 if the widget is not attached but I am finding that in even putting the calls in onLoad, these methods are still returning 0. Clearly I don't understand when GWT and/or the browser figures out what the sizes of these layout panels are. Below is a simplification of my problem. The widget added to the RootLayoutPanel cannot determine its size when it is attached to the DOM. I made sure the widget had something in it and to prove that it ends up with a size, I added the call to the deferred command to display the size again. If you simply replace RootLayoutPanel with RootPanel then it will output a size. What am I doing wrong here? final FlowPanel testWidget = new FlowPanel() { protected void onLoad() { int width = getOffsetWidth(); System.out.println(width= + width); // Outputs 0 } }; testWidget.add(new Label(Something)); RootLayoutPanel.get().add(testWidget); DeferredCommand.add(new Command() { public void execute() { int width = testWidget.getElement().getOffsetWidth(); System.out.println(width= + width); // Outputs a non-zero value } }); -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- Guit: Elegant, beautiful, modular and *production ready* gwt applications. http://code.google.com/p/guit/ -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Why is getOffsetWidth/getOffsetHeight returning 0 even after onLoad is called for LayoutPanel children?
On 21 sep, 23:13, Damon Lundin damon.lun...@gmail.com wrote: I am attempting to use the new GWT LayoutPanels and unfortunately they are causing me some grief. We are using the layout panels (RootLayoutPanel, DockLayoutPanel, LayoutPanel, etc) to arrange the overall layout of the panel. Then, the children of one of these panels needs to know how big it is so that it can size one of its children properly to cause a scroll bar to appear. Generally you do this by calling getOffsetWidth and getOffsetHeight. I know that these methods will return 0 if the widget is not attached but I am finding that in even putting the calls in onLoad, these methods are still returning 0. Clearly I don't understand when GWT and/or the browser figures out what the sizes of these layout panels are. Below is a simplification of my problem. The widget added to the RootLayoutPanel cannot determine its size when it is attached to the DOM. I made sure the widget had something in it and to prove that it ends up with a size, I added the call to the deferred command to display the size again. If you simply replace RootLayoutPanel with RootPanel then it will output a size. What am I doing wrong here? How about implementing RequiresResize and doing the job in onResize()? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Why is getOffsetWidth/getOffsetHeight returning 0 even after onLoad is called for LayoutPanel children?
On Sep 21, 5:21 pm, Gal Dolber gal.dol...@gmail.com wrote: try with onAttach() The method onLoad is called by onAttach so overiding onAttach won't change anything not to mention the fact that the doc for onAttach says It is strongly recommended that you override {...@link #onLoad()} or {...@link #doAttachChildren()} instead of this method. On Sep 21, 5:35 pm, Thomas Broyer t.bro...@gmail.com wrote: How about implementing RequiresResize and doing the job in onResize()? That doesn't help because onResize isn't called automatically when the widgets are initially constructed, only when a browser initiates a resize event. However I have tried exactly what you suggest by putting the code I am having trouble with in a RequiresResize.onResize method and am calling that method in onLoad (so the sizing happens on both resize and when the widget is initially created). The method getOffsetWidth still returns 0. I also tried manually calling onResize on the RootLayoutPanel at the end of my onModuleLoad with the same result. Only a DeferredCommand seems to result in getOffsetWidth not returning 0. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Why is getOffsetWidth/getOffsetHeight returning 0 even after onLoad is called for LayoutPanel children?
Did you check if you have the issue on all browsers: I have it on Webkit based browsers (Safari + Chrome) but not on IE and FF. didier On Sep 22, 12:43 am, Damon Lundin damon.lun...@gmail.com wrote: On Sep 21, 5:21 pm, Gal Dolber gal.dol...@gmail.com wrote: try with onAttach() The method onLoad is called by onAttach so overiding onAttach won't change anything not to mention the fact that the doc for onAttach says It is strongly recommended that you override {...@link #onLoad()} or {...@link #doAttachChildren()} instead of this method. On Sep 21, 5:35 pm, Thomas Broyer t.bro...@gmail.com wrote: How about implementing RequiresResize and doing the job in onResize()? That doesn't help because onResize isn't called automatically when the widgets are initially constructed, only when a browser initiates a resize event. However I have tried exactly what you suggest by putting the code I am having trouble with in a RequiresResize.onResize method and am calling that method in onLoad (so the sizing happens on both resize and when the widget is initially created). The method getOffsetWidth still returns 0. I also tried manually calling onResize on the RootLayoutPanel at the end of my onModuleLoad with the same result. Only a DeferredCommand seems to result in getOffsetWidth not returning 0. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: onLoad?
On 27 mai, 06:43, spierce7 spier...@gmail.com wrote: Hey guys, I'm creating a class that extends Label, and for some reason whenever I create an instance of it, it doesn't load the onLoad() class when it's instantiated. I've got it set up the exact same way I have a class that extends grid, that properly uses onLoad, but for some reason this isn't. The idea occurred to me that I don't even really know what onLoad does exactly. What is the difference between onLoad and a constructor, and how should I be using them differently? (yes I did a search). From the JavaDoc: This method is called immediately after a widget becomes attached to the browser's document. This is has nothing to do with the time you create the widget (you can create a widget and just keep it in a variable, and add it to another widget later, or never; this is not really a good practice but it's possible); it can be called at different times: - when you add the widget to another widget which is already attached to the browser's document - when you attach a parent widget to the browser's document (onLoad propagates to children) Widgets that are attached without the need to add them to other widgets are: - RootPanel - RootLayoutPanel - any widget that you created using its wrap(Element) static method Out of curiosity how does onModuleLoad() fit into the mix also? Again totally a different thing. This is called to start our app. Nothing will ever be called before onModuleLoad (except the constructor of your EntryPoint class, of course) -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: onLoad?
Hi, you find the current javadocs here http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/index.html?overview-summary.html http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/user/client/ui/Widget.html and in your downloaded SDK the behaviour of onLoad and onUnload are documented Stefan Bachert http://gwtworld.de On 27 Mai, 06:43, spierce7 spier...@gmail.com wrote: Hey guys, I'm creating a class that extends Label, and for some reason whenever I create an instance of it, it doesn't load the onLoad() class when it's instantiated. I've got it set up the exact same way I have a class that extends grid, that properly uses onLoad, but for some reason this isn't. The idea occurred to me that I don't even really know what onLoad does exactly. What is the difference between onLoad and a constructor, and how should I be using them differently? (yes I did a search). Out of curiosity how does onModuleLoad() fit into the mix also? 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-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
onLoad?
Hey guys, I'm creating a class that extends Label, and for some reason whenever I create an instance of it, it doesn't load the onLoad() class when it's instantiated. I've got it set up the exact same way I have a class that extends grid, that properly uses onLoad, but for some reason this isn't. The idea occurred to me that I don't even really know what onLoad does exactly. What is the difference between onLoad and a constructor, and how should I be using them differently? (yes I did a search). Out of curiosity how does onModuleLoad() fit into the mix also? 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-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Image.setUrl / load event / onLoad / LoadHandler / LoadEvent
Hi, I've got a question about the Image onLoad mechanism in GWT 2.0.3 - I was setting the url of the Image with setUrl(String) call and no LoadEvent was being fired, which confused me as, according to the javadoc the setUrl method... Sets the URL of the image to be displayed. If the image is in the clipped state, a call to this method will cause a transition of the image to the unclipped state. Regardless of whether or not the image is in the clipped or unclipped state, a load event will be fired. After a while I worked out that because the Image wasn't actually displayed on the screen (I wanted to load it first to work out its dimensions and then display it), the call to setUrl - although it did retrieve the image from the server (according to the net panel in firebug) - didn't fire the LoadEvent. My question is this, is this a bug in GWT or should the documentation be a bit more explicit about when the LoadEvent is fired? Or... am I just being unreasonably fastidious. Cheers Simon -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Image.setUrl / load event / onLoad / LoadHandler / LoadEvent
I don't think that's a bug at all. The image is not loaded until it is in the DOM, and that does not happen when the servlet is called, but after the image is returned. My application a lot with resizing and otherwise manipulating images. I pass the available display dimensions to my image servlet, and use JAI and JAI-IMAGEIO to open the image, determine its size, scale it to fit the display area, and return the scaled and/or cropped/rotated image as a PNG to the browser. On Apr 19, 7:48 am, Simon Botting simon.bott...@enbuenosaires.com wrote: Hi, I've got a question about the Image onLoad mechanism in GWT 2.0.3 - I was setting the url of the Image with setUrl(String) call and no LoadEvent was being fired, which confused me as, according to the javadoc the setUrl method... Sets the URL of the image to be displayed. If the image is in the clipped state, a call to this method will cause a transition of the image to the unclipped state. Regardless of whether or not the image is in the clipped or unclipped state, a load event will be fired. After a while I worked out that because the Image wasn't actually displayed on the screen (I wanted to load it first to work out its dimensions and then display it), the call to setUrl - although it did retrieve the image from the server (according to the net panel in firebug) - didn't fire the LoadEvent. My question is this, is this a bug in GWT or should the documentation be a bit more explicit about when the LoadEvent is fired? Or... am I just being unreasonably fastidious. Cheers Simon -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: How to implement body onload=jsFunction()
perhaps something like this? public void onModuleLoad() { // put code here that constructs the widget and inserts it into the DOM DeferredCommand.addCommand(new Command() { public void execute() { // put code here that checks the height of the widget } }); } On Feb 24, 7:33 am, Jim jim.p...@gmail.com wrote: I want to get Widget.getOffsetHeight. In Widget.onload, getOffsetHeight returns 0. I think once document is ready, Widget.getOffsetHeight returns true height. Is there a way to implement onload for html body element? Regards, Jim -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: How to implement body onload=jsFunction()
it works like a charm. Thanks. On Feb 24, 4:38 pm, davidroe roe.da...@gmail.com wrote: perhaps something like this? public void onModuleLoad() { // put code here that constructs the widget and inserts it into the DOM DeferredCommand.addCommand(new Command() { public void execute() { // put code here that checks the height of the widget } }); } On Feb 24, 7:33 am, Jim jim.p...@gmail.com wrote: I want to get Widget.getOffsetHeight. In Widget.onload, getOffsetHeight returns 0. I think once document is ready, Widget.getOffsetHeight returns true height. Is there a way to implement onload for html body element? Regards, Jim -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Injected CSS rules are evaluated after onModuleLoad/Widget#onLoad
Cool, nope I've not noticed any performance issues - I'm in the middle of writing an app (for my employer) that will be shipped as part of a enterprise b2b product at the moment there is about 8 separate stylesheets that are being injected - will probably be at least 10 when finished so any performance issues will become apparent as the dev progresses. Cheers, Dave On Jan 9, 12:28 pm, Sebastian Beigel sebast...@beigel.de wrote: Replacing globalResources.fooCss().ensureInjected(); with StyleInjector.inject(globalResources.fooCss().getText(), true); solves the problem as well! Thanks Dave. In the meanwhile, I wrapped my onModuleLoad code in a DeferredCommand() (mainly for an UncaughtExceptionHandler) and removed the DeferredCommand wrap in Widget#onLoad (as described in my previous post). That also works. Anyway, I use both modifications, deferring the onModuleLoad (mainly for the logger) and ensuring immediate CSS injection -- explicit is better than implicit :) Or do you see any (performance) issues with this approach? Sebastian On Sat, Jan 9, 2010 at 1:25 AM, DaveC david.andrew.chap...@googlemail.com wrote: Have you tried StyleInjector.inject(cssText, true) ...? the DOM will be updated immediately instead of just before returning to the event loop. Using this option excessively will decrease performance, especially if used with an inject-css-on-init coding pattern I had a similar problem using the gwt-fx library (which parses the stylesheets in the DOM looking for selectors I passed in) the styles weren't injected in time. Cheers, Dave On Jan 8, 4:39 pm, Sebastian Beigel sebast...@beigel.de wrote: I found a work around, I wrapped the positioning code in my onLoad() method in a DeferredCommand and it works. Is this the preferred solution for this problem? Sebastian On Fri, Jan 8, 2010 at 4:38 PM, Sebastian Beigel sebast...@beigel.de wrote: Hi, I tried to follow the best practices and moved my static CSS files from style-tags in the HTML-page to CssResources in a ClientBundle declared in my EntryPoint and injected in a static initializer. Unfortunately, this doesn't work for me because I do some element positioning in an onLoad-method of a Widget (which is contained in the UIBinder template of my EntryPoint). The calculations of the (relative) positions are wrong and I found out that the injected CSS rules are not evaluated until my positioning code runs. Profiling the generated JS code shows the following timing: - entering onModuleLoad - entering Widget#onLoad - leaving onLoad - leading onModuleLoad - injecting CSS Tested in Webkit and Firefox 3.5 on a Mac with Snow Leopard. If I defer the positioning (by triggering it manually via a Button click in the UI) everything works as expected. Is this a bug? Is there a work-around? I really don't want to move my CSS back to static files and lose all the great advantages from using ClientBundles. But I need my CSS rules parsed and evaluated *before* my code runs. Thank you, Sebastian -- Sebastian Beigelhttp://beigel.de/sebastian -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/google-web-toolkit?hl=en. -- Sebastian Beigelhttp://beigel.de/sebastian -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Injected CSS rules are evaluated after onModuleLoad/Widget#onLoad
I found a work around, I wrapped the positioning code in my onLoad() method in a DeferredCommand and it works. Is this the preferred solution for this problem? Sebastian On Fri, Jan 8, 2010 at 4:38 PM, Sebastian Beigel sebast...@beigel.de wrote: Hi, I tried to follow the best practices and moved my static CSS files from style-tags in the HTML-page to CssResources in a ClientBundle declared in my EntryPoint and injected in a static initializer. Unfortunately, this doesn't work for me because I do some element positioning in an onLoad-method of a Widget (which is contained in the UIBinder template of my EntryPoint). The calculations of the (relative) positions are wrong and I found out that the injected CSS rules are not evaluated until my positioning code runs. Profiling the generated JS code shows the following timing: - entering onModuleLoad - entering Widget#onLoad - leaving onLoad - leading onModuleLoad - injecting CSS Tested in Webkit and Firefox 3.5 on a Mac with Snow Leopard. If I defer the positioning (by triggering it manually via a Button click in the UI) everything works as expected. Is this a bug? Is there a work-around? I really don't want to move my CSS back to static files and lose all the great advantages from using ClientBundles. But I need my CSS rules parsed and evaluated *before* my code runs. Thank you, Sebastian -- Sebastian Beigel http://beigel.de/sebastian -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Injected CSS rules are evaluated after onModuleLoad/Widget#onLoad
Hi, I tried to follow the best practices and moved my static CSS files from style-tags in the HTML-page to CssResources in a ClientBundle declared in my EntryPoint and injected in a static initializer. Unfortunately, this doesn't work for me because I do some element positioning in an onLoad-method of a Widget (which is contained in the UIBinder template of my EntryPoint). The calculations of the (relative) positions are wrong and I found out that the injected CSS rules are not evaluated until my positioning code runs. Profiling the generated JS code shows the following timing: - entering onModuleLoad - entering Widget#onLoad - leaving onLoad - leading onModuleLoad - injecting CSS Tested in Webkit and Firefox 3.5 on a Mac with Snow Leopard. If I defer the positioning (by triggering it manually via a Button click in the UI) everything works as expected. Is this a bug? Is there a work-around? I really don't want to move my CSS back to static files and lose all the great advantages from using ClientBundles. But I need my CSS rules parsed and evaluated *before* my code runs. Thank you, Sebastian -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Injected CSS rules are evaluated after onModuleLoad/Widget#onLoad
Have you tried StyleInjector.inject(cssText, true) ...? the DOM will be updated immediately instead of just before returning to the event loop. Using this option excessively will decrease performance, especially if used with an inject-css-on-init coding pattern I had a similar problem using the gwt-fx library (which parses the stylesheets in the DOM looking for selectors I passed in) the styles weren't injected in time. Cheers, Dave On Jan 8, 4:39 pm, Sebastian Beigel sebast...@beigel.de wrote: I found a work around, I wrapped the positioning code in my onLoad() method in a DeferredCommand and it works. Is this the preferred solution for this problem? Sebastian On Fri, Jan 8, 2010 at 4:38 PM, Sebastian Beigel sebast...@beigel.de wrote: Hi, I tried to follow the best practices and moved my static CSS files from style-tags in the HTML-page to CssResources in a ClientBundle declared in my EntryPoint and injected in a static initializer. Unfortunately, this doesn't work for me because I do some element positioning in an onLoad-method of a Widget (which is contained in the UIBinder template of my EntryPoint). The calculations of the (relative) positions are wrong and I found out that the injected CSS rules are not evaluated until my positioning code runs. Profiling the generated JS code shows the following timing: - entering onModuleLoad - entering Widget#onLoad - leaving onLoad - leading onModuleLoad - injecting CSS Tested in Webkit and Firefox 3.5 on a Mac with Snow Leopard. If I defer the positioning (by triggering it manually via a Button click in the UI) everything works as expected. Is this a bug? Is there a work-around? I really don't want to move my CSS back to static files and lose all the great advantages from using ClientBundles. But I need my CSS rules parsed and evaluated *before* my code runs. Thank you, Sebastian -- Sebastian Beigelhttp://beigel.de/sebastian -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
flextable column widths and onLoad...
I have a table widget ( derives from flextable ) in which I set the columns widths based on a percentage of offsetWidth. In one table, I load the contents of this table in a widget constructor ( which creates the table ). At that time, the columns are not rendered correctly. After the page is loaded, if I refresh or sort, then the column sizes are set correctly ( since the resize is called ). I have overloaded onLoad method in my table widget which calls resize. I also call resize when the data is loaded. But the initial loaded table have wrong sizes. Any ideas why this could be happenning ? Thanks gd -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
MVP: show view after onLoad is done
Hi, How can i show some view after onLoad is done. I have a popup which needs to be positioned according to some other widget, but this widget is also dynamically positioned, so i need to load the dom first and after that position the popup: pop.setPopupPosition(lastLabel.getLeft(), lastLabel.getTop() + 40); For example if I have method in my view : public MyView() { //initialize all components but do not add them in the view container, this will be done in the show method. // hide the view - it will be shown when the show method is called this.setVisible(false); } // this mettod is called in MyPresenter in onBind() public void show(ViewId viewId) { switch(viewId) { case 1: add3Labels();// shows 3 labels in vertical panel break; case 2: add4Labels();// shows 4 labels in vertical panel break; case 3: add5Labels();// shows 5 labels in vertical panel break; } Label lastLabel = getLastLabel(); popup.setPopupPosition(lastLabel.getLeft(), lastLabel.getTop() + 40); popup.show(); this.setVisible(true); } So, when this method is called the onLoad is not called yet and the popup is not positioned in the right place because the last label is (may be) missing in the dom or something? I have menu that switches the viewId and after selecting other viewId it works fine, but the problem is that when loading for the first time with the devaultViewId this popup is not on the right place. I also tried to play with revealDisplay and onRevealDisplay but no effect. if someone has an idea, please help. 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-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: MVP: show view after onLoad is done
Well, A couple ideas come to mind. The first one is to implement an IncrementalCommand. Have it return true while the view is building. Set a flag when the view is built. The IncrementalCommand checks this flag, does any cleanup and returns false. You can probably put the IncrementalCommand as an anonymous function in the main routine. On Thu, Dec 17, 2009 at 4:07 AM, mariyan nenchev nenchev.mari...@gmail.comwrote: Hi, How can i show some view after onLoad is done. I have a popup which needs to be positioned according to some other widget, but this widget is also dynamically positioned, so i need to load the dom first and after that position the popup: pop.setPopupPosition(lastLabel.getLeft(), lastLabel.getTop() + 40); For example if I have method in my view : public MyView() { //initialize all components but do not add them in the view container, this will be done in the show method. // hide the view - it will be shown when the show method is called this.setVisible(false); } // this mettod is called in MyPresenter in onBind() public void show(ViewId viewId) { switch(viewId) { case 1: add3Labels();// shows 3 labels in vertical panel break; case 2: add4Labels();// shows 4 labels in vertical panel break; case 3: add5Labels();// shows 5 labels in vertical panel break; } Label lastLabel = getLastLabel(); popup.setPopupPosition(lastLabel.getLeft(), lastLabel.getTop() + 40); popup.show(); this.setVisible(true); } So, when this method is called the onLoad is not called yet and the popup is not positioned in the right place because the last label is (may be) missing in the dom or something? I have menu that switches the viewId and after selecting other viewId it works fine, but the problem is that when loading for the first time with the devaultViewId this popup is not on the right place. I also tried to play with revealDisplay and onRevealDisplay but no effect. if someone has an idea, please help. 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-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: MVP: show view after onLoad is done
Hi, Not sure what you talk about. I have never heard about IncrementalCommand, but I will look at it. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: MVP: show view after onLoad is done
On Thu, Dec 17, 2009 at 8:53 AM, mariyan nenchev nenchev.mari...@gmail.comwrote: Hi, Not sure what you talk about. I have never heard about IncrementalCommand, but I will look at it. http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/user/client/IncrementalCommand.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-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
[gwt-contrib] [google-web-toolkit] r7092 committed - Ensures that onload events are fired for images even if the browser fi...
Revision: 7092 Author: jlaba...@google.com Date: Fri Nov 20 16:10:50 2009 Log: Ensures that onload events are fired for images even if the browser fires the onload event synchronously while the image is not attached. Patch by: jlabanca Review by: jgw (Partial TBR) http://code.google.com/p/google-web-toolkit/source/detail?r=7092 Modified: /trunk/user/src/com/google/gwt/user/client/impl/DOMImplOpera.java /trunk/user/src/com/google/gwt/user/client/impl/DOMImplStandard.java /trunk/user/src/com/google/gwt/user/client/impl/DOMImplTrident.java /trunk/user/src/com/google/gwt/user/client/ui/Image.java /trunk/user/src/com/google/gwt/user/client/ui/impl/ClippedImageImpl.java /trunk/user/src/com/google/gwt/user/client/ui/impl/ClippedImageImplIE6.java /trunk/user/test/com/google/gwt/resources/client/ImageResourceTest.java /trunk/user/test/com/google/gwt/uibinder/test/client/UiBinderTest.java /trunk/user/test/com/google/gwt/user/client/ui/ImageTest.java /trunk/user/test/com/google/gwt/user/client/ui/TreeItemTest.java /trunk/user/test/com/google/gwt/user/client/ui/TreeTest.java === --- /trunk/user/src/com/google/gwt/user/client/impl/DOMImplOpera.java Tue Jul 21 07:10:53 2009 +++ /trunk/user/src/com/google/gwt/user/client/impl/DOMImplOpera.java Fri Nov 20 16:10:50 2009 @@ -59,7 +59,7 @@ elem.onscroll = (bits 0x04000) ? @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; elem.onload= (bits 0x08000) ? -@com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; + @com.google.gwt.user.client.impl.DOMImplStandard::dispatchUnhandledEvent : null; elem.onerror = (bits 0x1) ? @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; elem.onmousewheel = (bits 0x2) ? === --- /trunk/user/src/com/google/gwt/user/client/impl/DOMImplStandard.java Fri Oct 16 14:48:33 2009 +++ /trunk/user/src/com/google/gwt/user/client/impl/DOMImplStandard.java Fri Nov 20 16:10:50 2009 @@ -38,6 +38,9 @@ @SuppressWarnings(unused) private static JavaScriptObject dispatchEvent; + @SuppressWarnings(unused) + private static JavaScriptObject dispatchUnhandledEvent; + @Override public Element eventGetFromElement(Event evt) { if (evt.getType().equals(mouseover)) { @@ -165,6 +168,11 @@ return true; }); + @com.google.gwt.user.client.impl.DOMImplStandard::dispatchUnhandledEvent = $entry(function(evt) { + this.__gwtLastUnhandledEvent = evt.type; + @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent.call(this, evt); +}); + @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent = $entry(function(evt) { var listener, curElem = this; while (curElem !(listener = curElem.__listener)) { @@ -231,7 +239,7 @@ if (chMask 0x04000) elem.onscroll = (bits 0x04000) ? @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; if (chMask 0x08000) elem.onload= (bits 0x08000) ? -@com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; + @com.google.gwt.user.client.impl.DOMImplStandard::dispatchUnhandledEvent : null; if (chMask 0x1) elem.onerror = (bits 0x1) ? @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; if (chMask 0x2) elem.onmousewheel = (bits 0x2) ? === --- /trunk/user/src/com/google/gwt/user/client/impl/DOMImplTrident.java Wed Oct 28 09:10:53 2009 +++ /trunk/user/src/com/google/gwt/user/client/impl/DOMImplTrident.java Fri Nov 20 16:10:50 2009 @@ -31,6 +31,9 @@ @SuppressWarnings(unused) private static JavaScriptObject dispatchDblClickEvent; + @SuppressWarnings(unused) + private static JavaScriptObject dispatchUnhandledEvent; + /** * Let every GWT app on the page preview the current event. If any app cancels * the event, the event will be canceled for all apps. @@ -151,6 +154,11 @@ } }); + @com.google.gwt.user.client.impl.DOMImplTrident::dispatchUnhandledEvent = $entry(function() { + this.__gwtLastUnhandledEvent = $wnd.event.type; + @com.google.gwt.user.client.impl.DOMImplTrident::dispatchEvent.call(this); +}); + // We need to create these delegate functions to fix up the 'this' context. // Normally, 'this' is the firing element, but this is only true for // 'onclick = ...' event handlers, not for handlers setup via attachEvent(). @@ -243,7 +251,7 @@ if (chMask 0x04000) elem.onscroll = (bits 0x04000) ? @com.google.gwt.user.client.impl.DOMImplTrident::dispatchEvent : null; if (chMask 0x08000) elem.onload= (bits 0x08000
Javascript onload called before Java onModuleLoad
I am needing the onModuleLoad event to fire before the window onload event, in Firefox and Chrome it does it correctly but in Internet Explorer 7 and 8 it happens second, is there anything I can do to make the onload event of the web page happen after the onModuleLoad? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=.
[gwt-contrib] [google-web-toolkit] r6656 committed - Disabling another image test because of the synchronous onload issue 8...
Revision: 6656 Author: jlaba...@google.com Date: Wed Nov 4 11:45:20 2009 Log: Disabling another image test because of the synchronous onload issue 863. Patch by: jlabanca Review by: jgw (desk) http://code.google.com/p/google-web-toolkit/source/detail?r=6656 Modified: /trunk/user/test/com/google/gwt/user/client/ui/impl/ClippedImagePrototypeTest.java === --- /trunk/user/test/com/google/gwt/user/client/ui/impl/ClippedImagePrototypeTest.java Mon Oct 26 18:35:41 2009 +++ /trunk/user/test/com/google/gwt/user/client/ui/impl/ClippedImagePrototypeTest.java Wed Nov 4 11:45:20 2009 @@ -82,9 +82,11 @@ * Also checks to make sure that a load event is fired on when * {...@link com.google.gwt.user.client.ui.impl.ClippedImagePrototype#applyTo(com.google.gwt.user.client.ui.Image)} * is called. + * + * TODO(jlabanca): Enable this test when issue 863 is fixed */ @DoNotRunWith({Platform.HtmlUnit}) - public void testApplyToClippedImage() { + public void disabledTestApplyToClippedImage() { final Image image = new Image(counting-backwards.png, 12, 13, 8, 8); assertEquals(12, image.getOriginLeft()); --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] [google-web-toolkit] r6588 committed - Disabling some tests in ImageTest because Chrome fires onload synchron...
Revision: 6588 Author: jlaba...@google.com Date: Mon Nov 2 12:47:09 2009 Log: Disabling some tests in ImageTest because Chrome fires onload synchronously. I will address this issue later. Patch by: jlabanca Review by: jgw (desk) Issue: 863 http://code.google.com/p/google-web-toolkit/source/detail?r=6588 Modified: /trunk/user/test/com/google/gwt/user/client/ui/ImageTest.java === --- /trunk/user/test/com/google/gwt/user/client/ui/ImageTest.java Mon Oct 26 18:35:41 2009 +++ /trunk/user/test/com/google/gwt/user/client/ui/ImageTest.java Mon Nov 2 12:47:09 2009 @@ -277,7 +277,7 @@ * Tests the creation of an image in clipped mode. */ @DoNotRunWith({Platform.HtmlUnit}) - public void testCreateClippedImage() { + public void disabledTestCreateClippedImage() { final Image image = new Image(counting-forwards.png, 16, 16, 16, 16); delayTestFinish(5000); @@ -362,7 +362,7 @@ * on a clipped image. */ @DoNotRunWith({Platform.HtmlUnit}) - public void testSetUrlAndVisibleRectOnClippedImage() { + public void disabledTestSetUrlAndVisibleRectOnClippedImage() { final Image image = new Image(counting-backwards.png, 12, 12, 12, 12); delayTestFinish(5000); @@ -413,7 +413,7 @@ * on a clipped image. */ @DoNotRunWith({Platform.HtmlUnit}) - public void testSetVisibleRectAndLoadEventsOnClippedImage() { + public void disabledTestSetVisibleRectAndLoadEventsOnClippedImage() { final Image image = new Image(counting-backwards.png, 16, 16, 16, 16); delayTestFinish(5000); --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Wrap onLoad/Unload in a try block if UncaughtExceptionHandler is present
On 2009/09/14 20:23:31, jlabanca wrote: So the UncaughtExceptionHandler violates finally? Isn't that a pretty fundamental problem? http://gwt-code-reviews.appspot.com/64815 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Wrap onLoad/Unload in a try block if UncaughtExceptionHandler is present
What do you mean? Thanks, John LaBanca jlaba...@google.com On Mon, Sep 14, 2009 at 4:33 PM, rj...@google.com wrote: On 2009/09/14 20:23:31, jlabanca wrote: So the UncaughtExceptionHandler violates finally? Isn't that a pretty fundamental problem? http://gwt-code-reviews.appspot.com/64815 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Wrap onLoad/Unload in a try block if UncaughtExceptionHandler is present
The uncaughtexceptionhandler is in an inner try/catch block. The outer try/finally still runs, so we always reach the finally block. Thanks, John LaBanca jlaba...@google.com On Mon, Sep 14, 2009 at 4:34 PM, John LaBanca jlaba...@google.com wrote: What do you mean? Thanks, John LaBanca jlaba...@google.com On Mon, Sep 14, 2009 at 4:33 PM, rj...@google.com wrote: On 2009/09/14 20:23:31, jlabanca wrote: So the UncaughtExceptionHandler violates finally? Isn't that a pretty fundamental problem? http://gwt-code-reviews.appspot.com/64815 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Wrap onLoad/Unload in a try block if UncaughtExceptionHandler is present
NM, brainfart. But I'm confused just why you're tying this to UncaughtExceptionHandler. The invariant will still go straight to hell if none has been provided, right? Also, why not fix this in a single spot rather than several scattered places? Also, it's kind of weird to catch Throwable rather than Exception. But assuming you're sure about Throwable, seems like you should instead do something like this in Panel: public class PanelDetachException extends RuntimeException { PanelDetachException(SetThrowable causes) { ... } SetThrowable getCauses() {...} } protected void doDetachChildren() { SetThrowable caught = new HashSetThrowable(); // Ensure that all child widgets are detached. for (IteratorWidget it = iterator(); it.hasNext();) { Widget child = it.next(); try { child.onDetach(); } catch (Throwable e) { caught.add(e); } } if (!caught.isEmpty()) { throw new PanelDetachException(caught); } } On Mon, Sep 14, 2009 at 1:35 PM, John LaBanca jlaba...@google.com wrote: The uncaughtexceptionhandler is in an inner try/catch block. The outer try/finally still runs, so we always reach the finally block. Thanks, John LaBanca jlaba...@google.com On Mon, Sep 14, 2009 at 4:34 PM, John LaBanca jlaba...@google.com wrote: What do you mean? Thanks, John LaBanca jlaba...@google.com On Mon, Sep 14, 2009 at 4:33 PM, rj...@google.com wrote: On 2009/09/14 20:23:31, jlabanca wrote: So the UncaughtExceptionHandler violates finally? Isn't that a pretty fundamental problem? http://gwt-code-reviews.appspot.com/64815 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Wrap onLoad/Unload in a try block if UncaughtExceptionHandler is present
It wouldn't necessarily need a refresh, and at least the attach state would be valid. I have two major concerns about leaving it out: 1. It could lead to memory leaks, because widgets are physically attached and cannot be detached. 2. adwords is running into this, and I can't isolate the real cause of the problem (ie, where is onLoad or onUnload really failing). With this patch or one like it, it should be easier to find real onLoad/onUnload failures in awfe. Thanks, John LaBanca jlaba...@google.com On Mon, Sep 14, 2009 at 5:13 PM, Ray Cromwell cromwell...@gmail.com wrote: It seems weird from the standpoint that in the ordinary state of affairs, you'd only get one exception from one detach operation and the loop would terminate early. I guess my question is, even with this fix, is the application likely to be in a good state that can keep running afterwards? Seems to be if an onLoad fails, the application is likely to be unable to recover and need a refresh in many cases, would it not? -Ray On Mon, Sep 14, 2009 at 1:53 PM, John LaBanca jlaba...@google.com wrote: You don't think its a little weird to batch up exceptions and then throw them? It fixes the problem for everyone, but for some reason it seems weird to me. Thanks, John LaBanca jlaba...@google.com On Mon, Sep 14, 2009 at 4:51 PM, Ray Ryan rj...@google.com wrote: NM, brainfart. But I'm confused just why you're tying this to UncaughtExceptionHandler. The invariant will still go straight to hell if none has been provided, right? Also, why not fix this in a single spot rather than several scattered places? Also, it's kind of weird to catch Throwable rather than Exception. But assuming you're sure about Throwable, seems like you should instead do something like this in Panel: public class PanelDetachException extends RuntimeException { PanelDetachException(SetThrowable causes) { ... } SetThrowable getCauses() {...} } protected void doDetachChildren() { SetThrowable caught = new HashSetThrowable(); // Ensure that all child widgets are detached. for (IteratorWidget it = iterator(); it.hasNext();) { Widget child = it.next(); try { child.onDetach(); } catch (Throwable e) { caught.add(e); } } if (!caught.isEmpty()) { throw new PanelDetachException(caught); } } On Mon, Sep 14, 2009 at 1:35 PM, John LaBanca jlaba...@google.comwrote: The uncaughtexceptionhandler is in an inner try/catch block. The outer try/finally still runs, so we always reach the finally block. Thanks, John LaBanca jlaba...@google.com On Mon, Sep 14, 2009 at 4:34 PM, John LaBanca jlaba...@google.comwrote: What do you mean? Thanks, John LaBanca jlaba...@google.com On Mon, Sep 14, 2009 at 4:33 PM, rj...@google.com wrote: On 2009/09/14 20:23:31, jlabanca wrote: So the UncaughtExceptionHandler violates finally? Isn't that a pretty fundamental problem? http://gwt-code-reviews.appspot.com/64815 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
Onload module problem
In my application i can reach server side code in Onload module that is in MyApplication class(this class implements EntryPoints) but i need to reach server side code not only in this class.For example on diffent class i create an button and also onclick event but i cant make this click listener work. How can i do this ? Do you have any suggetion ? --~--~-~--~~~---~--~~ 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 set an onLoad event listener on an IFrameElement?
Hi Jake, Unfortunately the DOM structure is bound more to the JavaScript way of doing things than Widgets. In JavaScript you can't have more than one event listener (of a given event type) per element, while Widgets may have any number. So to work around this: GWT Widgets are the only listeners on their nested Element object (notice they implement the com.google.gwt.user.client.EventListener interface). SO when they receive an event from the browser, they decode it into a DOMEvent and dispatch it to all the Handlers registered for that Widget. Unfortunately there is no simple way to deal with this on the DOM nodes themselves, and in particular there is no simple way to deal with IFrame loading events. If you take a look at how FormPanel receives loading events from it's hidden IFrame there are two different implementations (one for IE6, and the generic implementation). For normal browsers(com.google.gwt.user.client.ui.impl.FormPanelImplIE6), the event is hooked using: iframe.onload = function() { IE6 (com.google.gwt.user.client.ui.impl.FormPanelImplIE6) looks like: iframe.onreadystatechange = function() { if (iframe.readyState == 'complete') { Both implementations also ensure that they unhook the events, by assigning the listener function to null (see FormPanel.onAttach / onDetach). I would consider extending the Frame Widget rather than using the DOM api directly. Widgets provide loads of useful safety nets that you otherwise need to write yourself (including attaching multiple Handlers to the element). Hope this Helps. //J Jake wrote: Hi all, I just have a quick question: I know that GWT presents a fairly low- level DOM API that wraps native DOM objects. What I'd like to do is create a new iframe element, and then set a DOM onLoad listener on it so that I can then manipulate the iframe's internal document (its contentDocument). It's very easy for me to imagine how to implement this, except for the fact that I cannot find a way to set any kind of a listener on any of the DOM objects exposed by GWT. I found some blog posts that mentioned that GWT's method of event handling had changed in 1.6 [0][1], but I'm not sure if that applies only to classes that extend Widget, or to the wrapped DOM objects as well. Hopefully I'm just missing them. I'd greatly appreciate any guidance anyone can offer. Thanks, Jake [0] http://lemnik.wordpress.com/2009/03/04/gwts-new-event-model-handlers-in-gwt-16/ [1] http://lemnik.wordpress.com/2009/03/12/using-event-handlers-in-gwt-16/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Is it possible to set an onLoad event listener on an IFrameElement?
Hi all, I just have a quick question: I know that GWT presents a fairly low- level DOM API that wraps native DOM objects. What I'd like to do is create a new iframe element, and then set a DOM onLoad listener on it so that I can then manipulate the iframe's internal document (its contentDocument). It's very easy for me to imagine how to implement this, except for the fact that I cannot find a way to set any kind of a listener on any of the DOM objects exposed by GWT. I found some blog posts that mentioned that GWT's method of event handling had changed in 1.6 [0][1], but I'm not sure if that applies only to classes that extend Widget, or to the wrapped DOM objects as well. Hopefully I'm just missing them. I'd greatly appreciate any guidance anyone can offer. Thanks, Jake [0] http://lemnik.wordpress.com/2009/03/04/gwts-new-event-model-handlers-in-gwt-16/ [1] http://lemnik.wordpress.com/2009/03/12/using-event-handlers-in-gwt-16/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
onLoad() never invoked using Opera
This is a strange one. I am using GWT 1.5.3 and Opera 9.6 and onLoad() is never actually invoked. Works in all other browsers (IE6 and 7 8, Safari, Chrome). Any suggestions? Please let me know if someone has come across this. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
tabpanel and size computation in onLoad
Hello, I have a TabPanel. Inside this tabpanel, I have some widgets that do some size computation (using getOffsetHeight) in their onLoad() method. What I get : The widgets that are in the selected panel when the TabPanel is inserted get their size properly. But for the widgets inside the other panel, the sizes are all wrong : getOffsetheight always returns 0. I can't see how to have all the sizes properly set up. I tried to have some kind of refresh in a TabListener, but the TabPanel does not offer a way to force, for example, a remove/add to have the sizes recomputed. Any 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: tabpanel and size computation in onLoad
We're using GWT 1.5.2 on IE6 if that matters. --~--~-~--~~~---~--~~ 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: tabpanel and size computation in onLoad
Widgets don't return proper size values because they are not attached to the DOM before they are showed. Use fixed size values. On 2 Mrz., 11:46, LEDUQUE Mickaël mledu...@gmail.com wrote: We're using GWT 1.5.2 on IE6 if that matters. --~--~-~--~~~---~--~~ 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: tabpanel and size computation in onLoad
Well, I would already have done that if that was possible. --~--~-~--~~~---~--~~ 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: tabpanel and size computation in onLoad
If you size you tab content widgets in % terms, they will size up automatically when tab is selected if the main one is set to 100%, 100%. If you can't do that, there are several ways to approach the problem depending on exactly what your situation is. Perhaps you can be more specific. As Alex says, non-selected TabPanel decks themselves always have a width/height of zero, so in general you can get the base height you need from DeckPanel itself (rather than the individual deck's) maybe accurately only after one deck has been selected I think. On Mar 2, 12:40 pm, LEDUQUE Mickaël mledu...@gmail.com wrote: Well, I would already have done that if that was possible. --~--~-~--~~~---~--~~ 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: tabpanel and size computation in onLoad
Well, there are multiple case here : 1. Widgets that adjust themselves depending on the size of neighbour widgets. Some widgets have their size fixed decided in CSS styles, the other ones adjust depending on this size in the onload() 2. widgets like the incubator PagingScrollTable that have internal components that compute their size. For example (in com.google.gwt.widgetideas.table.client.ScrollTable) int totalHeight = DOM.getElementPropertyInt(getElement(), clientHeight); int headerHeight = headerTable.getOffsetHeight(); int footerHeight = 0; if (footerTable != null) { footerHeight = footerTable.getOffsetHeight(); } DOM.setStyleAttribute(headerWrapper, height, headerHeight + px); if (footerWrapper != null) { DOM.setStyleAttribute(footerWrapper, height, footerHeight + px); } DOM.setStyleAttribute(dataWrapper, height, (totalHeight - headerHeight - footerHeight) + px); --~--~-~--~~~---~--~~ 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: tabpanel and size computation in onLoad
1. Widgets that adjust themselves depending on the size of neighbour widgets. Some widgets have their size fixed decided in CSS styles, the other ones adjust depending on this size in the onload() Widgets given fixed sizes in CSS/code should appear correctly when tab selected. Is there a reason why you cannot size the remaining relatively sized widgets in percentage terms? So long as they are told to fill up available space (or proportion of it) they should do so when tab selected. That's the way it's expected to work. In general I think one should avoid calculating sizes manually in code like the plague - use percentages and leave it to the browser otherwise you will go mad. AFAIK the only common situation you can't do that is with ScrollPanels which must be given a fixed height in pixels to kick in properly. 2. widgets like the incubator PagingScrollTable that have internal components that compute their size. For example (in com.google.gwt.widgetideas.table.client.ScrollTable) int totalHeight = DOM.getElementPropertyInt(getElement(), clientHeight); int headerHeight = headerTable.getOffsetHeight(); int footerHeight = 0; if (footerTable != null) { footerHeight = footerTable.getOffsetHeight(); } DOM.setStyleAttribute(headerWrapper, height, headerHeight + px); if (footerWrapper != null) { DOM.setStyleAttribute(footerWrapper, height, footerHeight + px); } DOM.setStyleAttribute(dataWrapper, height, (totalHeight - headerHeight - footerHeight) + px); I'm not sure how PagingScrollTable works in TabPanels. Have you tried setting it to size(100%,100%) and proved it does not behave properly when it's tab is selected? I would be surprised if it didn't as that would be an obvious flaw. On Mar 2, 1:20 pm, LEDUQUE Mickaël mledu...@gmail.com wrote: Well, there are multiple case here : 1. Widgets that adjust themselves depending on the size of neighbour widgets. Some widgets have their size fixed decided in CSS styles, the other ones adjust depending on this size in the onload() 2. widgets like the incubator PagingScrollTable that have internal components that compute their size. For example (in com.google.gwt.widgetideas.table.client.ScrollTable) int totalHeight = DOM.getElementPropertyInt(getElement(), clientHeight); int headerHeight = headerTable.getOffsetHeight(); int footerHeight = 0; if (footerTable != null) { footerHeight = footerTable.getOffsetHeight(); } DOM.setStyleAttribute(headerWrapper, height, headerHeight + px); if (footerWrapper != null) { DOM.setStyleAttribute(footerWrapper, height, footerHeight + px); } DOM.setStyleAttribute(dataWrapper, height, (totalHeight - headerHeight - footerHeight) + px); --~--~-~--~~~---~--~~ 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: tabpanel and size computation in onLoad
On Mon, 2009-03-02 at 04:22 -0800, alex.d wrote: Widgets don't return proper size values because they are not attached to the DOM before they are showed. Use fixed size values. Yes, you are right. But please share how to set the widget to the height of the browser window. For example, in the GWT Showcase example, i can use the contentWrapper or the menuWrapper widget to set the width and the height: wrapperWidget.setWidth(100%), wrapperWidget.setHeight (360px). How can i calculate (instead of forcing 360px) the height to be exactly the height of the window browser less the height of the topPanel FlexTable of the GWT Showcase? Thanks BaTien DBGROUPS and BudhNet On 2 Mrz., 11:46, LEDUQUE Mickaël mledu...@gmail.com wrote: We're using GWT 1.5.2 on IE6 if that matters. --~--~-~--~~~---~--~~ 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: tabpanel and size computation in onLoad
I have tried the followings at the end of omModuleLoad of the entry point, but it does not work. Any suggestion? int totalHeight=DOM.getElementPropertyInt(app.getElement (),clientHeight); int topPanelHeight = app.getTopPanel().getOffsetHeight(); // set the height of the 2 widget in the bottomPanel DOM.setStyleAttribute(app.getContentDecorator().getElement(), height, (totalHeight - topPanelHeight) + px); DOM.setStyleAttribute(app.getStackPanel().getElement(), height, (totalHeight - topPanelHeight) + px); On Mar 2, 9:02 am, Duong BaTien duong.bat...@gmail.com wrote: On Mon, 2009-03-02 at 04:22 -0800, alex.d wrote: Widgets don't return proper size values because they are not attached to the DOM before they are showed. Use fixed size values. Yes, you are right. But please share how to set the widget to the height of the browser window. For example, in the GWT Showcase example, i can use the contentWrapper or the menuWrapper widget to set the width and the height: wrapperWidget.setWidth(100%), wrapperWidget.setHeight (360px). How can i calculate (instead of forcing 360px) the height to be exactly the height of the window browser less the height of the topPanel FlexTable of the GWT Showcase? Thanks BaTien DBGROUPS and BudhNet On 2 Mrz., 11:46, LEDUQUE Mickaël mledu...@gmail.com wrote: We're using GWT 1.5.2 on IE6 if that matters. --~--~-~--~~~---~--~~ 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] PopupPanel#center() leads to double call of onLoad()
Reviewers: ecc, Description: If you create a PopupPanel and display it by calling its center() method, its onLoad() method will be called twice. This is because the center() method shows the popup with animation disabled to do its calculations, hides it, and then reshows it with animation enabled. This patch shows the popup without animation enabled, does its calculations, and then starts the animation without ever hiding it. Please review this at http://gwt-code-reviews.appspot.com/811 Affected files: user/src/com/google/gwt/user/client/ui/PopupPanel.java user/test/com/google/gwt/user/client/ui/PopupTest.java Index: user/test/com/google/gwt/user/client/ui/PopupTest.java === --- user/test/com/google/gwt/user/client/ui/PopupTest.java (revision 4330) +++ user/test/com/google/gwt/user/client/ui/PopupTest.java (working copy) @@ -29,10 +29,22 @@ * Expose otherwise private or protected methods. */ private class TestablePopupPanel extends PopupPanel { +private int onLoadCount; + @Override public Element getContainerElement() { return super.getContainerElement(); } + +public void assertOnLoadCount(int expected) { + assertEquals(expected, onLoadCount); +} + +@Override +public void onLoad() { + super.onLoad(); + onLoadCount++; +} } @Override @@ -95,6 +107,45 @@ testDependantPopupPanel(primaryPopup); } + /** + * Test that the onLoad method is only called once when showing the popup. + */ + public void testOnLoad() { +TestablePopupPanel popup = new TestablePopupPanel(); + +// show() without animation +{ + popup.setAnimationEnabled(false); + popup.show(); + popup.assertOnLoadCount(1); + popup.hide(); +} + +// show() with animation +{ + popup.setAnimationEnabled(true); + popup.show(); + popup.assertOnLoadCount(2); + popup.hide(); +} + +// center() without animation +{ + popup.setAnimationEnabled(false); + popup.center(); + popup.assertOnLoadCount(3); + popup.hide(); +} + +// center() with animation +{ + popup.setAnimationEnabled(true); + popup.center(); + popup.assertOnLoadCount(4); + popup.hide(); +} + } + public void testPopup() { // Get rid of window margins so we can test absolute position. Window.setMargin(0px); Index: user/src/com/google/gwt/user/client/ui/PopupPanel.java === --- user/src/com/google/gwt/user/client/ui/PopupPanel.java (revision 4330) +++ user/src/com/google/gwt/user/client/ui/PopupPanel.java (working copy) @@ -355,10 +355,16 @@ setPopupPosition(Window.getScrollLeft() + left, Window.getScrollTop() + top); if (!initiallyShowing) { - hide(); - setVisible(true); setAnimationEnabled(initiallyAnimated); - show(); + // Run the animation. The popup is already visible, so we can skip the + // call to setState. + if (initiallyAnimated) { +impl.setClip(getElement(), rect(0px, 0px, 0px, 0px)); +setVisible(true); +resizeAnimation.run(ANIMATION_DURATION); + } else { +setVisible(true); + } } } --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: PopupPanel#center() leads to double call of onLoad()
Looks like it didn't like the diff. You can see the changes by clicking the Download link in the Patch column. http://gwt-code-reviews.appspot.com/811 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: PopupPanel#center() leads to double call of onLoad()
On 2008/12/12 15:08:02, jlabanca wrote: Looks like it didn't like the diff. You can see the changes by clicking the Download link in the Patch column. Oh, and I tested this manually and added a unit test. http://gwt-code-reviews.appspot.com/811 --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
JSNI to call html body onload=
Hi all, I created javascript function from existing java function using JSNI. The problem is I can call the converted javascript function from onclick. I want to call that function from body onload=. I already tried to call. But not working. Any idea? Hope ur help. Thanks in advance. Aye --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
What's the difference between onLoad and onAttach?
*onAttachfile:///C:/GWT/doc/javadoc/com/google/gwt/user/client/ui/Widget.html#onAttach%28%29 *() This method is called when a widget is attached to the browser's document. *onLoadfile:///C:/GWT/doc/javadoc/com/google/gwt/user/client/ui/Widget.html#onLoad%28%29 *() This method is called immediately after a widget becomes attached to the browser's document. so what's not immediately? Thanks Fred --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: What's the difference between onLoad and onAttach?
Yeah, the API doc is pretty thin and sometimes confusing. Widget.onLoad() is called by Widget.onAttach(). While Widget.onAttach() is mostly for Panel implementers, Widget.onLoad() is for Widget implementers. Override onLoad() if you like to be notified when your Widget is being attached. Look at the source: http://code.google.com/p/google-web-toolkit/source/browse/releases/1.5/user/src/com/google/gwt/user/client/ui/Widget.java On 12 Sep., 12:32, Fred Janon [EMAIL PROTECTED] wrote: *onAttachfile:///C:/GWT/doc/javadoc/com/google/gwt/user/client/ui/Widget.html#onAttach%28%29 *() This method is called when a widget is attached to the browser's document. *onLoadfile:///C:/GWT/doc/javadoc/com/google/gwt/user/client/ui/Widget.html#onLoad%28%29 *() This method is called immediately after a widget becomes attached to the browser's document. so what's not immediately? Thanks Fred --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: What's the difference between onLoad and onAttach?
Thanks a lot Folke and Thomas. Fred On Fri, Sep 12, 2008 at 20:42, Thomas Broyer [EMAIL PROTECTED] wrote: On 12 sep, 14:17, Folke [EMAIL PROTECTED] wrote: Yeah, the API doc is pretty thin and sometimes confusing. Widget.onLoad() is called by Widget.onAttach(). While Widget.onAttach() is mostly for Panel implementers, Widget.onLoad() is for Widget implementers. Override onLoad() if you like to be notified when your Widget is being attached. In brief: - if you want your code called just before child widgets are being attached (and before the event listener is actually set), override onAttach and put your code before super.onAttach() - if you want your code called after child widgets have been attached (and after the event listener has been set), override onLoad (which is equivalent to overriding onAttach and putting your code after super.onAttach()) Look at the source: http://code.google.com/p/google-web-toolkit/source/browse/releases/1 Yes, it's always the best solution when you wonder how things work. And given that the source is included within gwt-user.jar, hovering a method while maintain the shift key depressed shows you the method's code (in Eclipse), so it's really really easy. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---