Hi All

I'd like to use UIBinder to layout my page which is made of several
Views. I'm kind of confused as to how to do this...

For example, I'd like to inject my views straight into the UIBinder
context, so I extend the xml declaration to be:

<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
        xmlns:g='urn:import:com.google.gwt.user.client.ui'
xmlns:step="urn:import:com.tyndalehouse.step.web.client.view">

That gives me access to the View, and I can then use something like:
<g:DockLayoutPanel unit='EM'>
  <g:center>
        <step:VersionSelectorView ui:field="versionSelector" />
  </g:center>
  </g:west>
</g:DockLayoutPanel>

where VersionSelectorView is one of my views. At the moment, I'm using
Gin to inject the Presenter via the constructor, and setting it as a
field, that is provided:

@UiField (provided = true)
VersionSelectorView versionSelector;
...

@Inject
public StepView(final VersionSelectorPresenter versionSelector) {
this.versionSelector = versionSelector;
}

Now that's all very well... but what if the view above has many many
composites that I want to use in the UIBinder declarative XML? Also it
doesn't feel to be like it's best practice to inject the Presenter
into the View. Surely, it shouldn't know about it all... And I should
either be injecting is as VersionSelectorPresenter.Display or
VersionSelectorView.

However using gwt-dispatch, when I inject it like that, the View is
provided, but it's not bound to any presenter...

So basically, I'd like to know what the best practice is/would be?
Should I be injecting all the providers into the main Presenter (in my
case StepPresenter), and somehow setting them all onto the view? that
makes a lot of setters, but at least I get rid of the presenters from
the Views....

I read somewhere something about injecting providers for lazy
initialisation. Sounds good, but I'm guessing I've still got lots of
them to inject...

Perhaps, that's not how I'm supposed to use UIBinder, but then I still
seem to have a similar issue with the way to get lots of views
injected into one Parent View.

Any ideas anyone?
Cheers
Chris


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