http://gwt-code-reviews.appspot.com/794801/diff/14001/13004 File user/src/com/google/gwt/uibinder/elementparsers/UiChildParser.java (right):
http://gwt-code-reviews.appspot.com/794801/diff/14001/13004#newcode79 user/src/com/google/gwt/uibinder/elementparsers/UiChildParser.java:79: writer.die(child, "Expecting only widgets in %s", child); On 2010/08/27 16:27:17, rjrjr wrote:
On 2010/08/27 14:06:49, sonnyf wrote: > On 2010/08/26 20:09:32, rjrjr wrote: > > We had talked about handling non-widget Element children as well.
Are you
> going > > to add that in a follow up patch? > > Lol bobv had me add that check! I honestly don't think it matters if
its a
> widget or not. I can remove the widget constraint if you like....
The only
> thing is, UiBinder will need to be able to instantiate the element
properly.
Is > that logic in place yet? >
Try it on something like:
@UiChild void addMagicDiv(DivElement child)
<my:Widget> <my:magicDiv><div>Blah di blah</div><my:magicDiv> </my:Widget>
That might just work, though it's kind of ugly because it requires
that div to
be declared. (I wonder if its so ugly that we should hold off on it.)
Doing it
properly would probably be more work that you want to add on to this
patch,
although it's worth considering.
Properly? In the wave we discussed supporting
@UiChild void addStuff(DocumentFragment child)
<my:Widget> <my:stuff>Hi, this is <i>arbitrary HTML</i></my:stuff> </my:Widget>
That would require introducing
com.google.gwt.dom.client.DocumentFragment
(trivial, basically copy / paste of com.google.gwt.dom.client.Text),
and some
tweaks to the parsing mechanism. The parsing bit would be tricky,
requiring
changes to
com.google.gwt.uibinder.rebind.UiBinderWriter.parseElementToField(XMLElement)
that I'm not quite sure of yet. Maybe as simple as passing it an
explicit parser
rather than letting it magically pick its own?
Wow it might be that's its Friday and late but I think you totally lost me. What do you mean by explicitly declaring a div? Even with a widget you need: <my:mychild> <my:Label> </my:Label> </my:mychild> as for DocumentGragment, that seems reasonable somehow but I'm not sure what you mean by special parsing. Perhaps that is enough for a second change sometime? http://gwt-code-reviews.appspot.com/794801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors