Hello guys,
I was going through the UiBinder docs (
http://code.google.com/webtoolkit/doc/latest/DevGuideUiBinder.html#Using_a_widget),
 
and I was wondering if you could have a nested view, like this:

interface Header *extends IsWidget* {
 // have some methods here, not important
}

class AHeader implements Header {
 // implementation
}


Now, this header is part of a more complex view (provided UiBinder xml code 
below):
...
<g:HTMLPanel>
*  <my:Header ui:field='header' />*
  .... other widgets
</g:HTMLPanel>


And the class:
ApplicationView *extends Composite* {
 @UiField(provided=true) Header header;
 public ApplicationView (Header header) {
   this.header = header;
   // initWidget using UiBinder
 }
}

This looks ok to me -- however, this code will not actually work, and this 
is why (extract from generated UiBinder):
com.sample.Header header = owner.header;
....
*f_HTMLPanel1.addAndReplaceElement(header, domId0Element);*
*
*
*
*
It's quite obvious and straightforward -- the HTMLPanel#addAndReplaceElement 
method expects a Widget. However, the header is not an actual Widget, 
instead it could be retrieved as a Widget through IsWidget interface. Of 
course, I can switch the reference in .ui.xml, changing it from *Header *to 
*AHeader* (concrete implementation). However, this beats the purpose of 
having interface definitions for Views (which is not totally wrong to have, 
unless you want to give up unit testing -- and I don't).

Is there a way to fix this?
Thanks,
Alex.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/LgtslNvPRewJ.
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