Class MenuItem
- All Implemented Interfaces:
- HasHandlers,- HasClickHandlers
- Direct Known Subclasses:
- MenuItemSeparator
Menu.  Each MenuItem can have a
 title, icon, shortcut\n keys, optional submenu and various other
 settings.  Alternatively, a
 MenuItem can contain an arbitrary widget via embeddedComponent.
  
  
 To create a Menu, create a series of MenuItems and call Menu.setItems().
  
  
  Alternatively, Menus support binding to a DataSource.
  
  As another option, here's a sample of a Menu in Component XML:
  
  <Menu>
     <items>
         <MenuItem title="item1" click="alert(1)"/>
         <MenuItem title="item2"/>
     </items>
  </Menu>
  - 
Field SummaryFields inherited from class com.smartgwt.client.core.RefDataClassidFields inherited from class com.smartgwt.client.core.DataClassfactoryCreated, factoryProperties
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionaddClickHandler(ClickHandler handler) Add a click handler.Whether a click on this specificmenuItemautomatically dismisses the menu.A MenuItem that has a submenu normally cannot be selected, instead clicking or hitting Enter while keyboard focus is on the item shows the submenu.If true, this item displays a standard checkmark image to the left of its title.The filename for this item's custom icon when the item is disabled.Arbitrary UI component that should appear in this MenuItem.String[]SeeListGridRecord.embeddedComponentPosition, except that when used in amenuItem, default behavior isEmbeddedPosition"expand".Affects the visual style and interactivity of the menu item.Criteria to be evaluated to determine whether this MenuItem should be disabled.If false, no submenus will be fetched for this MenuItem.DefaultMenu.itemHiddenPropertyfor menu items.getIcon()The filename for this item's custom icon.intThe height applied to this item's icon.intThe width applied to this item's icon.When set totrue, this menu item shows a horizontal separator instead of thetitletext.A string to display in the shortcut-key column for this item.static MenuItemgetOrCreateRef(JavaScriptObject jsObj) When used in anAdaptiveMenu, should this MenuItem show only it'siconwhen displayed inline?Deprecated.getTitle()The text displayed for the menu itemCriteria to be evaluated to determine whether this MenuItem should be visible.setAutoDismiss(Boolean autoDismiss) Whether a click on this specificmenuItemautomatically dismisses the menu.setCanSelectParent(Boolean canSelectParent) A MenuItem that has a submenu normally cannot be selected, instead clicking or hitting Enter while keyboard focus is on the item shows the submenu.setChecked(Boolean checked) If true, this item displays a standard checkmark image to the left of its title.voidsetCheckIfCondition(MenuItemIfFunction checkIf) Contains the condition that will check or uncheck the curent menuItem.setDisabledIcon(String disabledIcon) The filename for this item's custom icon when the item is disabled.voidContains the condition that will change the curent items' icon when met.voidContains the condition that will change the curent items' title when met.setEmbeddedComponent(Canvas embeddedComponent) Arbitrary UI component that should appear in this MenuItem.setEmbeddedComponentFields(String... embeddedComponentFields) setEmbeddedComponentPosition(EmbeddedPosition embeddedComponentPosition) SeeListGridRecord.embeddedComponentPosition, except that when used in amenuItem, default behavior isEmbeddedPosition"expand".setEnabled(Boolean enabled) Affects the visual style and interactivity of the menu item.voidsetEnableIfCondition(MenuItemIfFunction enableIf) Contains the condition that will enable or disable the curent menuItem.setEnableWhen(AdvancedCriteria enableWhen) Criteria to be evaluated to determine whether this MenuItem should be disabled.setFetchSubmenus(Boolean fetchSubmenus) If false, no submenus will be fetched for this MenuItem.DefaultMenu.itemHiddenPropertyfor menu items.The filename for this item's custom icon.setIconHeight(int iconHeight) The height applied to this item's icon.setIconWidth(int iconWidth) The width applied to this item's icon.setIsSeparator(Boolean isSeparator) When set totrue, this menu item shows a horizontal separator instead of thetitletext.voidsetKeys(KeyIdentifier... keys) Shortcut key(s) to fire the menu item action.setKeyTitle(String keyTitle) A string to display in the shortcut-key column for this item.setShowIconOnlyInline(Boolean showIconOnlyInline) When used in anAdaptiveMenu, should this MenuItem show only it'siconwhen displayed inline?setSubmenu(Menu submenu) A reference to another menu, to display as a submenu when the mouse cursor hovers over this menu item.The text displayed for the menu itemsetVisibleWhen(AdvancedCriteria visibleWhen) Criteria to be evaluated to determine whether this MenuItem should be visible.Methods inherited from class com.smartgwt.client.widgets.grid.ListGridRecordget_baseStyle, get_canEdit, get_canRemove, getBackgroundComponent, getCanAcceptDrop, getCanDrag, getCanExpand, getCanSelect, getCustomStyle, getDetailDS, getIncludeInSummary, getIsGridSummary, getIsGroupSummary, getLinkText, getShowRollOver, getSingleCellValue, set_baseStyle, set_canEdit, set_canRemove, setBackgroundComponent, setCanAcceptDrop, setCanDrag, setCanExpand, setCanSelect, setCustomStyle, setDetailDS, setIncludeInSummary, setIsGridSummary, setIsGroupSummary, setLinkText, setShowRollOver, setSingleCellValueMethods inherited from class com.smartgwt.client.data.RecordconvertToRecordArray, copyAttributes, copyAttributesInto, getAttributeAsRecordArray, getAttributeAsRecordList, getPaletteDefaults, isARecord, toMapMethods inherited from class com.smartgwt.client.core.RefDataClassgetRef, getRef, internalSetIDMethods inherited from class com.smartgwt.client.core.DataClassapplyFactoryProperties, doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubleArray, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, isFactoryCreated, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeAsJavaObject, setFactoryCreatedMethods inherited from class com.smartgwt.client.core.JsObjectequals, getJsObj, hashCode, isCreated, setJavaScriptObject, setJsObjMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.google.gwt.event.shared.HasHandlersfireEvent
- 
Constructor Details- 
MenuItempublic MenuItem()
- 
MenuItem
- 
MenuItem
- 
MenuItem
- 
MenuItem
 
