We have recently attached a GWT MenuBar to a part of our application for, well, menu purposes.
Basically I want the sub menus to open when you mouse over the top level menu, which is easy enough to do:
menubar.setAutoOpen(true);
I would also like to have the sub menu automatically hide when the user's mouse leaves the sub menu. Ideally with some sort of delay to prevent it vanishing too abruptly, but I'd settle for just the hiding.
This doesn't seem to be built in and the MenuItem object in GWT directly subclasses UIObject which means there isn't a relatively trivial onBrowserEvent() or somewhere to attach mouse listeners. Possibly extending MenuItem and sinking/unsinking events would let me add this behavior, but I am unsure if that is the best approach.
So what would be the best approach to autohiding a GWT submenu?
Thank you.