Joel -
Please do a code review on this enhancement.

Description:
=========
Currently, then MenuBar only supports appending an MenuItem to the end of
the MenuBar.  It would be nice to be able to insert MenuItems at any
location.  Same goes for MenuItemSeparators.


Fix:
===
I added the following methods to MenuBar:
getItemIndex(MenuItem)
getSeparatorIndex(MenuItemSeparator)
insertItem(MenuItem, int)
insertSeparator(int)
insertSeparator(MenuItemSeparator, int)

I added the getItemIndex() and getSeparator() methods so users can get the
index of an existing MenuItems and MenuItemSeparators.  I also added three
insert methods to insert MenuItems and MenuItemSeparators at a specific
index.

Currently, their are four addition addItem() convenience methods that take
various parameters to create and add a new MenuItem.  I didn't add these
convenience methods because they aren't really needed, and because they
pollute the API too much in my opinion.

Also, I slipped in a little fix for a MenuBar issue.  If you have a mixture
of MenuItems that contain submenus and some that don't, then when you
highlight a MenuItem that does not contain a submenu, the currently visible
submenu remains open under its parent.  Now, if autoOpen is enabled, that
existing submenu will automatically be closed if you mouse over another
MenuItem that does not contain a submenu.  If autoOpen is disabled, it
remains open (which looks better).


Testing:
======
Tested in various browsers and added a couple of unit tests to address
insertion of MenuItems and MenuItemSeparators.

-- 
Thanks,
John LaBanca
[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Attachment: MenuBar_InsertItem.patch
Description: Binary data

Reply via email to