I have a menu where you canβt click on the headings, but when you hover over a menu item, you can choose from the drop-down items. Each of the elements: g: Anchor tags with associated fields ui. I would expect that when the user clicks on one of the dropdowns, my uiHandler for this field will fire. Even with debugging and a breakpoint, it never hit.
Below you will find the main areas of concern in the code. I will publish only my import of gwt, as it can be assumed that the rest are correct due to zero errors.
Here is an XML snippet to get an idea of ββwhat's going on
<!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' xmlns:cpcw='urn:import:org.collegeboard.pa.gwt.client.widget'> <cpcw:ExtendedHTMLPanel> <ul> <li ui:field="juniorHigh"><g:Anchor href="">Junior High</g:Anchor> <ul> <li><g:Anchor href="#" ui:field="juniorHighFall">Fall</g:Anchor></li> <li><g:Anchor href="#" ui:field="juniorHighSpring">Spring</g:Anchor></li> <li><g:Anchor href="#" ui:field="juniorHighSummer">Summer</g:Anchor></li> </ul> </li> </ul> </cpcw:ExtendedHTMLPanel> </ui:UiBinder>
And here are the parts from my Java class
Import
import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.LIElement; 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.ui.Anchor;
Ui fields
@UiField protected LIElement juniorHigh; @UiField protected Anchor juniorHighFall; @UiField protected Anchor juniorHighSpring; @UiField protected Anchor juniorHighSummer;
Ui handler
@UiHandler({"juniorHighFall","juniorHighSpring","juniorHighSummer"}) public void handleMenuClick(ClickEvent event) { DisplayUtil.displayAlertMessage(event.toString()); }
Initialize
@Override public void initializeBinder() { initWidget(ourUiBinder.createAndBindUi(this)); }
Now UiHandler never hits the target. I had g: Anchor tags with and without href, and also tried them as g: Hyperlink and g: Button without success. It is as if UiHandler is not even there.
Any help would be greatly appreciated, and if you feel that you need anything else to troubleshoot, please let me know.
Thanks: -)
EDIT:
To make sure this was clear, the template ui.xml file containing this ui.xml file placed it in a div. When I replaced this with SimplePanel, everything worked with UiHandler.
Thanks for answers!