I can't see how creating a flowpanel between creating a widget and adding a
style would make any difference whatsoever.
Ian

http://examples.roughian.com


2009/9/3 Ed <[email protected]>

>
> He All,
>
> I would like to share the following good GWT programing practice (It
> just cost me to solve a tinny bug because of this):
> -- Set any style name/attribute just after a widget is created, before
> it's added to any panel!!!
>
> So do something like this:
> Widget wid = new HTML("test");
> wid.addStyleName("someStyleName");
> FlowPanel panel = new FlowPanel();
>
> And NOT this:
> Widget wid = new HTML("test");
> FlowPanel panel = new FlowPanel(); // or some other panel
> wid.addStyleName("someStyleName");
>
>
> Wy?
> Suppose the panel is doing some sort of animation to add/insert the
> widget, like a slide/move, etc... animation. Then you could be in
> trouble in case the style name contains dimension information (width/
> height) or other stuff that is used in your animation.. The dimensions
> that are retrieved by the animation that is contained in the "flow
> panel" will then be incorrect, as the style isn't set yet...
> This can lead to strange behavior depending on when the style is set,
> and what animation you use.. I may case it also was different in FF
> and IE..
> In my case: I perform a slide in/out animation before the style name
> was set, such that the widget looked much bigger during the slide
> animation in IE (not FF) and all of a sudden turned to normal again
> after doing "something" else on the screen after the animation was
> complete.
>
> I put a little check in my animations now and check the style
> information that I need at the start and finish of the animation, as
> they should be the same, which wasn't in my case.
>
> So in general it's a good pratice to always set the style name/
> attributes before adding your widget to any panel. Maybe you don't use
> animation, but you never know what will come in the future...  And
> then al of a sudden you get these strange bugs after an upgrade of
> your own software or GWT.
>
>
> BTW: I noticed that the framework gwt-fx performs the slide animation
> in a deferred command, maybe for this reason....
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to