org.xwiki.gwt.user.client.ui
Class MenuBar

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.MenuBar
              extended by org.xwiki.gwt.user.client.ui.MenuBar
All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasCloseHandlers<com.google.gwt.user.client.ui.PopupPanel>, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasAnimation, com.google.gwt.user.client.ui.PopupListener

public class MenuBar
extends com.google.gwt.user.client.ui.MenuBar

Improves the default menu bar widget provided by GWT.

Version:
$Id: MenuBar.java 24888 2009-11-06 02:16:19Z sdumitriu $

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.MenuBar
com.google.gwt.user.client.ui.MenuBar.MenuBarImages, com.google.gwt.user.client.ui.MenuBar.Resources
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
MenuBar()
          Creates an empty horizontal menu bar.
MenuBar(boolean vertical)
          Creates an empty menu bar.
 
Method Summary
 void addAll(java.util.List<com.google.gwt.user.client.ui.UIObject> items)
          Adds all the MenuItems and MenuItemSeparators from the given list to this menu bar.
 MenuItem getItem(int index)
           
protected  boolean hasParentMenu()
          NOTE: This is a hack required because #parentMenu is private.
 void onBrowserEvent(com.google.gwt.user.client.Event event)
          
protected  void setItems(java.util.List<com.google.gwt.user.client.ui.MenuItem> items)
          Sets the list of menu items displayed by this menu bar.
NOTE: This is just a hack required to overcome the fact that the GWT menu bar steals the focus when hovered.
protected  MenuItem xFindItem(Element target)
          Finds the menu item containing the given element, which is the target of a DOM event.
NOTE: This is a hack required because #findItem(Element) is private.
protected  void xItemOver(MenuItem item, boolean focus)
          Called when a menu item is being hovered.
NOTE: This is a hack required because #itemOver(MenuItem, boolean) is package-protected.
 
Methods inherited from class com.google.gwt.user.client.ui.MenuBar
addCloseHandler, addItem, addItem, addItem, addItem, addItem, addSeparator, addSeparator, clearItems, focus, getAutoOpen, getItemIndex, getItems, getSelectedItem, getSeparatorIndex, insertItem, insertSeparator, insertSeparator, isAnimationEnabled, isFocusOnHoverEnabled, moveSelectionDown, moveSelectionUp, onDetach, onEnsureDebugId, onPopupClosed, removeItem, removeSeparator, selectItem, setAnimationEnabled, setAutoOpen, setFocusOnHoverEnabled
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addDomHandler, addHandler, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Constructor Detail

MenuBar

public MenuBar()
Creates an empty horizontal menu bar.


MenuBar

public MenuBar(boolean vertical)
Creates an empty menu bar.

Parameters:
vertical - true to orient the menu bar vertically
Method Detail

addAll

public void addAll(java.util.List<com.google.gwt.user.client.ui.UIObject> items)
Adds all the MenuItems and MenuItemSeparators from the given list to this menu bar.

Parameters:
items - the list of MenuItems and MenuItemSeparators to be added to this menu bar

getItem

public MenuItem getItem(int index)
Parameters:
index - the index of the menu item to return
Returns:
the menu item at the specified index

hasParentMenu

protected boolean hasParentMenu()
NOTE: This is a hack required because #parentMenu is private.

Returns:
true if this menu bar has a parent menu, false otherwise

xFindItem

protected MenuItem xFindItem(Element target)
Finds the menu item containing the given element, which is the target of a DOM event.
NOTE: This is a hack required because #findItem(Element) is private.

Parameters:
target - a DOM element, usually the target of an event
Returns:
the menu item containing the given element if found, null otherwise

xItemOver

protected void xItemOver(MenuItem item,
                         boolean focus)
Called when a menu item is being hovered.
NOTE: This is a hack required because #itemOver(MenuItem, boolean) is package-protected.

Parameters:
item - the menu item being hovered
focus - true to focus the specified menu item, false otherwise

setItems

protected void setItems(java.util.List<com.google.gwt.user.client.ui.MenuItem> items)
Sets the list of menu items displayed by this menu bar.
NOTE: This is just a hack required to overcome the fact that the GWT menu bar steals the focus when hovered.

Parameters:
items - the list of MenuItem objects to be placed on the menu bar
See Also:
onBrowserEvent(Event), http://code.google.com/p/google-web-toolkit/issues/detail?id=3884

onBrowserEvent

public void onBrowserEvent(com.google.gwt.user.client.Event event)

Specified by:
onBrowserEvent in interface com.google.gwt.user.client.EventListener
Overrides:
onBrowserEvent in class com.google.gwt.user.client.ui.MenuBar
See Also:
MenuBar.onBrowserEvent(Event)


Copyright © 2004-2011 XWiki. All Rights Reserved.