When you call uibinder.createAndBindUi(this), it creates HTMLPanel instances as defined in your template and assigns them to your fields. This overwrites the instances you created manually. There are 2 ways to fix this:
1. Use the HTMLPanel instances that UiBinder creates and add your content to them after calling createAndBindUi. 2. If you really want to create the HTMLPanel instances yourself (or inject them via constructor arguments), you can mark the fields with @UiField(provided=true). I'm not sure if it matters whether the fields are set before or after calling createAndBindUi. Given the choice between the two, I would generally favor #1, and I think that's closer to what you're trying for anyway by calling them "containers". Let UiBinder create the containers that you can then fill with anything you want. -Brian On Apr 14, 9:28 am, amjedonline <[email protected]> wrote: > Hi, > Am trying to create a simple DockPanelLayout for my applicaiton. > Layout itself is divided into north, south and center regions. > > Below is the binding xml: > <ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' > xmlns:g='urn:import:com.google.gwt.user.client.ui'> > > <g:DockLayoutPanel unit='PX'> > <g:north size='100'> > <g:HTMLPanel ui:field='headerContainer' /> > </g:north> > <g:center> > <g:HTMLPanel ui:field='centerContainer' /> > </g:center> > <g:south size='100'> > <g:HTMLPanel ui:field='footerContainer' /> > </g:south> > </g:DockLayoutPanel> > </ui:UiBinder> > > This is the Owner class: > public class Application extends Composite { > > @UiField > public HTMLPanel headerContainer; > > @UiField > public HTMLPanel centerContainer; > > @UiField > public HTMLPanel footerContainer; > > interface ApplicationUiBinder extends UiBinder<Widget, Application> { > }; > > private static ApplicationUiBinder uibinder = GWT > .create(ApplicationUiBinder.class); > > public Application() { > headerContainer = new HTMLPanel("<b>Header</b>"); > centerContainer = new HTMLPanel("Center"); > footerContainer = new HTMLPanel("Footer"); > initWidget(uibinder.createAndBindUi(this)); > } > > } > > And this is what I do in EntryPoint: > > Application app = new Application(); > RootLayoutPanel.get().add(app); > > I dont get the labels - center, header and footer in the page. > > On debugging I found that output generated by createAndBindUI contains > empty divs (while the inner html is expected). > > Any help in this regard will be appreciated. -- 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.