- 
- 
Method Details- 
getOrCreateRef
- 
setAutoDismissWhether a click on this specificmenuItemautomatically dismisses the menu. SeeMenu.autoDismiss.- Parameters:
- autoDismiss- New autoDismiss value. Default value is null
- Returns:
- MenuIteminstance, for chaining setter calls
 
- 
getAutoDismissWhether a click on this specificmenuItemautomatically dismisses the menu. SeeMenu.autoDismiss.- Returns:
- Current autoDismiss value. Default value is null
 
- 
setCanSelectParentA MenuItem that has a submenu normally cannot be selected, instead clicking or hitting Enter while keyboard focus is on the item shows the submenu. Setting canSelectParent:true allows a menu item with a submenu to be selected directly.- Parameters:
- canSelectParent- New canSelectParent value. Default value is null
- Returns:
- MenuIteminstance, for chaining setter calls
 
- 
getCanSelectParentA MenuItem that has a submenu normally cannot be selected, instead clicking or hitting Enter while keyboard focus is on the item shows the submenu. Setting canSelectParent:true allows a menu item with a submenu to be selected directly.- Returns:
- Current canSelectParent value. Default value is null
 
- 
setCheckedIf true, this item displays a standard checkmark image to the left of its title. You can set the checkmark image URL by settingMenu.checkmarkImage.If you need to set this state dynamically, use checkIf()instead.- Parameters:
- checked- New checked value. Default value is null
- Returns:
- MenuIteminstance, for chaining setter calls
- See Also:
 
- 
getCheckedIf true, this item displays a standard checkmark image to the left of its title. You can set the checkmark image URL by settingMenu.checkmarkImage.If you need to set this state dynamically, use checkIf()instead.- Returns:
- Current checked value. Default value is null
- See Also:
 
- 
setDisabledIconThe filename for this item's custom icon when the item is disabled. If both this property andcheckedare both specified, only the icon specified by this property will be displayed. The path to the loaded skin directory and the skinImgDir are prepended to this filename to form the full URL.If you need to set this state dynamically, use dynamicIcon()instead.- Parameters:
- disabledIcon- New disabledIcon value. Default value is null
- Returns:
- MenuIteminstance, for chaining setter calls
- See Also:
 
- 
getDisabledIconThe filename for this item's custom icon when the item is disabled. If both this property andcheckedare both specified, only the icon specified by this property will be displayed. The path to the loaded skin directory and the skinImgDir are prepended to this filename to form the full URL.If you need to set this state dynamically, use dynamicIcon()instead.- Returns:
- Current disabledIcon value. Default value is null
- See Also:
 
- 
setEmbeddedComponentArbitrary UI component that should appear in this MenuItem. SeeListGridRecord.embeddedComponentfor an overview and options for controlling placement.When embeddedComponentis used in a MenuItem certain default behaviors apply:-  autoDismissdefaults to false and clicks on embeddedComponents are not bubbled to the menuItem - if an interaction with an embeddedComponent is expected to dismiss the menu, custom code should call menu.hideorhideAllMenusas appropriate, before proceeding
-  the default behavior for embeddedComponentPositionis "expand".
-  the
 component is placed over the title and key fields by default - use embeddedComponentFieldsto override
-  rollOver
 styling is disabled by default (as though ListGridRecord.showRollOverwere set to false)
 - Overrides:
