Thanks for your help. I guess, even after java -> javascript compilation, the first example will still instantiate a javascript object for each widget, right?
> > So am I right to think that I should never use widget inside UiBinder > > xml except if I have the attribute ui:field (in other words, except if > > I need it in the Java code)? > > Its best to minimize usage of widgets when you can; there is always a cost > associated with them. Specifically, VerticalPanel and HorizontalPanel almost > always should be replaced with <divs> (or tables if you don't like semantic > markup). > > BUT I'm still wondering if once compiled to JS those instanciations are> > translated to plain html. It's not clear in what you're saying if it's in > > production or in development mode. > > The code pasted was the intermediate, unoptimized java code that uibinder > generates prior to java -> js compilation. It will undergo optimizations > once the compiler acts on it, and the code will for sure be a lot more > performant. > > However, in general, innerHTML is much better performance wise than creating > objects and adding them to DOM. So, even after the compiler finishes all > optimizations, performance wise it will still lag behind inline html. > > --Sri > > On 15 April 2010 19:30, Christian Goudreau > <[email protected]>wrote: > > > > > I don't know if you're right about thinking that there's still situation > > where an HTMLPanel or layout panel, without uifield is the best way to go, > > but I do know that we should use as often as possible html code instead of > > widget for the very reason you exposed. > > > BUT I'm still wondering if once compiled to JS those instanciations are > > translated to plain html. It's not clear in what you're saying if it's in > > production or in development mode. > > > Christian > > > On Thu, Apr 15, 2010 at 9:44 AM, plcoirier <[email protected]> wrote: > > >> With UiBinder, I thought that GWT compiler would prevent instantiation > >> of widget with no ui:field attribute by directly inserting the html > >> code of the widget. > > >> In other words, I thought that: > > >> <g:VerticalPanel> > >> <g:HorizontalPanel><g:Label>Line > >> 1</g:Label></g:HorizontalPanel> > >> <g:HorizontalPanel><g:Label>Line > >> 2</g:Label></g:HorizontalPanel> > >> </g:VerticalPanel> > > >> would give the same result as: > > >> <g:HTMLPanel> > >> <table> > >> <tr> > >> <td>Line1</td> > >> <td>Line2</td> > >> </tr> > >> </table> > >> </g:HTMLPanel> > > >> But in the first case, it generates this Java code: > >> com.google.gwt.user.client.ui.Label f_Label3 = > >> (com.google.gwt.user.client.ui.Label) > >> GWT.create(com.google.gwt.user.client.ui.Label.class); > >> com.google.gwt.user.client.ui.HorizontalPanel f_HorizontalPanel2 = > >> (com.google.gwt.user.client.ui.HorizontalPanel) > >> GWT.create(com.google.gwt.user.client.ui.HorizontalPanel.class); > >> com.google.gwt.user.client.ui.Label f_Label5 = > >> (com.google.gwt.user.client.ui.Label) > >> GWT.create(com.google.gwt.user.client.ui.Label.class); > >> com.google.gwt.user.client.ui.HorizontalPanel f_HorizontalPanel4 = > >> (com.google.gwt.user.client.ui.HorizontalPanel) > >> GWT.create(com.google.gwt.user.client.ui.HorizontalPanel.class); > >> com.google.gwt.user.client.ui.VerticalPanel f_VerticalPanel1 = > >> (com.google.gwt.user.client.ui.VerticalPanel) > >> GWT.create(com.google.gwt.user.client.ui.VerticalPanel.class); > > >> f_Label3.setText("Line 1"); > >> f_HorizontalPanel2.add(f_Label3); > >> f_VerticalPanel1.add(f_HorizontalPanel2); > >> f_Label5.setText("Line 2"); > >> f_HorizontalPanel4.add(f_Label5); > >> f_VerticalPanel1.add(f_HorizontalPanel4); > > >> and the second case, it generates: > >> com.google.gwt.user.client.ui.HTMLPanel f_HTMLPanel1 = new > >> com.google.gwt.user.client.ui.HTMLPanel("<table> <tr> <td>Line1</td> > >> <td>Line2</td> </tr> </table>"); > > >> So am I right to think that I should never use widget inside UiBinder > >> xml except if I have the attribute ui:field (in other words, except if > >> I need it in the Java code)? > > >> Thanks, > >> Pierre > > >> -- > >> 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]<google-web-toolkit%2bunsubs[email protected]> > >> . > >> 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 [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<google-web-toolkit%2bunsubs[email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/google-web-toolkit?hl=en.- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [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.
