I also face this problem. Probably uiBinder just does not support this. the alternative could be just using a ui:field on the tree and add the treeitem in the code.
On Dec 20 2009, 11:35 pm, evershore <[email protected]> wrote: > Hi everyone, > > I've recently started digging into GWT 2.0 and the newUiBinder > 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 aTreewidget usingUiBinder? When you > do it in code, it looks similar to the sample provided in > thehttp://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/g... > javadoc. If I want to declare mytreeand its contents viaUiBinder, > my approach was to do the following: > > <g:Treeui: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 typeTreeis > not applicable for the arguments (TreeItem) > > It appears thatUiBinderdoes always call the add(Widget) method on > theTreefor 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 aTreewith contents inUiBinder. > > 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.