- setEmbeddedComponentin class- ListGridRecord
- Parameters:
- embeddedComponent- New embeddedComponent value. Default value is null
- Returns:
- MenuIteminstance, for chaining setter calls
- See Also:
 
-  
- 
getEmbeddedComponentArbitrary UI component that should appear in this MenuItem. SeeListGridRecord.embeddedComponentfor an overview and options for controlling placement.When embeddedComponentis used in a MenuItem certain default behaviors apply:-  autoDismissdefaults to false and clicks on embeddedComponents are not bubbled to the menuItem - if an interaction with an embeddedComponent is expected to dismiss the menu, custom code should call menu.hideorhideAllMenusas appropriate, before proceeding
-  the default behavior for embeddedComponentPositionis "expand".
-  the
 component is placed over the title and key fields by default - use embeddedComponentFieldsto override
-  rollOver
 styling is disabled by default (as though ListGridRecord.showRollOverwere set to false)
 - Overrides:
- getEmbeddedComponentin class- ListGridRecord
- Returns:
- Current embeddedComponent value. Default value is null
- See Also:
 
-  
- 
setEmbeddedComponentFieldsSeeListGridRecord.embeddedComponentFields. Default for a MenuItem is to cover the title and key fields, leaving the icon and submenu fields visible.- Overrides:
- setEmbeddedComponentFieldsin class- ListGridRecord
- Parameters:
- embeddedComponentFields- New embeddedComponentFields value. Default value is null
- Returns:
- MenuIteminstance, for chaining setter calls
- See Also:
 
- 
getEmbeddedComponentFieldsSeeListGridRecord.embeddedComponentFields. Default for a MenuItem is to cover the title and key fields, leaving the icon and submenu fields visible.- Overrides:
- getEmbeddedComponentFieldsin class- ListGridRecord
- Returns:
- Current embeddedComponentFields value. Default value is null
- See Also:
 
- 
setEmbeddedComponentPositionSeeListGridRecord.embeddedComponentPosition, except that when used in amenuItem, default behavior isEmbeddedPosition"expand".- Overrides:
- setEmbeddedComponentPositionin class- ListGridRecord
- Parameters:
- embeddedComponentPosition- New embeddedComponentPosition value. Default value is null
- Returns:
- MenuIteminstance, for chaining setter calls
- See Also:
 
- 
getEmbeddedComponentPositionSeeListGridRecord.embeddedComponentPosition, except that when used in amenuItem, default behavior isEmbeddedPosition"expand".- Overrides:
- getEmbeddedComponentPositionin class- ListGridRecord
- Returns:
- Current embeddedComponentPosition value. Default value is null
- See Also:
 
- 
setEnabledAffects the visual style and interactivity of the menu item. If set tofalse, the menu item will not respond to mouse rollovers or clicks.If you need to set this state dynamically, use enableIf()instead.- Overrides:
- setEnabledin class- ListGridRecord
- Parameters:
- enabled- New enabled value. Default value is true
- Returns:
- MenuIteminstance, for chaining setter calls
- See Also:
 
- 
getEnabledAffects the visual style and interactivity of the menu item. If set tofalse, the menu item will not respond to mouse rollovers or clicks.If you need to set this state dynamically, use enableIf()instead.- Overrides:
- getEnabledin class- ListGridRecord
- Returns:
- Current enabled value. Default value is true
- See Also:
 
- 
setEnableWhenCriteria to be evaluated to determine whether this MenuItem should be disabled. Re-evaluated each time the menu is shown.A basic criteria uses textMatchStyle:"exact". When specified in Component XMLthis property allowsshorthand formatsfor defining criteria.- Parameters:
- enableWhen- New enableWhen value. Default value is null
- Returns:
- MenuIteminstance, for chaining setter calls
- See Also:
 
- 
getEnableWhenCriteria to be evaluated to determine whether this MenuItem should be disabled. Re-evaluated each time the menu is shown.A basic criteria uses textMatchStyle:"exact". When specified in Component XMLthis property allowsshorthand formatsfor defining criteria.- Returns:
- Current enableWhen value. Default value is null
- See Also:
 
- 
setHiddenDefaultMenu.itemHiddenPropertyfor menu items. If true, this item will be hidden wihin the menu by default.To update item visibility at runtime, call Menu.setItemHidden()- Parameters:
- hidden- New hidden value. Default value is null
- Returns:
- MenuIteminstance, for chaining setter calls
- See Also:
 
- 
getHiddenDefaultMenu.itemHiddenPropertyfor menu items. If true, this item will be hidden wihin the menu by default.To update item visibility at runtime, call Menu.setItemHidden()- Returns:
- Current hidden value. Default value is null
- See Also:
 
