com.smartgwt.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.smartgwt.client.widgets.BaseWidget
              extended by com.smartgwt.client.widgets.Canvas
                  extended by com.smartgwt.client.widgets.grid.ListGrid
                      extended by com.smartgwt.client.widgets.menu.Menu
All Implemented Interfaces:
HasHandlers, EventListener, DataBoundComponent, HasClickHandlers, HasDoubleClickHandlers, HasDragMoveHandlers, HasDragRepositionMoveHandlers, HasDragRepositionStartHandlers, HasDragRepositionStopHandlers, HasDragResizeMoveHandlers, HasDragResizeStartHandlers, HasDragResizeStopHandlers, HasDragStartHandlers, HasDragStopHandlers, HasDropHandlers, HasDropMoveHandlers, HasDropOutHandlers, HasDropOverHandlers, HasFocusChangedHandlers, HasHoverHandlers, HasHoverHiddenHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseStillDownHandlers, HasMouseUpHandlers, HasMouseWheelHandlers, HasResizedHandlers, HasRightMouseDownHandlers, HasScrolledHandlers, HasShowContextMenuHandlers, HasCellClickHandlers, HasCellContextClickHandlers, HasCellDoubleClickHandlers, HasCellHoverHandlers, HasCellMouseDownHandlers, HasCellMouseUpHandlers, HasCellOutHandlers, HasCellOverHandlers, HasCellSavedHandlers, HasDataArrivedHandlers, HasEditCompleteHandlers, HasEditFailedHandlers, HasEditorEnterHandlers, HasEditorExitHandlers, HasFieldStateChangedHandlers, HasHeaderClickHandlers, HasRecordClickHandlers, HasRecordDoubleClickHandlers, HasRecordDropHandlers, HasRowContextClickHandlers, HasRowEditorEnterHandlers, HasRowEditorExitHandlers, HasRowHoverHandlers, HasRowMouseDownHandlers, HasRowMouseUpHandlers, HasRowOutHandlers, HasRowOverHandlers, HasSelectionChangedHandlers, HasItemClickHandlers

public class Menu
extends ListGrid
implements HasItemClickHandlers

The Menu widget class implements interactive menu widgets, with optional icons, submenus, and shortcut keys.

A Menu is initialized with an Array of items, specified as menu.data, each of which represents one row in the menu's display and specifies the action to take when that menu item is selected.

Generally to create a context menu for a component, provide a Menu instance for the contextMenu property. Note that some components have special context menu support because they have distinct regions or because they have a default set of context menu actions available.

If you want a button that pops up a menu when clicked, or a bar of such buttons, see the MenuButton and MenuBar classes.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.smartgwt.client.widgets.BaseWidget
config, configOnly, id, isElementSet, scClassName
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
Menu()
           
Menu(JavaScriptObject jsObj)
           
 
Method Summary
 void addItem(MenuItem item)
           
 void addItem(MenuItem item, int index)
           
 HandlerRegistration addItemClickHandler(ItemClickHandler handler)
          Add a itemClick handler.
