Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.maryanovsky.gwtutils.client.ui
Class DropDownList

    java.lang.Object
      com.google.gwt.user.client.ui.UIObject
          com.google.gwt.user.client.ui.Widget
              com.google.gwt.user.client.ui.Composite
                  com.maryanovsky.gwtutils.client.ui.DropDownList

All Implemented Interfaces:
  HasAttachHandlers, HasValueChangeHandlers<Integer>, HasHandlers, EventListener, IsWidget

    public class DropDownList

extends Composite
implements HasValueChangeHandlers<Integer>

A simple drop down list. The CSS style names of this widget are

- .gwtutils-DropDownList for the widget itself
- .gwtutils-DropDownListOpen for the widget itself, when the popup is open.
- .gwtutils-DropDownListSelectedItemLabel for the label where the current item appears
- .gwtutils-DropDownListArrow for the drop-down arrow widget.
- .gwtutils-DropDownListPopup for the popup.
- .gwtutils-DropDownListPopupPanel for the panel inside the popup that holds the items.
- .gwtutils-DropDownListPopupItem for an item in the popup menu.
- .gwtutils-DropDownListPopupItemSelected for the item in the popup menu that the user currently has the mouse cursor over.

Author:
  Maryanovsky Alexander

Nested Class Summary
`static interface` | `DropDownList.Resources` The interface for the resources required by a drop-down list.

Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
`UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled`

Field Summary
`PopupPanel` | `popup` The popup.

Fields inherited from class com.google.gwt.user.client.ui.UIObject
`DEBUG_ID_PREFIX`

Constructor Summary
`DropDownList()` Creates a new `DropDownList` which will use a character to represent the arrow.
`DropDownList(DropDownList.Resources resources)` Creates a new `DropDownList` with the specified `DropDownList.Resources`.

Method Summary
`void` | `addItem(String item)` Adds an item.
`HandlerRegistration` | `addValueChangeHandler(ValueChangeHandler<Integer> handler)` Adds a handler for change of the selected index.
`protected Widget` | `createDropDownArrow(DropDownList.Resources resources)` Creates the dropdown arrow widget from the specified resources.
`protected Widget` | `createPopupSelectionList()` Creates the widget to be displayed in the popup to select an item.
`String` | `getItem(int index)` Returns the item at the specified index.
`int` | `getItemCount()` Returns the number of items.
`PopupPanel` | `getPopup()` Returns the popup panel in which the items are displayed for selection.
`int` | `getSelectedIndex()` Returns the currently selected index; -1 if none.
`void` | `insertItem(String item, int index)` Inserts an item at the specified index.
`void` | `removeItem(int index)` Removes the item at the specified index.
`void` | `setSelectedIndex(int index)` Sets the item with the specified index to be selected.

Methods inherited from class com.google.gwt.user.client.ui.Composite
`getWidget, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, setWidget`

Methods inherited from class com.google.gwt.user.client.ui.Widget
`addAttachHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents`

Methods inherited from class com.google.gwt.user.client.ui.UIObject
`addStyleDependentName, 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, toString, unsinkEvents`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.google.gwt.event.shared.HasHandlers
`fireEvent`

Field Detail

### popup

    public final PopupPanel popup

  The popup.

Constructor Detail

### DropDownList

    public DropDownList()

  Creates a new `DropDownList` which will use a character to represent the arrow.

### DropDownList

    public DropDownList(DropDownList.Resources resources)

  Creates a new `DropDownList` with the specified `DropDownList.Resources`.

Method Detail

### createDropDownArrow

    protected Widget createDropDownArrow(DropDownList.Resources resources)

  Creates the dropdown arrow widget from the specified resources. If `resources` is not `null`, the default implementation returns an `Image` created from the `ImageResource` returned by `DropDownList.Resources.dropDownArrowIcon()`. Otherwise, it returns a label with a down-pointing triangle character.

### addValueChangeHandler

    public HandlerRegistration addValueChangeHandler(ValueChangeHandler<Integer> handler)

  Adds a handler for change of the selected index.

  Specified by:
    `addValueChangeHandler` in interface `HasValueChangeHandlers<Integer>`

### addItem

    public void addItem(String item)

  Adds an item.

### insertItem

    public void insertItem(String item,
                           int index)

  Inserts an item at the specified index.

### removeItem

    public void removeItem(int index)

  Removes the item at the specified index.

### getItem

    public String getItem(int index)

  Returns the item at the specified index.

### getItemCount

    public int getItemCount()

  Returns the number of items.

### getSelectedIndex

    public int getSelectedIndex()

  Returns the currently selected index; -1 if none.

### setSelectedIndex

    public void setSelectedIndex(int index)

  Sets the item with the specified index to be selected.

### getPopup

    public final PopupPanel getPopup()

  Returns the popup panel in which the items are displayed for selection.

### createPopupSelectionList

    protected Widget createPopupSelectionList()

  Creates the widget to be displayed in the popup to select an item.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD