com.gwtext.client.widgets.menu
Class Menu

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.gwtext.client.widgets.menu.Menu
All Implemented Interfaces:
com.google.gwt.user.client.EventListener
Direct Known Subclasses:
ColorMenu, DateMenu

public class Menu
extends com.google.gwt.user.client.ui.Widget

A menu object. This is the container to which you add all other menu items.


Field Summary
protected  com.google.gwt.core.client.JavaScriptObject config
           
protected  java.lang.String id
           
protected  com.google.gwt.core.client.JavaScriptObject jsObj
           
 
Constructor Summary
Menu()
           
Menu(com.google.gwt.core.client.JavaScriptObject jsObj)
           
 
Method Summary
 void addElement(com.google.gwt.user.client.Element element)
          Adds an Element object to the menu.
 void addElement(java.lang.String elemID)
          Adds an Ext.Element object to the menu.
 void addItem(BaseItem item)
          Adds an Item to the menu.
 void addListener(MenuListener listener)
          Add a menu listener.
 void addSeparator()
          Adds a separator bar to the menu.
 void addText(java.lang.String text)
          Creates a new TextItem with the supplied text and adds it to the menu.
protected  com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject menuConfig)
           
protected  com.google.gwt.core.client.JavaScriptObject create(java.lang.String id, com.google.gwt.core.client.JavaScriptObject config)
           
protected static com.google.gwt.core.client.JavaScriptObject getComponent(java.lang.String id)
           
 com.google.gwt.user.client.Element getElement()
           
protected  com.google.gwt.user.client.Element getElement(com.google.gwt.core.client.JavaScriptObject jsObj)
           
 BaseItem getItem(java.lang.String itemId)
          Gets an Item.
 BaseItem[] getItems()
          Gets all of this menu's items
 com.google.gwt.core.client.JavaScriptObject getOrCreateJsObj()
           
 void hide()
          Hides this menu.
 void hide(boolean deep)
          Hides this menu and optionally all parent menus.
 void insert(int index, BaseItem item)
          Inserts an eItem to the menu at a specified index.
 boolean isVisible()
          Returns true if the menu is currently displayed, else false.
 void remove(BaseItem item)
          Removes an Item from the menu and destroys the object.
 void removeAll()
          Removes and destroys all items in the menu
 void setAllowOtherMenus(boolean allowOtherMenus)
          True to allow multiple menus to be displayed at the same time (defaults to false).
 void setDefaultAlign(java.lang.String anchorPosition)
          The default BaseElement.alignTo(java.lang.String, java.lang.String) anchor position value for this menu relative to its element of origin (defaults to "tl-bl").
protected  void setElement(com.google.gwt.user.client.Element elem)
           
 void setId(java.lang.String id)
           
 void setMinWidth(int minWidth)
          The minimum width of the menu in pixels (defaults to 120).
 void setShadow(boolean shadow)
          True for the default effect.
 void setShadow(java.lang.String shadow)
          "sides" for the default effect, "frame" for 4-way shadow, and "drop" for bottom-right shadow (defaults to "sides")
 void setSubMenuAlign(java.lang.String anchorPosition)
          The Ext.Element.alignTo anchor position value to use for submenus of this menu (defaults to "tl-tr?").
 void show(java.lang.String id)
          Displays this menu relative to another element.
 void showAt(int[] xy)
          Displays this menu at a specific xy position.
 void showAt(int x, int y)
          Displays this menu at a specific xy position.
 void showAt(int x, int y, Menu parentMenu)
          Displays this menu at a specific xy position.
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
doAttachChildren, doDetachChildren, getParent, isAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, removeStyleName, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected java.lang.String id

config

protected com.google.gwt.core.client.JavaScriptObject config

jsObj

protected com.google.gwt.core.client.JavaScriptObject jsObj
Constructor Detail

Menu

public Menu()

Menu

public Menu(com.google.gwt.core.client.JavaScriptObject jsObj)
Method Detail

setId

public void setId(java.lang.String id)

setElement

protected void setElement(com.google.gwt.user.client.Element elem)
Overrides:
setElement in class com.google.gwt.user.client.ui.Widget

getElement

