I don't have an editor in front of me, so here's a shot in the dark: try putting the nested MenuBar directly under the outer MenuBar instead of under a MenuItem.
On May 11, 1:48 am, chakresh <[email protected]> wrote: > Hi, > > I am trying to create menus using UiBinder. > > my ui.xml goes like > > <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> > <ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' > xmlns:g='urn:import:com.google.gwt.user.client.ui'> > > <g:MenuBar vertical='true' ui:field='mainMenu'> > <g:MenuItem ui:field='item1'>Item 1</g:MenuItem> > <g:MenuItem ui:field='item2'>Item 2</g:MenuItem> > <g:MenuItem ui:field='sub' enabled='false'> > Submenu > <g:MenuBar vertical='true' ui:field='subMenu' /> > </g:MenuItem> > </g:MenuBar> > </ui:UiBinder> > > and java file goes like > package com.cadence.ams.client.ui; > > import com.google.gwt.core.client.GWT; > import com.google.gwt.event.dom.client.ClickEvent; > import com.google.gwt.uibinder.client.UiBinder; > import com.google.gwt.uibinder.client.UiField; > import com.google.gwt.uibinder.client.UiHandler; > import com.google.gwt.user.client.Window; > import com.google.gwt.user.client.ui.Composite; > import com.google.gwt.user.client.ui.HasText; > import com.google.gwt.user.client.ui.Widget; > import com.google.gwt.user.client.ui.MenuBar; > import com.google.gwt.user.client.ui.MenuItem; > > public class testMenu extends Composite { > > private static testMenuUiBinder uiBinder = GWT > .create(testMenuUiBinder.class); > > interface testMenuUiBinder extends UiBinder<Widget, testMenu> { > } > > public testMenu() { > initWidget(uiBinder.createAndBindUi(this)); > } > > @UiField MenuBar mainMenu; > @UiField MenuItem item1; > @UiField MenuItem item2; > @UiField MenuBar subMenu; > @UiField MenuItem sub; > > @UiHandler("item1") > void onClick(ClickEvent e) { > Window.alert("item1!"); > } > > } > > And while compiling I am getting error. > [ERROR] The prefix "g" for element "g:MenuBar" is not bound. > [ERROR] Error parsing XML (line 1): The prefix "g" for element > "g:MenuBar" is not bound. > > I searched for internet and google group but could not get the > solution. > I am very new to GWT, in case of any stupid mistake also do let me > know. > > Help will be very much appreciated. > Thanks, > Chakresh -- 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.
