Hi everyone,

I've recently started digging into GWT 2.0 and the new UiBinder
component. There is one particular issue that I couldn't solve yet and
I didn't find anything on that in the Google Groups or anywhere
throughout the net.

How can I (correctly) declare a Tree widget using UiBinder? When you
do it in code, it looks similar to the sample provided in the
http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/user/client/ui/TreeItem.html
javadoc. If I want to declare my tree and its contents via UiBinder,
my approach was to do the following:

<g:Tree ui:field="myTree">
  <g:TreeItem text="Item 1">
    <g:Hyperlink text="Item 1.1" targetHistoryToken="Item11"/>
    <g:Hyperlink text="Item 1.2" targetHistoryToken="Item12"/>
  </g:TreeItem>

  [...]

</g:Tree>

If you run this, you'll see the following error:

13:30:30.652 [ERROR] [...] Found widget <g:Hyperlink
targetHistoryToken='Item11' text=Item 1.1'> in an HTML context

This seems to be a problem with how the TreeItem is constructed. If
you comment out any of the TreeItem's contents, you will get the
following error message when running the app:

13:32:29.127 [ERROR] [...] Line 18: The method add(Widget) in the type
Tree is not applicable for the arguments (TreeItem)

It appears that UiBinder does always call the add(Widget) method on
the Tree for nested items while it should call the addItem(TreeItem)
method for nested items of type TreeItem. I am wondering if there is
any way to workaround this or whether I'm following a completely wrong
approach to declare a Tree with contents in UiBinder.

I haven't experimented a lot with setting an addItem="..." attribute
on a <g:Tree> element yet, but it seems to me that this would also be
very unintuitive to do (while the same approach works great for CSS
styles, i.e. using addStyleName="..." instead of styleName="...").

Thanks in advance for any hints!

Cheers,
Mark

--

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