org.cafesip.gwtcomp.client.ui
Class PopupMenu

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.Panel
              extended by com.google.gwt.user.client.ui.SimplePanel
                  extended by com.google.gwt.user.client.ui.PopupPanel
                      extended by org.cafesip.gwtcomp.client.ui.PopupMenu
All Implemented Interfaces:
HasCloseHandlers<PopupPanel>, HasHandlers, EventListener, EventPreview, HasAnimation, HasWidgets, SourcesPopupEvents, Iterable<Widget>

public class PopupMenu
extends PopupPanel

A popup menu that is used to popup and present a set of options to the users. The menu can be popped up or down programatically. Applications can add widgets as menu items. Therefore, many items can contain text lables, HTML segments, user input fields, etc. In addition, the applications can also add cascaded child menus.

CSS Style Rules:

Screen-Shots:

Author:
Amit Chatterjee

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.PopupPanel
PopupPanel.PositionCallback
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
PopupMenu()
          A constructor for this class.
 
Method Summary
 void addMenuItem(Widget widget)
          Add a child menu item.
 void addMenuItem(Widget widget, PopupMenu cascadedMenu)
          Adds a child menu item that is a cascaded menu.
 void addSeparator()
          Add a separator item.
static PopupMenu getRootMenu(PopupMenu menu)
          Gets the root menu for a given popup menu.
 void hideAll()
          Hides the popup menu.
 void removeMenuItem(int index)
          Removes a child menu at the given index.
 
Methods inherited from class com.google.gwt.user.client.ui.PopupPanel
addAutoHidePartner, addCloseHandler, addPopupListener, center, getContainerElement, getGlassElement, getGlassStyleName, getOffsetHeight, getOffsetWidth, getPopupLeft, getPopupTop, getStyleElement, getTitle, hide, hide, isAnimationEnabled, isAutoHideEnabled, isGlassEnabled, isModal, isPreviewingAllNativeEvents, isShowing, isVisible, onEventPreview, onKeyDownPreview, onKeyPressPreview, onKeyUpPreview, onPreviewNativeEvent, onUnload, removeAutoHidePartner, removePopupListener, setAnimationEnabled, setAutoHideEnabled, setGlassEnabled, setGlassStyleName, setHeight, setModal, setPopupPosition, setPopupPositionAndShow, setPreviewingAllNativeEvents, setTitle, setVisible, setWidget, setWidth, show, showRelativeTo
 
Methods inherited from class com.google.gwt.user.client.ui.SimplePanel
add, getWidget, iterator, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, onLoad, orphan
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addDomHandler, addHandler, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, 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

PopupMenu

public PopupMenu()
A constructor for this class.

Method Detail

addMenuItem

public void addMenuItem(Widget widget,
                        PopupMenu cascadedMenu)
Adds a child menu item that is a cascaded menu.

Parameters:
widget - normally a HTML or Label object is used to print the menu item name.
cascadedMenu - the popup menu that is popped up when the user mouses over the widget.

addMenuItem

public void addMenuItem(Widget widget)
Add a child menu item.

Parameters:
widget - normally a HTML segment or a text lable is passed but other input widgets can be passed as well.

removeMenuItem

public void removeMenuItem(int index)
Removes a child menu at the given index.

Parameters:
index - index

addSeparator

public void addSeparator()
Add a separator item.


hideAll

public void hideAll()
Hides the popup menu. In case the menu is a cascaded menu and has parents, the parents are hidden as well.


getRootMenu

public static PopupMenu getRootMenu(PopupMenu menu)
Gets the root menu for a given popup menu. Cascaded menus have parents and possibly grand-parents. This method iterates through the chain and returns the root popup menu.

Parameters:
menu - a given popup menu object
Returns:
the root popup menu


Copyright © 2010 Cafesip.org. All Rights Reserved.