Class Index | File Index

Classes


Class zwt.ui.menu.Menu


Extends zwt.ui.Widget.

An implementation of a Menu. You can cascade menus by setting sub menus inside zwt.ui.menu.MenuItem objects added to the menu.

CSS rules

.zwt_menu {}
.zwt_menu-horizontal {}
.zwt_menu-vertical {}

Defined in: Menu.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
zwt.ui.menu.Menu(int_orientation, boolean_autoOpen)
Construct a menu.
Field Summary
Field Attributes Field Name and Description
<static>  
zwt.ui.menu.Menu.BOTTOM
Indicate a Bottom menu
<static>  
zwt.ui.menu.Menu.LEFT
Indicate a Left menu
<static>  
zwt.ui.menu.Menu.RIGHT
Indicate a Right menu
<static>  
zwt.ui.menu.Menu.TOP
Indicate a Top menu
Method Summary
Method Attributes Method Name and Description
 
addItem(zwt_ui_menu_MenuItem_item)
Add an item to the menu.
 
Close the menu.
 
draw()
This implementation sets the intrinsic width of the menu in case the context fill is zwt.ui.Widget.FILL_NONE.
 
getItem(int_index)
Return the Menu item at the specified index.
 
Return the size of the menu.
 
indexOf(zwt_ui_Widget_widget)
Return the index of the specified item in the menu.
 
insertItem(zwt_ui_menu_MenuItem_item, int_index)
Insert a menu item to the menu at the specified index.
 
Determine whether the menu is an auto open menu.
 
open()
Open the menu.
 
processContentEvent(zwt_ui_container_ContentEvent_event)
Process the specified content event.
 
processFocusEvent(zwt_event_FocusEvent_event)
Process the specified focus event.
 
This implementation makes sure a menu whose parent is an instance of zwt.ui.menu.MenuItem is not redrawn.
 
removeItem(zwt_ui_menu_MenuItem_item)
Remove the specified item from the menu.
 
removeItemAt(int_index)
Remove the menu item at the specified index from the menu.
 
setAutoOpen(boolean_autoOpen)
Set this menu as auto-open.
Methods borrowed from class zwt.ui.Widget:
addStyle, getContextFill, getDimension, getElement, getElementDimension, getFill, getFocusEventManager, getId, getKeyboardEventManager, getParent, getRelativeLeft, getRelativeTop, getStyle, getWheelEventManager, hasFocus, hasStyle, isFocusable, isVisible, onEvent, processEvent, processKeyboardEvent, processWheelEvent, removeStyle, replaceStyle, setFill, setFocusable, setId, setStyle, setVisible
Class Detail
zwt.ui.menu.Menu(int_orientation, boolean_autoOpen)
Construct a menu.
Author: Jeremy KUHN.
Parameters:
{Integer} int_orientation
Specifies the orientation of the menu. One of TOP, RIGHT, BOTTOM or LEFT.
{Integer} boolean_autoOpen
Specified that the menu should open on mouse over. This value is set to false by default.
See:
zwt.ui.menu.MenuItem
Field Detail
<static> {Integer} zwt.ui.menu.Menu.BOTTOM
Indicate a Bottom menu

<static> {Integer} zwt.ui.menu.Menu.LEFT
Indicate a Left menu

<static> {Integer} zwt.ui.menu.Menu.RIGHT
Indicate a Right menu

<static> {Integer} zwt.ui.menu.Menu.TOP
Indicate a Top menu
Method Detail
addItem(zwt_ui_menu_MenuItem_item)
Add an item to the menu.
Parameters:
{zwt.ui.menu.MenuItem} zwt_ui_menu_MenuItem_item
The menu item to add

close()
Close the menu.

draw()
This implementation sets the intrinsic width of the menu in case the context fill is zwt.ui.Widget.FILL_NONE.

{zwt.ui.menu.MenuItem} getItem(int_index)
Return the Menu item at the specified index.
Parameters:
{Integer} int_index
The index of the item
Returns:
The menu item or null

{Integer} getLength()
Return the size of the menu.
Returns:
The size of the menu

{Integer} indexOf(zwt_ui_Widget_widget)
Return the index of the specified item in the menu.
Parameters:
{zwt.ui.menu.MenuItem} zwt_ui_Widget_widget
A Widget
Returns:
The index of the item in the menu or -1 if it is not present in the menu

insertItem(zwt_ui_menu_MenuItem_item, int_index)
Insert a menu item to the menu at the specified index.
Parameters:
{zwt.ui.menu.MenuItem} zwt_ui_menu_MenuItem_item
The menu item to insert
{Integer} int_index
The position where to insert the item

{Boolean} isAutoOpen()
Determine whether the menu is an auto open menu.
Returns:
true if the menu is an auto open menu

open()
Open the menu.

processContentEvent(zwt_ui_container_ContentEvent_event)
Process the specified content event. This method will simply flag this widget to indicate that its content has changed and needs to be redrawn.

This implementation only propagates the event if the menu is the root menu.

Parameters:
{zwt.ui.container.ContentEvent} zwt_ui_container_ContentEvent_event
The content event to process

processFocusEvent(zwt_event_FocusEvent_event)
Process the specified focus event.
Parameters:
{zwt.event.FocusEvent} zwt_event_FocusEvent_event
The focus event to process

redraw()
This implementation makes sure a menu whose parent is an instance of zwt.ui.menu.MenuItem is not redrawn.

removeItem(zwt_ui_menu_MenuItem_item)
Remove the specified item from the menu.
Parameters:
{zwt.ui.menu.MenuItem} zwt_ui_menu_MenuItem_item
The menu item to remove

removeItemAt(int_index)
Remove the menu item at the specified index from the menu.
Parameters:
{Integer} int_index
The index of the item to remove

setAutoOpen(boolean_autoOpen)
Set this menu as auto-open. You don't need to click on an item to open it which is the default behavior.
Parameters:
{Boolean} boolean_autoOpen
true to set the menu as auto open, false otherwise

Documentation generated by JsDoc Toolkit 2.4.0 on Thu Jan 12 2012 02:07:53 GMT+0100 (CET)