public class MenuCombo extends com.google.gwt.user.client.ui.FlowPanel implements IMenu
MenuCombo makes it simpler and safer to build Menus. It
absorbs the complexity of creating a Menu and its related action
Button. In fact, for the Menu to work properly some
requirements must be satisfied. With mdl, these requirement are the
responsibility of the developer. This component's goal is to encapsulate
these requirements and to hide them from the developer. By enforcing these
rules inside the menu, the developer's full attention goes to the application
logic. These requirements are as follows :Menu is. Otherwise, the Menu won't be able to attach its
event handlers to it.Button.Menu should reference the id of its related Button in
order for mdl to bind them together. The developer should provide an id for
the Button which should then be fed to the Menu.
Button.com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled| Constructor and Description |
|---|
MenuCombo(Button btn)
Setup a
MenuCombo. |
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(String item,
boolean enabled)
Has the same effect as MenuCombo.addItem(item , item, enabled).
|
void |
addItem(String text,
String value,
boolean enabled)
Adds a new option to the list of options in the menu.
|
void |
addItemClickListener(Menu.ItemClickListener listener)
When an object needs to be notified upon a
MenuItem click, it must
be be registered to the Menu as an Menu.ItemClickListener . |
void |
clearMenu()
Remove all items from the menu.
|
int |
getItemCount()
Returns the items count in a menu.
|
String |
getItemText(int index)
return the text of the item located at the position provided as input.
|
String |
getValue(int index)
return the value of the item located at the position provided as input.
|
boolean |
isEnabled(int index)
Modify the enabled state of an item.
|
void |
setAnchor(MenuAnchor anchor)
Sets the position of the
Menu on the screen related to its
associated action button using one of the available anchoring options
provided by MenuAnchor. |
boolean |
setEnabled(int index,
boolean enabled)
Modify the enabled state of an item.
|
add, add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, removeadd, adopt, doAttachChildren, doDetachChildren, orphan, removeaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEventsaddStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic MenuCombo(Button btn)
MenuCombo.Button and a Menu that works
together to display the menu to the user when the button is clicked. Using
this constructor, the user provides the instance of the button. The menu
property is managed behind the scene at the combo.btn - the action button for the menupublic final void setAnchor(MenuAnchor anchor)
IMenuMenu on the screen related to its
associated action button using one of the available anchoring options
provided by MenuAnchor.public final void clearMenu()
IMenupublic final void addItem(String text, String value, boolean enabled)
IMenupublic final void addItem(String item, boolean enabled)
item - the value and text of the item to be addedenabled - the state of the item to be addedpublic final void addItemClickListener(Menu.ItemClickListener listener)
IMenuMenuItem click, it must
be be registered to the Menu as an Menu.ItemClickListener .Menu.ItemClickListener interfaceMenuItem is
clicked inside Menu.ItemClickListener.onItemClicked(ItemClickEvent)Menu.addItemClickListener(ItemClickListener) to register
itself to the menu and receive click notificationsaddItemClickListener in interface IMenulistener - The object to be notified when a MenuItem is clicked.Menu.ItemClickListenerpublic final int getItemCount()
IMenugetItemCount in interface IMenupublic final String getItemText(int index)
IMenugetItemText in interface IMenuindex - the position of the itempublic final String getValue(int index)
IMenupublic final boolean setEnabled(int index,
boolean enabled)
IMenusetEnabled in interface IMenuindex - the position of the item in the item list of the menuenabled - the state to be set for the itemtrue if the state was modified, false
otherwise.public final boolean isEnabled(int index)
IMenuCopyright © 2016 com.github.ilyes4j. All rights reserved.