|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.smartgwt.client.core.JsObject
com.smartgwt.client.core.DataClass
com.smartgwt.client.core.RefDataClass
com.smartgwt.client.data.Record
com.smartgwt.client.widgets.grid.ListGridRecord
com.smartgwt.client.widgets.menu.MenuItem
public class MenuItem
Menu items are specified are object literals, not class instances. For example, when developing in JavaScript, a typical initialization block for a Menu would look like this:
Menu.create({
data: [
{title: "item1", click: "alert(1)"},
{title: "item2"}
]
});
And in XML:
<Menu>
<data>
<MenuItem title="item1" click="alert(1)"/>
<MenuItem title="item2"/>
</data>
</Menu>
| Field Summary |
|---|
| Fields inherited from class com.smartgwt.client.core.JsObject |
|---|
jsObj |
| Constructor Summary | |
|---|---|
MenuItem()
|
|
MenuItem(JavaScriptObject jsObj)
|
|
MenuItem(String title)
|
|
MenuItem(String title,
String icon)
|
|
MenuItem(String title,
String icon,
String keyTitle)
|
|
| Method Summary | |
|---|---|
HandlerRegistration |
addClickHandler(ClickHandler handler)
Add a click handler. |
Boolean |
getCanSelectParent()
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. |
Boolean |
getChecked()
If true, this item displays a standard checkmark image to the left of its title. |
Boolean |
getEnabled()
Affects the visual style and interactivity of the menu item. |
Boolean |
getFetchSubmenus()
If false, no submenus will be fetched for this MenuItem. |
String |
getIcon()
The base filename for this item's custom icon. |
int |
getIconHeight()
The height applied to this item's icon. |
int |
getIconWidth()
The width applied to this item's icon. |
Boolean |
getIsSeparator()
When set to true, this menu item shows a horizontal separator instead of the title text. |
String |
getKeyTitle()
A string to display in the shortcut-key column for this item. |
static MenuItem |
getOrCreateRef(JavaScriptObject jsObj)
|
Menu |
getSubmenu()
A reference to another menu, to display as a submenu when the mouse cursor hovers over this menu item. |
String |
getTitle()
The text displayed for the menu item |
void |
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. |
void |
setChecked(Boolean checked)
If true, this item displays a standard checkmark image to the left of its title. |
void |
setCheckIfCondition(MenuItemIfFunction checkIf)
Contains the condition that will check or uncheck the curent menuItem. |
void |
setDynamicIconFunction(MenuItemStringFunction handler)
Contains the condition that will change the curent items' icon when met. |
void |
setDynamicTitleFunction(MenuItemStringFunction handler)
Contains the condition that will change the curent items' title when met. |
void |
setEnabled(Boolean enabled)
Affects the visual style and interactivity of the menu item. |
void |
setEnableIfCondition(MenuItemIfFunction enableIf)
Contains the condition that will enable or disable the curent menuItem. |
void |
setFetchSubmenus(Boolean fetchSubmenus)
If false, no submenus will be fetched for this MenuItem. |
void |
setIcon(String icon)
The base filename for this item's custom icon. |
void |
setIconHeight(int iconHeight)
The height applied to this item's icon. |
void |
setIconWidth(int iconWidth)
The width applied to this item's icon. |
void |
setIsSeparator(Boolean isSeparator)
When set to true, this menu item shows a horizontal separator instead of the title text. |
void |
setJavaScriptObject(JavaScriptObject jsObj)
|
void |
setKeys(KeyIdentifier... keys)
Shortcut key(s) to fire the menu item action. |
void |
setKeyTitle(String keyTitle)
A string to display in the shortcut-key column for this item. |
void |
setSubmenu(Menu submenu)
A reference to another menu, to display as a submenu when the mouse cursor hovers over this menu item. |
void |
setTitle(String title)
The text displayed for the menu item |
| Methods inherited from class com.smartgwt.client.widgets.grid.ListGridRecord |
|---|
get_baseStyle, getBackgroundComponent, getCanAcceptDrop, getCanDrag, getCanExpand, getCustomStyle, getDetailDS, getIncludeInSummary, getIsGridSummary, getIsGroupSummary, getLinkText, getSingleCellValue, set_baseStyle, setBackgroundComponent, setCanAcceptDrop, setCanDrag, setCanExpand, setCustomStyle, setDetailDS, setIncludeInSummary, setIsGridSummary, setIsGroupSummary, setLinkText, setSingleCellValue |
| Methods inherited from class com.smartgwt.client.data.Record |
|---|
convertToRecordArray, copyAttributes, copyAttributesInto, getAttributeAsRecordArray, getAttributeAsRecordList, toMap |
| Methods inherited from class com.smartgwt.client.core.RefDataClass |
|---|
getRef, getRef |
| Methods inherited from class com.smartgwt.client.core.JsObject |
|---|
isCreated, setJsObj |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
|---|
fireEvent |
| Constructor Detail |
|---|
public MenuItem()
public MenuItem(JavaScriptObject jsObj)
public MenuItem(String title)
public MenuItem(String title,
String icon)
public MenuItem(String title,
String icon,
String keyTitle)
| Method Detail |
|---|
public static MenuItem getOrCreateRef(JavaScriptObject jsObj)
public void setJavaScriptObject(JavaScriptObject jsObj)
setJavaScriptObject in class ListGridRecordpublic void setCanSelectParent(Boolean canSelectParent)
canSelectParent - canSelectParent Default value is nullpublic Boolean getCanSelectParent()
public void setChecked(Boolean checked)
checkmarkImage. If you need to set this
state dynamically, use MenuItem.checkIf instead.
checked - checked Default value is nullpublic Boolean getChecked()
checkmarkImage. If you need to set this
state dynamically, use MenuItem.checkIf instead.
public void setEnabled(Boolean enabled)
false, the menu item will not
respond to mouse rollovers or clicks. If you need to set this state dynamically, use MenuItem.enableIf instead.
setEnabled in class ListGridRecordenabled - enabled Default value is truepublic Boolean getEnabled()
false, the menu item will not
respond to mouse rollovers or clicks. If you need to set this state dynamically, use MenuItem.enableIf instead.
getEnabled in class ListGridRecordpublic void setFetchSubmenus(Boolean fetchSubmenus)
fetchSubmenus.
fetchSubmenus - fetchSubmenus Default value is truepublic Boolean getFetchSubmenus()
fetchSubmenus.
public void setIcon(String icon)
checked are both specified, only 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 MenuItem.dynamicIcon instead.
icon - . See String. Default value is nullpublic String getIcon()
checked are both specified, only 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 MenuItem.dynamicIcon instead.
Stringpublic void setIconHeight(int iconHeight)
16 can be changed for all MenuItems by overriding
iconHeight.
iconHeight - iconHeight Default value is 16public int getIconHeight()
16 can be changed for all MenuItems by overriding
iconHeight.
public void setIconWidth(int iconWidth)
16 can be changed for all MenuItems by overriding
iconWidth.
iconWidth - iconWidth Default value is 16public int getIconWidth()
16 can be changed for all MenuItems by overriding
iconWidth.
public void setIsSeparator(Boolean isSeparator)
true, this menu item shows a horizontal separator instead of the title text. Typically specified as the only property of a menu
item, since the separator will not respond to mouse events.
setIsSeparator in class ListGridRecordisSeparator - isSeparator Default value is falsepublic Boolean getIsSeparator()
true, this menu item shows a horizontal separator instead of the title text. Typically specified as the only property of a menu
item, since the separator will not respond to mouse events.
getIsSeparator in class ListGridRecordpublic void setKeyTitle(String keyTitle)
keys will be used by default.
keyTitle - . See String. Default value is see belowpublic String getKeyTitle()
keys will be used by default.
Stringpublic void setSubmenu(Menu submenu)
submenu - submenu Default value is nullpublic Menu getSubmenu()
public void setTitle(String title)
title - . See String. Default value is nullpublic String getTitle()
Stringpublic HandlerRegistration addClickHandler(ClickHandler handler)
Executed when this menu item is clicked by the user. The click handler must be specified as a function or string of
script. Call com.smartgwt.client.widgets.menu.events.MenuItemClickEvent#cancel() from within ClickHandler.onClick(com.smartgwt.client.widgets.events.ClickEvent) to suppress the Menu.itemClick
handler if specified.
addClickHandler in interface HasClickHandlershandler - the click handler
HandlerRegistration used to remove this handlerpublic void setKeys(KeyIdentifier... keys)
KeyIdentifier.
To apply multiple shortcut keys to this item, set this property to an array of such key identifiers.
keys - keys Default value is nullpublic void setEnableIfCondition(MenuItemIfFunction enableIf)
If you don't need to
set this state dynamically, use enabled instead.
public void setCheckIfCondition(MenuItemIfFunction checkIf)
If you don't need to
set this state dynamically, use checked instead.
public void setDynamicTitleFunction(MenuItemStringFunction handler)
If you don't need to set this state dynamically, use title instead.
public void setDynamicIconFunction(MenuItemStringFunction handler)
If you don't need to set this state dynamically, use icon instead.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||