- 
setIconThe filename for this item's custom icon. If both this property andcheckedare both specified, only the icon specified by this property will be displayed. The path to the loaded skin directory and the skinImgDir are prepended to this filename to form the full URL. If this item is disabled, anddisabledIconis set, then that icon will be used instead.If you need to set this state dynamically, use dynamicIcon()instead.- Parameters:
- icon- New icon value. Default value is null
- Returns:
- MenuIteminstance, for chaining setter calls
- See Also:
 
- 
getIconThe filename for this item's custom icon. If both this property andcheckedare both specified, only the icon specified by this property will be displayed. The path to the loaded skin directory and the skinImgDir are prepended to this filename to form the full URL. If this item is disabled, anddisabledIconis set, then that icon will be used instead.If you need to set this state dynamically, use dynamicIcon()instead.- Returns:
- Current icon value. Default value is null
- See Also:
 
- 
setIconHeightThe height applied to this item's icon. The default of16can be changed for all MenuItems by overridingMenu.iconHeight.- Parameters:
- iconHeight- New iconHeight value. Default value is 16
- Returns:
- MenuIteminstance, for chaining setter calls
 
- 
getIconHeightpublic int getIconHeight()The height applied to this item's icon. The default of16can be changed for all MenuItems by overridingMenu.iconHeight.- Returns:
- Current iconHeight value. Default value is 16
 
- 
setIconWidthThe width applied to this item's icon. The default of16can be changed for all MenuItems by overridingMenu.iconWidth.- Parameters:
- iconWidth- New iconWidth value. Default value is 16
- Returns:
- MenuIteminstance, for chaining setter calls
 
- 
getIconWidthpublic int getIconWidth()The width applied to this item's icon. The default of16can be changed for all MenuItems by overridingMenu.iconWidth.- Returns:
- Current iconWidth value. Default value is 16
 
- 
setIsSeparatorWhen set totrue, this menu item shows a horizontal separator instead of thetitletext. Typically specified as the only property of a menu item, since the separator will not respond to mouse events.- Overrides:
- setIsSeparatorin class- ListGridRecord
- Parameters:
- isSeparator- New isSeparator value. Default value is false
- Returns:
- MenuIteminstance, for chaining setter calls
- See Also:
 
- 
getIsSeparatorWhen set totrue, this menu item shows a horizontal separator instead of thetitletext. Typically specified as the only property of a menu item, since the separator will not respond to mouse events.- Overrides:
- getIsSeparatorin class- ListGridRecord
- Returns:
- Current isSeparator value. Default value is false
- See Also:
 
- 
setKeyTitleA string to display in the shortcut-key column for this item. If not specified, the first KeyName value inkeyswill be used by default.- Parameters:
- keyTitle- New keyTitle value. Default value is see below
- Returns:
- MenuIteminstance, for chaining setter calls
- See Also:
 
- 
getKeyTitleA string to display in the shortcut-key column for this item. If not specified, the first KeyName value inkeyswill be used by default.- Returns:
- Current keyTitle value. Default value is see below
- See Also:
 
- 
setShowIconOnlyInlineWhen used in anAdaptiveMenu, should this MenuItem show only it'siconwhen displayed inline?- Parameters:
- showIconOnlyInline- New showIconOnlyInline value. Default value is null
- Returns:
- MenuIteminstance, for chaining setter calls
 
- 
getShowIconOnlyInlineWhen used in anAdaptiveMenu, should this MenuItem show only it'siconwhen displayed inline?- Returns:
- Current showIconOnlyInline value. Default value is null
 
- 
setTitleThe text displayed for the menu item- Parameters:
- title- New title value. Default value is null
- Returns:
- MenuIteminstance, for chaining setter calls
- See Also:
 
- 
getTitleThe text displayed for the menu item- Returns:
- Current title value. Default value is null
- See Also:
 
- 
setVisibleWhenCriteria to be evaluated to determine whether this MenuItem should be visible. Re-evaluated each time the menu is shown.A basic criteria uses textMatchStyle:"exact". When specified in Component XMLthis property allowsshorthand formatsfor defining criteria.- Parameters:
- visibleWhen- New visibleWhen value. Default value is null
- Returns:
- MenuIteminstance, for chaining setter calls
- See Also:
 
- 
getVisibleWhenCriteria to be evaluated to determine whether this MenuItem should be visible. Re-evaluated each time the menu is shown.A basic criteria uses textMatchStyle:"exact". When specified in Component XMLthis property allowsshorthand formatsfor defining criteria.- Returns:
- Current visibleWhen value. Default value is null
- See Also:
 
- 
setKeysShortcut key(s) to fire the menu item action. Each key can be defined as aKeyIdentifier. To apply multiple shortcut keys to this item, set this property to an array of such key identifiers.- Parameters:
- keys- keys Default value is null
 
 
- 
com.smartgwt.client.widgets.Menu#getSubmenuinstead