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 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.

Reply via email to