Zimlet JavaScript API Reference - DwtMenu

Class DwtMenu


Extends DwtComposite.

Creates a menu object to menu items can be added. Menus can be created in various styles as follows:

  • DwtMenu.BAR_STYLE - Traditional menu bar
  • DwtMenu.POPUP_STYLE - Popup menu
  • DwtMenu.DROPDOWN_STYLE - Used when a menu is a drop down (e.g. parent is a button or another menu item)
  • DwtMenu.DROPDOWN_CENTERV_STYLE - like a dropdown, but position to the right, centered vertically on the parent
  • DwtMenu.COLOR_PICKER_STYLE - Menu is hosting a single color picker
  • DwtMenu.CALENDAR_PICKER_STYLE - Menu is hostng a single calendar
  • DwtMenu.GENERIC_WIDGET_STYLE - Menu is hosting a single "DwtInsertTableGrid"


Defined in: DwtMenu.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
DwtMenu(params)
Creates a menu.
Method Summary
Method Attributes Method Name and Description
 
Adds a popdown listener.
 
addPopupListener(listener)
Adds a popup listener.
 
Adds a selection listener.
 
checkItem(field, value, skipNotify)
Checks a menu item (the menu must be radio or checkbox style).
 
getItem(index)
Gets a menu item.
 
getItemById(key, id)
Gets the item by id.
 
Gets a count of the items.
 
Gets an array of items.
 
Checks if the menu is popped-up.
 
Removes a popdown listener.
 
Removes a popup listener.
 
Removes a selection listener.
 
scrollToItem(item, justMakeVisible)
Checks a menu item (the menu must be radio or checkbox style).
 
setSelectedItem(which, preventFocus)
Programmatically selects a menu item.
Methods borrowed from class DwtComposite:
addChild, cleanupSeparators, clear, dispose, getChild, getChildren, getNumChildren, getTabGroupMember, removeChild, removeChildren
Methods borrowed from class DwtControl:
addClassName, addControlListener, addDisposeListener, addListener, appendElement, blur, clearContent, clearHandler, condClassName, delClassName, focus, getBounds, getClassName, getContent, getCursor, getData, getDragBox, getDragSource, getDropTarget, getEnabled, getFocusElement, getH, getHtmlElement, getHTMLElId, getInsetBounds, getInsets, getLocation, getMargins, getOpacity, getOuterSize, getPosition, getScrollContainer, getScrollStyle, getSize, getTooltipBase, getToolTipContent, getVisibility, getVisible, getW, getX, getXW, getY, getYH, getZIndex, hasFocus, isAlertShown, isDisposed, isInitialized, isListenerRegistered, notifyListeners, preventContextMenu, preventSelection, removeAllListeners, removeControlListener, removeDisposeListener, removeListener, reparent, reparentHtmlElement, replaceElement, setBounds, setClassName, setContent, setCursor, setData, setDisplay, setDisplayState, setDragBox, setDragSource, setDropTarget, setEnabled, setEventPropagation, setFocusElement, setHandler, setHtmlElementId, setLocation, setOpacity, setPosition, setScrollStyle, setSize, setToolTipContent, setVisibility, setVisible, setZIndex, showAlert, zShow
Class Detail
DwtMenu(params)
Creates a menu.
Author: Ross Dargahi.
Parameters:
{hash} params
a hash of parameters
{DwtComposite} params.parent
the parent widget
{constant} params.style
the menu style
{string} params.className
the CSS class
{constant} params.posStyle
the positioning style (see DwtControl)
{constant} params.layout
layout to use: DwtMenu.LAYOUT_STACK, DwtMenu.LAYOUT_CASCADE or DwtMenu.LAYOUT_SCROLL. A value of [true] defaults to DwtMenu.LAYOUT_CASCADE and a value of [false] defaults to DwtMenu.LAYOUT_STACK.
{int} params.maxRows=0
if >0 and layout = LAYOUT_CASCADE or DwtMenu.LAYOUT_SCROLL, define how many rows are allowed before cascading/scrolling
{boolean} params.congruent
if the parent is a DwtMenuItem, align so that the submenu "merges" with the parent menu
Method Detail
addPopdownListener(listener)
Adds a popdown listener.
Parameters:
{AjxListener} listener
the listener

addPopupListener(listener)
Adds a popup listener.
Parameters:
{AjxListener} listener
the listener

addSelectionListener(listener)
Adds a selection listener.
Parameters:
{AjxListener} listener
The listener.

checkItem(field, value, skipNotify)
Checks a menu item (the menu must be radio or checkbox style). The menu item is identified through the given field/value pair.
Parameters:
{Object} field
a key for menu item data
{Object} value
value for the data of the menu item to check
skipNotify

{DwtMenuItem} getItem(index)
Gets a menu item.
Parameters:
{string} index
the index
Returns:
{DwtMenuItem} the menu item

{DwtMenuItem} getItemById(key, id)
Gets the item by id.
Parameters:
{string} key
the id key
{Object} id
the id value
Returns:
{DwtMenuItem} the menu item

{number} getItemCount()
Gets a count of the items.
Returns:
{number} the count

{array} getItems()
Gets an array of items.
Returns:
{array} an array of DwtMenuItem objects

{boolean} isPoppedUp()
Checks if the menu is popped-up.
Returns:
{boolean} true if popped-up

removePopdownListener(listener)
Removes a popdown listener.
Parameters:
{AjxListener} listener
the listener

removePopupListener(listener)
Removes a popup listener.
Parameters:
{AjxListener} listener
the listener

removeSelectionListener(listener)
Removes a selection listener.
Parameters:
{AjxListener} listener
The listener.

scrollToItem(item, justMakeVisible)
Checks a menu item (the menu must be radio or checkbox style). The menu item is identified through the given field/value pair.
Parameters:
{DwtMenuItem} item
the menu item to scroll to
{boolean} justMakeVisible
false: scroll so the item is in the topmost row; true: scroll so the item is visible (scrolling down to an item puts it in the bottom row, doesn't scroll if the item is already visible)

setSelectedItem(which, preventFocus)
Programmatically selects a menu item. The item can be specified with an index, or as the next or previous item based on which item is currently selected. If the new item is a separator or is disabled, it won't be selected. Instead, the next suitable item will be used.
Parameters:
{boolean|number} which
if true, selects the next menu item if false, selects the previous menu item if DwtMenuItem, select that menu item if int, selects the menu item with that index
preventFocus

Documentation generated by JsDoc Toolkit 2.3.0 on Tue Jun 28 2016 21:01:28 GMT-0400 (EDT)