protected com.google.gwt.user.client.Element getElement(com.google.gwt.core.client.JavaScriptObject jsObj)

getElement

public com.google.gwt.user.client.Element getElement()
Overrides:
getElement in class com.google.gwt.user.client.ui.UIObject

getOrCreateJsObj

public com.google.gwt.core.client.JavaScriptObject getOrCreateJsObj()

getComponent

protected static com.google.gwt.core.client.JavaScriptObject getComponent(java.lang.String id)

create

protected com.google.gwt.core.client.JavaScriptObject create(java.lang.String id,
                                                             com.google.gwt.core.client.JavaScriptObject config)

create

protected com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject menuConfig)

addElement

public void addElement(com.google.gwt.user.client.Element element)
Adds an Element object to the menu.

Parameters:
element - the element to add

addElement

public void addElement(java.lang.String elemID)
Adds an Ext.Element object to the menu.

Parameters:
elemID - the element ID

addItem

public void addItem(BaseItem item)
Adds an Item to the menu.

Parameters:
item - the item to add

addSeparator

public void addSeparator()
Adds a separator bar to the menu.


addText

public void addText(java.lang.String text)
Creates a new TextItem with the supplied text and adds it to the menu.

Parameters:
text - the text to add

getItem

public BaseItem getItem(java.lang.String itemId)
Gets an Item.

Parameters:
itemId - the item Id
Returns:
the item

getItems

public BaseItem[] getItems()
Gets all of this menu's items

Returns:
the items

hide

public void hide()
Hides this menu.


hide

public void hide(boolean deep)
Hides this menu and optionally all parent menus.

Parameters:
deep - true to hide all parent menus recursively, if any (defaults to false)

insert

public void insert(int index,
                   BaseItem item)
Inserts an eItem to the menu at a specified index.

Parameters:
index - the index to insert
item - the item to insert

isVisible

public boolean isVisible()
Returns true if the menu is currently displayed, else false.

Overrides:
isVisible in class com.google.gwt.user.client.ui.UIObject
Returns:
true if visible

remove

public void remove(BaseItem item)
Removes an Item from the menu and destroys the object.

Parameters:
item - the item to remove

removeAll

public void removeAll()
Removes and destroys all items in the menu


show

public void show(java.lang.String id)
Displays this menu relative to another element.

Parameters:
id - the element ID to align to

showAt

public void showAt(int x,
                   int y)
Displays this menu at a specific xy position.

Parameters:
x - the X position
y - the Y position

showAt

public void showAt(int[] xy)
Displays this menu at a specific xy position.

Parameters:
xy - the xy position

showAt

public void showAt(int x,
                   int y,
                   Menu parentMenu)
Displays this menu at a specific xy position.

Parameters:
x - the X position
y - the Y position
parentMenu - the menu's parent menu, if applicable

addListener

public void addListener(MenuListener listener)
Add a menu listener.

Parameters:
listener - the listener

setAllowOtherMenus

public void setAllowOtherMenus(boolean allowOtherMenus)
True to allow multiple menus to be displayed at the same time (defaults to false).

Parameters:
allowOtherMenus - true to allow multiple menus

setDefaultAlign

public void setDefaultAlign(java.lang.String anchorPosition)
The default BaseElement.alignTo(java.lang.String, java.lang.String) anchor position value for this menu relative to its element of origin (defaults to "tl-bl").

Parameters:
anchorPosition - defaults to t-b?

setMinWidth

public void setMinWidth(int minWidth)
The minimum width of the menu in pixels (defaults to 120).

Parameters:
minWidth - the min width

setShadow

public void setShadow(boolean shadow)
True for the default effect.

Parameters:
shadow - true for shadow

setShadow

public void setShadow(java.lang.String shadow)
"sides" for the default effect, "frame" for 4-way shadow, and "drop" for bottom-right shadow (defaults to "sides")

Parameters:
shadow - the shadow settings

setSubMenuAlign

public void setSubMenuAlign(java.lang.String anchorPosition)
The Ext.Element.alignTo anchor position value to use for submenus of this menu (defaults to "tl-tr?").

Parameters:
anchorPosition - the anchor position