1) MenuItemSeparator is a gwt class, so the style name should be gwt-MenuItemSeparator
You're right, I'll change this.
2)
To allow uses to subclass MenuItemSeparator, rather then having the
method addSeparator() which returns a separator, I'd rather have
addSeparator(MenuItemSeparator separator);
Agreed. Should we also have a no-arg addMenuItemSeparator() that uses the default separator? This is inline with the addMenuItem() methods that can take a MenuItem or construct one from a String.
3) It seems slightly cleaner to have only one list for items
and separators rather than two. We'd have to code a getFirstItem()
method if we combined the two lists. Would there be any other bad side
effects?
The biggest problem is that their is a protected method called "getItems()" that returns a List of MenuItems. If anyone overrides MenuBar, we would need to create a new list that does not include the MenuItemSeparators. The other problem is that when the user hovers an item, we would need a runtime class type check to verify that the hovered element belongs to a MenuItem, not a MenuItemSeparator. We would also need a lot of type casting, since the combined array is of the type "UIObject", not "MenuItem". The parallel arrays take a little extra space, but I think they save a lot of runtime checking.
4) Why do MenuItemSeparators need an internal div? Can we name the inner div something descriptive?
You need to put something in the MenuItemSeparator or the td will not show up on some browsers. If you put a "<br>" or " ", the cell will expand to fit its contents and cannot be set to 1px through CSS. Even using the "empty-cells" style attribute, setting the td height or width to 1px has different meanings in some browsers. It looks great in Firefox and Safari, but IE includes the 1px in the border, which I also set to create an illusion of a beveled edge. Using the div works consistantly across all browsers.
5) Can you abstract the default style names into private STYLENAME_DEFAULT fields?
Yes, I'll abstract it to a private field.
Let me know if you agree with my responses and I'll send you another patch.