Hi FKereki,

I am assuming that you need this behaviour bcause you have two
different HTMLPanels, which use the a very similar logic?

In that case I recommend that you put your logic into another class,
for instance PanelLogic, and split your existing class into two, using
a dedicated template each. You could then inject PanelLogic into both
of your classes and call the appropriate methods on PanelLogic from
each. This will produce slight code replication but also adds to the
flexibility and testibility (the PanelLogic class does not know of any
UiBinder magic). Takes this with a grain of salt though, since I
haven't yet figured out an ideal solution that takes advatage of both
UiBinder and the origina MVP pattern so this is a partly offtopic
post. For instance it is very unclear to me whether it is feasible to
make the PanelLogic class agnostic of the structure of the View
classes etc...

In any case, concerning your original question, I guess that using a
custom constructor that sets someWidget (or not) and adding @UiField
(provided=true) will solve your problem, although I am having doubts
about the testibility of that :)

Cheers, Jonas


On Dec 14, 3:39 am, FKereki <[email protected]> wrote:
> Hi!
>
> Say you want to have two templates for a single class.
>
> You can have
>
> @UiTemplate("firstTemplate.ui.xml")
> interface Binder1 extends UiBinder<HTMLPanel, yourClass> {}
> private static final Binder binder1= GWT.create(Binder1.class);
>
> @UiTemplate("secondTemplate.ui.xml")
> interface Binder2 extends UiBinder<HTMLPanel, yourClass> {}
> private static final Binder binder2= GWT.create(Binder2.class);
>
> but how do you specify to which template does each @UiField belong? If
> you just write
>
> @UiField SomeWidgetClass someWidget
>
> UiBinder will object unless "someWidget" is found on BOTH templates.
>
> Can this be done, or need I create separate classes for each template?

--

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