protected  JavaScriptObject create()
           
 Boolean getAutoDismiss()
          When true, when a menu item is chosen (via mouse click or keyboard), the menu is not automatically hidden, staying in place for further interactivity
 Boolean getAutoDraw()
          Menus will not draw on initialization, until they're explicitly show()n
 Boolean getCanSelectParentItems()
          If true, clicking or pressing Enter on a menu item that has a submenu will select that item (with standard behavior of hiding the menus, calling click handlers, etc) instead of showing the submenu.
 int getCellHeight()
          The height of each item in the menu, in pixels.
 int getDefaultWidth()
          The default menu width.
 String getEmptyMessage()
          Message to show when a menu is shown with no items.
 int getIconHeight()
          The default height applied to custom icons in this menu.
 int getIconWidth()
          The default width applied to custom icons in this menu.
 MenuItem getItem(int item)
          Get a particular MenuItem by index.
 int getItemNum(MenuItem item)
          Given a MenuItem, return it's index in the items array.
 MenuItem[] getItems()
          Return the menu items.
 Integer getMenuButtonWidth()
          For a menu that has a MenuButton generated for it automatically (for example when included in a MenuBar, the width that the MenuButton should have.
static Menu getOrCreateRef(JavaScriptObject jsObj)
           
 String getShowAnimationEffect()
          When this menu is shown how should it animate into view? By default the menu will just show at the specified size/position.
 Boolean getShowIcons()
          A boolean, indicating whether the checkmark/custom icon column should be displayed.
 Boolean getShowKeys()
          A boolean, indicating whether the shortcut key column should be displayed.
 Boolean getShowSubmenus()
          A boolean, indicating whether the submenu indicator column should be displayed.
 String getSubmenuDirection()
          Should submenus show up on our left or right.
 Canvas getTarget()
          Optional target canvas for this menu.
 Boolean getUseKeys()
          A boolean indicating whether this menu should use shortcut keys.
 void hideContextMenu()
          Hide the context menu - alias for hide()
protected  void onInit()
           
 void removeItem(MenuItem item)
           
 void setAutoDismiss(Boolean autoDismiss)
          When true, when a menu item is chosen (via mouse click or keyboard), the menu is not automatically hidden, staying in place for further interactivity
 void setAutoDraw(Boolean autoDraw)
          Menus will not draw on initialization, until they're explicitly show()n
 void setCanSelectParentItems(Boolean canSelectParentItems)
          If true, clicking or pressing Enter on a menu item that has a submenu will select that item (with standard behavior of hiding the menus, calling click handlers, etc) instead of showing the submenu.
 void setCellHeight(int cellHeight)
          The height of each item in the menu, in pixels.
 void setData(MenuItem... data)
          An array of menuItem objects, specifying the menu items this menu should show.
 void setData(Record[] data)
          An array of Record objects, specifying the data to be used to populate the DataBoundComponent.
 void setData(RecordList data)
          An List of Record objects, specifying the data to be used to populate the DataBoundComponent.
 void setDefaultWidth(int defaultWidth)
          The default menu width.
 void setEmptyMessage(String emptyMessage)
          Message to show when a menu is shown with no items.
 void setIconHeight(int iconHeight)
          The default height applied to custom icons in this menu.
 void setIconWidth(int iconWidth)
          The default width applied to custom icons in this menu.
 void setItemProperties(int item, MenuItem properties)
          Set arbitrary properties for a particular menu item.
 void setItems(MenuItem... items)
          Synonym for data Synonym for setData(com.smartgwt.client.widgets.menu.MenuItem...).
 void setMenuButtonWidth(Integer menuButtonWidth)
          For a menu that has a MenuButton generated for it automatically (for example when included in a MenuBar, the width that the MenuButton should have.
 void setShowAnimationEffect(String showAnimationEffect)
          When this menu is shown how should it animate into view? By default the menu will just show at the specified size/position.
 void setShowIcons(Boolean showIcons)
          A boolean, indicating whether the checkmark/custom icon column should be displayed.
 void setShowKeys(Boolean showKeys)
          A boolean, indicating whether the shortcut key column should be displayed.
 void setShowSubmenus(Boolean showSubmenus)
          A boolean, indicating whether the submenu indicator column should be displayed.
 void setSubmenuDirection(String submenuDirection)
          Should submenus show up on our left or right.
 void setTarget(Canvas target)
          Optional target canvas for this menu.
 void setTitle(String title)
          When used in a MenuBar, the title of the menu button create will be the title of the Menu.
 void setUseKeys(Boolean useKeys)
          A boolean indicating whether this menu should use shortcut keys.
 Boolean showContextMenu()
          Show this menu as a context menu, that is, immediately adjacent to the current mouse position.
 
Methods inherited from class com.smartgwt.client.widgets.grid.ListGrid
addCellClickHandler, addCellContextClickHandler, addCellDoubleClickHandler, addCellHoverHandler, addCellMouseDownHandler, addCellMouseUpHandler, addCellOutHandler, addCellOverHandler, addCellSavedHandler, addData, addData, addData, addDataArrivedHandler, addEditCompleteHandler, addEditFailedHandler, addEditorEnterHandler, addEditorExitHandler, addFieldStateChangedHandler, addFormulaField, addHeaderClickHandler, addRecordClickHandler, addRecordDoubleClickHandler, addRecordDropHandler, addRowContextClickHandler, addRowEditorEnterHandler, addRowEditorExitHandler, addRowHoverHandler, addRowMouseDownHandler, addRowMouseUpHandler, addRowOutHandler, addRowOverHandler, addSelectionChangedHandler, addSort, addSummaryField, anySelected, cancelEditing, canEditCell, canExpandRecord, cellHasChanges, cellHasErrors, cellHasErrors, clearCriteria, clearCriteria, clearEditValue, clearFieldError, clearFieldError, clearRowErrors, closeRecord, collapseRecord, deselectAllRecords, deselectRecord, deselectRecord, deselectRecords, deselectRecords, disableHilite, disableHiliting, discardAllEdits, discardAllEdits, discardEdits, discardEdits, enableHilite, enableHilite, enableHiliting, enableHiliting, endEditing, expandRecord, exportData, exportData, fetchData, fetchData, fetchData, fetchData, fetchRelatedData, fetchRelatedData, fieldIsVisible, filterByEditor, filterData, filterData, filterData, filterData, focusInFilterEditor, focusInFilterEditor, freezeField, freezeField, getAddDropValues, getAddFormulaFieldText, getAddOperation, getAddSummaryFieldText, getAllEditRows, getAllFields, getAlternateBodyStyleName, getAlternateRecordFrequency, getAlternateRecordStyles, getAlwaysShowEditors, getAnimateRemoveRecord, getAnimateRemoveSpeed, getAnimateRemoveTime, getArrowKeyAction, getAutoFetchAsFilter, getAutoFetchData, getAutoFetchDisplayMap, getAutoFetchTextMatchStyle, getAutoFitData, getAutoFitExtraRecords, getAutoFitMaxColumns, getAutoFitMaxHeight, getAutoFitMaxRecords, getAutoFitMaxWidth, getAutoSaveEdits, getBaseStyle, getBaseStyle, getBodyBackgroundColor, getBodyOverflow, getBodyStyleName, getBooleanFalseImage, getBooleanImageHeight, getBooleanImageWidth, getBooleanTrueImage, getCanAcceptDroppedRecords, getCanAddFormulaFields, getCanAddSummaryFields, getCancelEditingConfirmationMessage, getCanDragRecordsOut, getCanDragSelect, getCanDragSelectText, getCanEdit, getCanExpandRecordProperty, getCanExpandRecords, getCanFreezeFields, getCanGroupBy, getCanHover, getCanMultiSort, getCanRemoveRecords, getCanReorderFields, getCanReorderRecords, getCanResizeFields, getCanSelectAll, getCanSort, getCellCSSText, getCellErrors, getCellPadding, getCheckboxFieldFalseImage, getCheckboxFieldImageHeight, getCheckboxFieldImageWidth, getCheckboxFieldTrueImage, getChildExpansionMode, getClearAllSortingText, getClearFilterText, getClearSortFieldText, getConfirmCancelEditing, getConfirmDiscardEdits, getConfirmDiscardEditsMessage, getCriteria, getDataAsRecordList, getDataFetchMode, getDataPageSize, getDataSource, getDateFormatter, getDatetimeFormatter, getDefaultFields, getDetailField, getDiscardEditsSaveButtonTitle, getDragData, getDragDataAction, getDragTrackerMode, getDragTrackerStyle, getDragTrackerTitle, getDrawAheadRatio, getDrawAllMaxCells, getDrawnRows, getDropValues, getDuplicateDragMessage, getEditByCell, getEditCol, getEditedCell, getEditedCell, getEditedCell, getEditedCell, getEditedRecord, getEditEvent, getEditFailedBaseStyle, getEditFailedCSSText, getEditFormulaFieldText, getEditOnFocus, getEditPendingBaseStyle, getEditPendingCSSText, getEditRow, getEditSummaryFieldText, getEditValue, getEditValue, getEditValues, getEditValues, getEmptyCellValue, getEmptyMessageStyle, getEnforceVClipping, getEnterKeyEditAction, getEscapeKeyEditAction, getEventColumn, getEventColumn, getEventRow, getEventRow, getExpansionCanEdit, getExpansionComponent, getExpansionFieldFalseImage, getExpansionFieldImageHeight, getExpansionFieldImageWidth, getExpansionFieldTrueImage, getExpansionMode, getExportAll, getExportFields, getFetchDelay, getFetchOperation, getField, getField, getFieldName, getFieldName, getFieldNum, getFields, getFieldState, getFieldVisibilitySubmenuTitle, getFilterByCell, getFilterEditorCriteria, getFilterEditorHeight, getFilterOnKeypress, getFixedFieldWidths, getFixedRecordHeights, getFocusRow, getFormulaFieldValue, getFreezeFieldText, getFreezeOnLeftText, getFreezeOnRightText, getFrozenBaseStyle, getFrozenHeaderBaseStyle, getFrozenHeaderTitleStyle, getGenerateClickOnEnter, getGenerateClickOnSpace, getGenerateDoubleClickOnEnter, getGenerateDoubleClickOnSpace, getGridRenderer, getGridSummary, getGridSummaryRecordProperty, getGroupByMaxRecords, getGroupByText, getGroupIcon, getGroupIconSize, getGroupIndentSize, getGroupLeadingIndent, getGroupNodeStyle, getGroupSummaryRecordProperty, getGroupSummaryStyle, getGroupTree, getHeaderBackgroundColor, getHeaderBarStyle, getHeaderBaseStyle, getHeaderContextMenuItems, getHeaderHeight, getHeaderMenuButtonHeight, getHeaderMenuButtonIcon, getHeaderMenuButtonIconHeight, getHeaderMenuButtonIconWidth, getHeaderMenuButtonWidth, getHeaderSpanHeight, getHeaderTitleStyle, getHiliteProperty, getHoverStyle, getImageSize, getIncludeInSummaryProperty, getInitialCriteria, getInitialSort, getInvalidSummaryValue, getIsGrouped, getIsSeparatorProperty, getLeaveScrollbarGap, getLinkTextProperty, getListEndEditAction, getLoadingDataMessage, getLoadingDataMessageStyle, getLoadingMessage, getLongTextEditorThreshold, getLongTextEditorType, getMinFieldWidth, getModalEditing, getNeverValidate, getNullGroupTitle, getPreventDuplicates, getQuickDrawAheadRatio, getRecord, getRecordBaseStyleProperty, getRecordDetailDSProperty, getRecordEditProperty, getRecordEnabledProperty, getRecordIndex, getRecordIndex, getRecordList, getRecords, getRecordSummaryBaseStyle, getRelatedDataSource, getRemoveIcon, getRemoveOperation, getResizeFieldsInRealTime, getResultSet, getRowEndEditAction, getRowErrors, getSaveByCell, getSaveLocally, getScrollRedrawDelay, getSelectedRecord, getSelectedState, getSelection, getSelectionAppearance, getSelectionType, getSelectOnEdit, getShowAllRecords, getShowComplexFields, getShowDetailFields, getShowEmptyMessage, getShowFilterEditor, getShowGridSummary, getShowGroupSummary, getShowHeader, getShowHeaderContextMenu, getShowHeaderMenuButton, getShowHiddenFields, getShowHover, getShowRollOver, getShowSortArrow, getShowTreeColumnPicker, getShrinkForFreeze, getSingleCellValueProperty, getSkinImgDir, getSort, getSortAscendingImage, getSortDescendingImage, getSortDirection, getSortField, getSortFieldAscendingText, getSortFieldCount, getSortFieldDescendingText, getSortNumeralHTML, getSortNumeralStyle, getSortSpecifier, getSortState, getStopOnErrors, getStyleName, getSummaryFieldValue, getSummaryRowCriteria, getSummaryRowDataSource, getSummaryRowFetchRequestProperties, getSummaryRowHeight, getSummaryRowStyle, getTitleField, getTitleFieldValue, getToggleFreezeText, getTotalRows, getTrackerImage, getUnfreezeFieldText, getUngroupText, getUpdateOperation, getUseAllDataSourceFields, getUseFlatFields, getValidateByCell, getValidateOnChange, getValueIconHeight, getValueIconLeftPadding, getValueIconRightPadding, getValueIconSize, getValueIconWidth, getViewState, getVisibleRows, getWaitForSave, getWrapCells, groupBy, hasChanges, hasErrors, hideField, hideField, invalidateCache, isCheckboxField, isExpansionField, isGrouped, isSortField, markForRedraw, markForRedraw, openRecordDetailGrid, openRecordEditor, preloadImages, refreshCell, refreshCell, refreshCellStyle, refreshFields, refreshRow, removeData, removeData, removeData, removeSelectedData, removeSelectedData, reorderField, reorderFields, resizeField, rowClick, rowDoubleClick, rowHasChanges, rowHasErrors, saveAllEdits, saveAllEdits, saveAllEdits, scrollBodyTo, scrollToRow, selectAllRecords, selectRecord, selectRecord, selectRecord, selectRecord, selectRecords, selectRecords, selectRecords, selectRecords, selectSingleRecord, selectSingleRecord, setAddDropValues, setAddFormulaFieldText, setAddOperation, setAddSummaryFieldText, setAlternateBodyStyleName, setAlternateRecordFrequency, setAlternateRecordStyles, setAlwaysShowEditors, setAnimateRemoveRecord, setAnimateRemoveSpeed, setAnimateRemoveTime, setArrowKeyAction, setAutoFetchAsFilter, setAutoFetchData, setAutoFetchDisplayMap, setAutoFetchTextMatchStyle, setAutoFitData, setAutoFitExtraRecords, setAutoFitMaxColumns, setAutoFitMaxHeight, setAutoFitMaxRecords, setAutoFitMaxWidth, setAutoSaveEdits, setBaseStyle, setBodyBackgroundColor, setBodyOverflow, setBodyStyleName, setBooleanFalseImage, setBooleanImageHeight, setBooleanImageWidth, setBooleanTrueImage, setCanAcceptDroppedRecords, setCanAddFormulaFields, setCanAddSummaryFields, setCancelEditingConfirmationMessage, setCanDragRecordsOut, setCanDragSelect, setCanDragSelectText, setCanEdit, setCanExpandRecordProperty, setCanExpandRecords, setCanFreezeFields, setCanGroupBy, setCanHover, setCanMultiSort, setCanRemoveRecords, setCanReorderFields, setCanReorderRecords, setCanResizeFields, setCanSelectAll, setCanSort, setCellPadding, setCheckboxFieldFalseImage, setCheckboxFieldImageHeight, setCheckboxFieldImageWidth, setCheckboxFieldTrueImage, setChildExpansionMode, setClearAllSortingText, setClearFilterText, setClearSortFieldText, setConfirmCancelEditing, setConfirmDiscardEdits, setConfirmDiscardEditsMessage, setCriteria, setData, setDataFetchMode, setDataPageSize, setDataProperties, setDataSource, setDateFormatter, setDateInputFormat, setDatetimeFormatter, setDefaultFields, setDetailField, setDiscardEditsSaveButtonTitle, setDragDataAction, setDragTrackerMode, setDragTrackerStyle, setDrawAheadRatio, setDrawAllMaxCells, setDropValues, setDuplicateDragMessage, setEditByCell, setEditEvent, setEditFailedBaseStyle, setEditFailedCSSText, setEditFormulaFieldText, setEditOnFocus, setEditPendingCSSText, setEditSummaryFieldText, setEditValue, setEditValue, setEditValue, setEditValue, setEditValue, setEditValue, setEditValue, setEditValue, setEditValue, setEditValue, setEditValue, setEditValue, setEditValues, setEmptyCellValue, setEmptyMessageStyle, setEnforceVClipping, setEnterKeyEditAction, setEscapeKeyEditAction, setExpansionCanEdit, setExpansionFieldFalseImage, setExpansionFieldImageHeight, setExpansionFieldImageWidth, setExpansionFieldTrueImage, setExpansionMode, setExportAll, setExportFields, setFastCellUpdates, setFetchDelay, setFetchOperation, setFieldError, setFieldError, setFields, setFieldState, setFieldTitle, setFieldTitle, setFieldVisibilitySubmenuTitle, setFilterByCell, setFilterEditorCriteria, setFilterEditorHeight, setFilterOnKeypress, setFixedFieldWidths, setFixedRecordHeights, setFreezeFieldText, setFreezeOnLeftText, setFreezeOnRightText, setFrozenBaseStyle, setFrozenHeaderBaseStyle, setFrozenHeaderTitleStyle, setGenerateClickOnEnter, setGenerateClickOnSpace, setGenerateDoubleClickOnEnter, setGenerateDoubleClickOnSpace, setGridSummaryRecordProperty, setGroupByField, setGroupByMaxRecords, setGroupByText, setGroupIcon, setGroupIconSize, setGroupIndentSize, setGroupLeadingIndent, setGroupNodeStyle, setGroupStartOpen, setGroupStartOpen, setGroupSummaryRecordProperty, setGroupSummaryStyle, setHeaderBackgroundColor, setHeaderBarStyle, setHeaderBaseStyle, setHeaderHeight, setHeaderMenuButtonHeight, setHeaderMenuButtonIcon, setHeaderMenuButtonIconHeight, setHeaderMenuButtonIconWidth, setHeaderMenuButtonWidth, setHeaderSpanHeight, setHeaderSpans, setHeaderSpanTitle, setHeaderTitleStyle, setHiliteProperty, setHoverStyle, setImageSize, setIncludeInSummaryProperty, setInitialCriteria, setInitialSort, setInvalidSummaryValue, setIsSeparatorProperty, setLeaveScrollbarGap, setLinkTextProperty, setListEndEditAction, setLoadingDataMessage, setLoadingDataMessageStyle, setLoadingMessage, setLongTextEditorThreshold, setLongTextEditorType, setMinFieldWidth, setModalEditing, setNeverValidate, setNullGroupTitle, setPreventDuplicates, setQuickDrawAheadRatio, setRecordBaseStyleProperty, setRecordDetailDSProperty, setRecordEditProperty, setRecordEnabledProperty, setRecords, setRecordSummaryBaseStyle, setRemoveIcon, setRemoveOperation, setResizeFieldsInRealTime, setRowEndEditAction, setRowErrors, setSaveByCell, setSaveLocally, setScrollRedrawDelay, setSelectedState, setSelectionAppearance, setSelectionType, setSelectOnEdit, setShowAllRecords, setShowComplexFields, setShowDetailFields, setShowEmptyMessage, setShowFilterEditor, setShowGridSummary, setShowGroupSummary, setShowHeader, setShowHeaderContextMenu, setShowHeaderMenuButton, setShowHiddenFields, setShowHover, setShowRollOver, setShowSortArrow, setShowTreeColumnPicker, setShrinkForFreeze, setSingleCellValueProperty, setSkinImgDir, setSort, setSortAscendingImage, setSortDescendingImage, setSortDirection, setSortField, setSortField, setSortFieldAscendingText, setSortFieldDescendingText, setSortNumeralStyle, setSortState, setStopOnErrors, setStyleName, setSummaryRowCriteria, setSummaryRowDataSource, setSummaryRowFetchRequestProperties, setSummaryRowHeight, setSummaryRowStyle, setTitleField, setTrackerImage, setUnfreezeFieldText, setUngroupText, setUpdateOperation, setUseAllDataSourceFields, setUseFlatFields, setValidateByCell, setValidateOnChange, setValueIconHeight, setValueIconLeftPadding, setValueIconRightPadding, setValueIconSize, setValueIconWidth, setValueMap, setValueMap, setViewState, setWaitForSave, setWrapCells, showField, showField, sort, sort, sort, startEditing, startEditing, startEditingNew, startEditingNew, stopHover, toggleSort, transferSelectedData, transferSelectedData, unfreezeField, unfreezeField, ungroup, unsort, updateData, updateData, updateData, validateCell, validateCell, validateRow, willAcceptDrop, willFetchData, willFetchData
 
Methods inherited from class com.smartgwt.client.widgets.Canvas
addChild, addChild, addChild, addClickHandler, addDoubleClickHandler, addDragMoveHandler, addDragRepositionMoveHandler, addDragRepositionStartHandler, addDragRepositionStopHandler, addDragResizeMoveHandler, addDragResizeStartHandler, addDragResizeStopHandler, addDragStartHandler, addDragStopHandler, addDropHandler, addDropMoveHandler, addDropOutHandler, addDropOverHandler, addFocusChangedHandler, addHoverHandler, addHoverHiddenHandler, addKeyDownHandler, addKeyPressHandler, addMouseDownHandler, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseStillDownHandler, addMouseUpHandler, addMouseWheelHandler, addPeer, addPeer, addResizedHandler, addRightMouseDownHandler, addScrolledHandler, addShowContextMenuHandler, addStyleName, adjustForContent, animateFade, animateFade, animateFade, animateHide, animateHide, animateHide, animateMove, animateMove, animateMove, animateMove, animateRect, animateRect, animateRect, animateResize, animateResize, animateResize, animateScroll, animateScroll, animateScroll, animateShow, animateShow, animateShow, blur, bringToFront, clear, clickMaskUp, clickMaskUp, contains, contains, containsEvent, containsFocus, containsPoint, containsPoint, convertToCanvasArray, disable, enable, focus, getAbsoluteLeft, getAbsoluteTop, getAccessKey, getAnimateAcceleration, getAnimateFadeTime, getAnimateHideAcceleration, getAnimateHideTime, getAnimateMoveAcceleration, getAnimateMoveTime, getAnimateRectAcceleration, getAnimateRectTime, getAnimateResizeAcceleration, getAnimateResizeTime, getAnimateScrollAcceleration, getAnimateScrollTime, getAnimateShowAcceleration, getAnimateShowTime, getAnimateTime, getAppImgDir, getAutoShowParent, getBackgroundImage, getBackgroundPosition, getBackgroundRepeat, getBorder, getBottom, getById, getCanAcceptDrop, getCanDrag, getCanDragReposition, getCanDragResize, getCanDragScroll, getCanDrop, getCanDropBefore, getCanFocus, getCanSelectText, getChildren, getChildrenSnapResizeToGrid, getChildrenSnapToGrid, getContents, getContextMenu, getCursor, getDataPath, getDefaultHeight, getDestroyed, getDestroying, getDisabled, getDisabledCursor, getDoubleClickDelay, getDragAppearance, getDragIntersectStyle, getDragOpacity, getDragRepositionCursor, getDragScrollDelay, getDragStartDistance, getDragTarget, getDragType, getDynamicContents, getEdgeBackgroundColor, getEdgeCenterBackgroundColor, getEdgeImage, getEdgeOffset, getEdgeOpacity, getEdgeShowCenter, getEdgeSize, getExtraSpace, getFullDataPath, getGroupTitle, getHeight, getHeightAsString, getHoverAlign, getHoverDelay, getHoverHeight, getHoverHTML, getHoverMoveWithMouse, getHoverOpacity, getHoverVAlign, getHoverWidth, getHoverWrap, getHSnapOrigin, getHSnapOrigin, getHSnapPosition, getHSnapPosition, getHtmlPosition, getImgURL, getImgURL, getInnerContentHeight, getInnerContentWidth, getInnerHeight, getInnerWidth, getIsGroup, getLeft, getLeftAsString, getMargin, getMatchElement, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getMouseStillDownDelay, getMouseStillDownInitialDelay, getNextZIndex, getNoDoubleClicks, getOffsetHeight, getOffsetWidth, getOffsetX, getOffsetY, getOpacity, getOverflow, getPadding, getPageBottom, getPageLeft, getPageRect, getPageRight, getPageTop, getParentElement, getPercentBox, getPosition, getPrefix, getPrompt, getRect, getRedrawOnResize, getResizeBarTarget, getRight, getScrollbarSize, getScrollBottom, getScrollHeight, getScrollLeft, getScrollRight, getScrollTop, getScrollWidth, getShadowDepth, getShadowImage, getShadowOffset, getShadowSoftness, getShowCustomScrollbars, getShowDragShadow, getShowEdges, getShowResizeBar, getShowShadow, getSnapAxis, getSnapEdge, getSnapHDirection, getSnapHGap, getSnapOffsetLeft, getSnapOffsetTop, getSnapOnDrop, getSnapResizeToGrid, getSnapTo, getSnapToGrid, getSnapVDirection, getSnapVGap, getTabIndex, getTitle, getTooltip, getTop, getTopAsString, getValuesManager, getViewportHeight, getViewportWidth, getVisibility, getVisibleHeight, getVisibleWidth, getVSnapOrigin, getVSnapOrigin, getVSnapPosition, getVSnapPosition, getWidth, getWidthAsString, getZIndex, handleHover, hide, hideClickMask, hideClickMask, imgHTML, imgHTML, imgHTML, intersects, isDirty, isDisabled, isDrawn, isVisible, keyUp, layoutChildren, linkHTML, linkHTML, markForDestroy, moveAbove, moveBelow, moveBy, moveTo, parentResized, redraw, redraw, removeChild, removeChild, resizeBy, resizeTo, resizeTo, scrollBy, scrollByPercent, scrollTo, scrollTo, scrollToBottom, scrollToLeft, scrollToPercent, scrollToRight, scrollToTop, sendToBack, setAccessKey, setAlign, setAnimateAcceleration, setAnimateFadeTime, setAnimateHideAcceleration, setAnimateHideTime, setAnimateMoveAcceleration, setAnimateMoveTime, setAnimateRectAcceleration, setAnimateRectTime, setAnimateResizeAcceleration, setAnimateResizeTime, setAnimateScrollAcceleration, setAnimateScrollTime, setAnimateShowAcceleration, setAnimateShowTime, setAnimateTime, setAppImgDir, setAutoHeight, setAutoShowParent, setAutoWidth, setBackgroundColor, setBackgroundImage, setBackgroundPosition, setBackgroundRepeat, setBorder, setBottom, setCanAcceptDrop, setCanDrag, setCanDragReposition, setCanDragResize, setCanDragScroll, setCanDrop, setCanDropBefore, setCanFocus, setCanSelectText, setChildren, setChildrenSnapResizeToGrid, setChildrenSnapToGrid, setContents, setContextMenu, setCursor, setDataPath, setDefaultHeight, setDisabled, setDisabledCursor, setDoubleClickDelay, setDragAppearance, setDragIntersectStyle, setDragOpacity, setDragRepositionCursor, setDragScrollDelay, setDragStartDistance, setDragTarget, setDragType, setDropTypes, setDynamicContents, setEdgeBackgroundColor, setEdgeCenterBackgroundColor, setEdgeImage, setEdgeMarginSize, setEdgeOffset, setEdgeOpacity, setEdgeShowCenter, setEdgeSize, setExtraSpace, setGroupTitle, setHeight, setHeight, setHeight100, setHoverAlign, setHoverDelay, setHoverHeight, setHoverMoveWithMouse, setHoverOpacity, setHoverVAlign, setHoverWidth, setHoverWrap, setHtmlPosition, setImage, setImage, setIsGroup, setKeepInParentRect, setKeepInParentRect, setLayoutAlign, setLayoutAlign, setLeft, setLeft, setMargin, setMatchElement, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setMouseStillDownDelay, setMouseStillDownInitialDelay, setNoDoubleClicks, setOpacity, setOverflow, setPadding, setPageLeft, setPageTop, setParentElement, setPercentBox, setPosition, setPrefix, setPrompt, setRect, setRect, setRedrawOnResize, setResizeBarTarget, setResizeFrom, setRight, setScrollbarSize, setShadowDepth, setShadowImage, setShadowOffset, setShadowSoftness, setShowCustomScrollbars, setShowDragShadow, setShowEdges, setShowResizeBar, setShowShadow, setSmoothFade, setSnapAxis, setSnapEdge, setSnapHDirection, setSnapHGap, setSnapOffsetLeft, setSnapOffsetTop, setSnapOnDrop, setSnapResizeToGrid, setSnapTo, setSnapToGrid, setSnapVDirection, setSnapVGap, setTabIndex, setTooltip, setTop, setTop, setValuesManager, setVisibility, setVisible, setWidth, setWidth, setWidth100, setZIndex, shouldDragScroll, show, showClickMask, showNextTo, showNextTo, showPrintPreview, updateHover, updateHover, updateShadow, visibleAtPoint, visibleAtPoint
 
Methods inherited from class com.smartgwt.client.widgets.BaseWidget
addDrawHandler, destroy, doAddHandler, doInit, doOnRender, draw, equals, error, errorIfNotCreated, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsString, getAttributeAsStringArray, getConfig, getDOM, getElement, getElement, getHandlerCount, getID, getInnerHTML, getJsObj, getOrCreateJsObj, getRef, hashCode, isConfigOnly, isCreated, onDestroy, onDraw, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setConfig, setConfigOnly, setDragTracker, setElement, setHtmlElement, setID, setNullProperty, setPosition, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, toString
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addDomHandler, addHandler, delegateEvent, doAttachChildren, doDetachChildren, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, ensureDebugId, ensureDebugId, ensureDebugId, getStyleElement, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setPixelSize, setSize, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 
Methods inherited from interface com.smartgwt.client.widgets.DataBoundComponent
getOrCreateJsObj
 

Constructor Detail

Menu

public Menu()

Menu

public Menu(JavaScriptObject jsObj)
Method Detail

getOrCreateRef

public static Menu getOrCreateRef(JavaScriptObject jsObj)

create

protected JavaScriptObject create()
Overrides:
create in class ListGrid

setTarget

public void setTarget(Canvas target)
Optional target canvas for this menu. Available as a parameter to dynamic menuItem configuration methods such as MenuItem.checkIf(com.smartgwt.client.widgets.Canvas, com.smartgwt.client.widgets.menu.Menu, com.smartgwt.client.widgets.menu.MenuItem).

If this item has any 'submenus' the target will be propogated down to these child menus.

Parameters:
target - target Default value is null

getTarget

public Canvas getTarget()
Optional target canvas for this menu. Available as a parameter to dynamic menuItem configuration methods such as MenuItem.checkIf(com.smartgwt.client.widgets.Canvas, com.smartgwt.client.widgets.menu.Menu, com.smartgwt.client.widgets.menu.MenuItem).

If this item has any 'submenus' the target will be propogated down to these child menus.

Returns:
Canvas

setDefaultWidth

public void setDefaultWidth(int defaultWidth)
The default menu width.

Overrides:
setDefaultWidth in class Canvas
Parameters:
defaultWidth - defaultWidth Default value is 150

getDefaultWidth

public int getDefaultWidth()
The default menu width.

Overrides:
getDefaultWidth in class Canvas
Returns:
int

setCellHeight

public void setCellHeight(int cellHeight)
The height of each item in the menu, in pixels.

Overrides:
setCellHeight in class ListGrid
Parameters:
cellHeight - cellHeight Default value is 20

getCellHeight

public int getCellHeight()
The height of each item in the menu, in pixels.

Overrides:
getCellHeight in class ListGrid
Returns:
int

setAutoDraw

public void setAutoDraw(Boolean autoDraw)
Menus will not draw on initialization, until they're explicitly show()n

Note : This is an advanced setting

Parameters:
autoDraw - autoDraw Default value is false

getAutoDraw

public Boolean getAutoDraw()
Menus will not draw on initialization, until they're explicitly show()n

Returns:
Boolean

setUseKeys

public void setUseKeys(Boolean useKeys)
A boolean indicating whether this menu should use shortcut keys. Set useKeys to false in a menu's initialization block to explicitly disable shortcut keys.

Parameters:
useKeys - useKeys Default value is true

getUseKeys

public Boolean getUseKeys()
A boolean indicating whether this menu should use shortcut keys. Set useKeys to false in a menu's initialization block to explicitly disable shortcut keys.

Returns:
Boolean

setShowKeys

public void setShowKeys(Boolean showKeys)
A boolean, indicating whether the shortcut key column should be displayed. If showKeys is not set, the menu will show the key column only if one of its items specifies a keys property. If showKeys is false, the keys will not be displayed, but will still function.

Parameters:
showKeys - showKeys Default value is true

getShowKeys

public Boolean getShowKeys()
A boolean, indicating whether the shortcut key column should be displayed. If showKeys is not set, the menu will show the key column only if one of its items specifies a keys property. If showKeys is false, the keys will not be displayed, but will still function.

Returns:
Boolean

setShowIcons

public void setShowIcons(Boolean showIcons)
A boolean, indicating whether the checkmark/custom icon column should be displayed. If showIcons is not set, the menu will show the icon column only if one of its items specifies an icon, checked, checkIf, or dynamicIcon property.

Parameters:
showIcons - showIcons Default value is true

getShowIcons

public Boolean getShowIcons()
A boolean, indicating whether the checkmark/custom icon column should be displayed. If showIcons is not set, the menu will show the icon column only if one of its items specifies an icon, checked, checkIf, or dynamicIcon property.

Returns:
Boolean

setShowSubmenus

public void setShowSubmenus(Boolean showSubmenus)
A boolean, indicating whether the submenu indicator column should be displayed. If showSubmenus is not set, the menu will show the indicator column only if one of its items specifies a submenu property. If showSubmenus is false, the submenu arrows will not be displayed, but submenus will still appear on rollover.

Parameters:
showSubmenus - showSubmenus Default value is true

getShowSubmenus

public Boolean getShowSubmenus()
A boolean, indicating whether the submenu indicator column should be displayed. If showSubmenus is not set, the menu will show the indicator column only if one of its items specifies a submenu property. If showSubmenus is false, the submenu arrows will not be displayed, but submenus will still appear on rollover.

Returns:
Boolean

setSubmenuDirection

public void setSubmenuDirection(String submenuDirection)
Should submenus show up on our left or right. Can validly be set to "left" or "right"

Parameters:
submenuDirection - submenuDirection Default value is "right"

getSubmenuDirection

public String getSubmenuDirection()
Should submenus show up on our left or right. Can validly be set to "left" or "right"

Returns:
String

setEmptyMessage

public void setEmptyMessage(String emptyMessage)
Message to show when a menu is shown with no items.

Note : This is an advanced setting

Overrides:
setEmptyMessage in class ListGrid
Parameters:
emptyMessage - emptyMessage Default value is "[Empty menu]"

getEmptyMessage

public String getEmptyMessage()
Message to show when a menu is shown with no items.

Overrides:
getEmptyMessage in class ListGrid
Returns:
String

setIconWidth

public void setIconWidth(int iconWidth)
The default width applied to custom icons in this menu. This is used whenever item.iconWidth is not specified.

Parameters:
iconWidth - iconWidth Default value is 16

getIconWidth

public int getIconWidth()
The default width applied to custom icons in this menu. This is used whenever item.iconWidth is not specified.

Returns:
int

setIconHeight

public void setIconHeight(int iconHeight)
The default height applied to custom icons in this menu. This is used whenever item.iconHeight is not specified.

Parameters:
iconHeight - iconHeight Default value is 16

getIconHeight

public int getIconHeight()
The default height applied to custom icons in this menu. This is used whenever item.iconHeight is not specified.

Returns:
int

setShowAnimationEffect

public void setShowAnimationEffect(String showAnimationEffect)
When this menu is shown how should it animate into view? By default the menu will just show at the specified size/position. Options for animated show effects are "fade" to fade from transparent to visible, "slide" to slide the menu into view, or "wipe" to have the menu grow into view, revealing its content as it grows. Can be overridden by passing the 'animationEffect' parameter to 'menu.show()'

Note : This is an advanced setting

Parameters:
showAnimationEffect - showAnimationEffect Default value is null

getShowAnimationEffect

public String getShowAnimationEffect()
When this menu is shown how should it animate into view? By default the menu will just show at the specified size/position. Options for animated show effects are "fade" to fade from transparent to visible, "slide" to slide the menu into view, or "wipe" to have the menu grow into view, revealing its content as it grows. Can be overridden by passing the 'animationEffect' parameter to 'menu.show()'

Returns:
String

setCanSelectParentItems

public void setCanSelectParentItems(Boolean canSelectParentItems)
If true, clicking or pressing Enter on a menu item that has a submenu will select that item (with standard behavior of hiding the menus, calling click handlers, etc) instead of showing the submenu.

Parameters:
canSelectParentItems - canSelectParentItems Default value is null

getCanSelectParentItems

public Boolean getCanSelectParentItems()
If true, clicking or pressing Enter on a menu item that has a submenu will select that item (with standard behavior of hiding the menus, calling click handlers, etc) instead of showing the submenu.

Returns:
Boolean

setAutoDismiss

public void setAutoDismiss(Boolean autoDismiss)
When true, when a menu item is chosen (via mouse click or keyboard), the menu is not automatically hidden, staying in place for further interactivity

Parameters:
autoDismiss - autoDismiss Default value is true

getAutoDismiss

public Boolean getAutoDismiss()
When true, when a menu item is chosen (via mouse click or keyboard), the menu is not automatically hidden, staying in place for further interactivity

Returns:
Boolean

setMenuButtonWidth

public void setMenuButtonWidth(Integer menuButtonWidth)
                        throws IllegalStateException
For a menu that has a MenuButton generated for it automatically (for example when included in a MenuBar, the width that the MenuButton should have. If unset, the MenuButton will be as wide as menu.width.

Parameters:
menuButtonWidth - menuButtonWidth Default value is null
Throws:
IllegalStateException - this property cannot be changed after the component has been created

getMenuButtonWidth

public Integer getMenuButtonWidth()
For a menu that has a MenuButton generated for it automatically (for example when included in a MenuBar, the width that the MenuButton should have. If unset, the MenuButton will be as wide as menu.width.

Returns:
Integer

addItemClickHandler

public HandlerRegistration addItemClickHandler(ItemClickHandler handler)
Add a itemClick handler.

Executed when a menu item with no click handler is clicked by the user. This itemClick handler must be specified as a function. It is passed an item parameter that is a reference to the clicked menu item.

Specified by:
addItemClickHandler in interface HasItemClickHandlers
Parameters:
handler - the itemClick handler
Returns:
HandlerRegistration used to remove this handler

showContextMenu

public Boolean showContextMenu()
Show this menu as a context menu, that is, immediately adjacent to the current mouse position.

Returns:
false == stop processing this event

hideContextMenu

public void hideContextMenu()
Hide the context menu - alias for hide()

Overrides:
hideContextMenu in class Canvas

getItem

public MenuItem getItem(int item)
Get a particular MenuItem by index.

If passed a MenuItem, returns it.

Parameters:
item - index of the MenuItem
Returns:
the MenuItem, Pointer to the item, or null if not defined

onInit

protected void onInit()
Overrides:
onInit in class ListGrid

setData

public void setData(MenuItem... data)
An array of menuItem objects, specifying the menu items this menu should show.

Parameters:
data - menu items

setData

public void setData(Record[] data)
An array of Record objects, specifying the data to be used to populate the DataBoundComponent. Note that not all DataBoundComponents observe the changes to the data to redraw themselves. Refer to the version of setData that accepts component specific records.

Overrides:
setData in class ListGrid
Parameters:
data - array of Record objects.
See Also:
setData(MenuItem[])

setData

public void setData(RecordList data)
An List of Record objects, specifying the data to be used to populate the DataBoundComponent. Note that not all DataBoundComponents observe the changes to the data to redraw themselves. Refer to the version of setData that accepts component specific records.

Overrides:
setData in class ListGrid
Parameters:
data - List of Records

setItems

public void setItems(MenuItem... items)
Synonym for data Synonym for setData(com.smartgwt.client.widgets.menu.MenuItem...).

Parameters:
items - new items for this menu. Default value is null

getItems

public MenuItem[] getItems()
Return the menu items.

Returns:
the menu items

setTitle

public void setTitle(String title)
When used in a MenuBar, the title of the menu button create will be the title of the Menu.

Overrides:
setTitle in class Canvas
Parameters:
title - the title

removeItem

public void removeItem(MenuItem item)

addItem

public void addItem(MenuItem item)

addItem

public void addItem(MenuItem item,
                    int index)

getItemNum

public int getItemNum(MenuItem item)
Given a MenuItem, return it's index in the items array.

Parameters:
item - the MenuItem
Returns:
index of the item, or -1 if not defined.

setItemProperties

public void setItemProperties(int item,
                              MenuItem properties)
Set arbitrary properties for a particular menu item.

Parameters:
item - index of the MenuItem
properties - properties to apply to the item