public class Dropdown extends com.google.gwt.user.client.ui.Composite implements IMenu
MenuCombo that has the ability to store the selected item. When
Dropdown is initially setup, the first enabled item is set to be the
selected item by default.| Constructor and Description |
|---|
Dropdown()
Setup a default dropdown with a raised action
Button and a menu
anchored to the bottom-left of the action button. |
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(String item)
Has the same effect as Dropdown.addItem(item , true).
|
void |
addItem(String item,
boolean enabled)
Has the same effect as Dropdown.addItem(item , item, enabled).
|
void |
addItem(String value,
String text)
Shortcut for
addItem(String, boolean) that adds an enabled
item to the menu. |
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.
|
int |
getSelected() |
int |
getSelectedIndex() |
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.
|
void |
setSelected(int index)
Set a selected item of the dropdown programmatically.
|
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidgetaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, 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, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toStringpublic Dropdown()
Button and a menu
anchored to the bottom-left of the action button.public 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 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)
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 addItem(String item)
item - the value and text of the item to be addedpublic final void addItem(String value, String text)
addItem(String, boolean) that adds an enabled
item to the menu.value - the value of the item to be added.text - the text of the item to be added.public final int getSelectedIndex()
public final void setSelected(int index)
index - the index of the item to be selectedpublic final int getSelected()
Copyright © 2016 com.github.ilyes4j. All rights reserved.