de.lessvoid.nifty.controls
Interface DropDown<T>

Type Parameters:
T -
All Superinterfaces:
de.lessvoid.nifty.controls.NiftyControl
All Known Implementing Classes:
DropDownControl, DropDownNull

public interface DropDown<T>
extends de.lessvoid.nifty.controls.NiftyControl

The DropDown interface is the Nifty control API view of a Nifty DropDown control.

Author:
void

Nested Class Summary
static interface DropDown.DropDownViewConverter<T>
          You'll need to implement this interface to change the way your model class T needs to be displayed in the DropDown.
static class DropDown.SimpleDropDownViewConverter<T>
          A simple implementation of DropDownViewConverter that will just use item.toString().
 
Method Summary
 void addAllItems(List<T> itemsToAdd)
          Add all items to the DropDown.
 void addItem(T newItem)
          Add a item to the DropDown.
 void clear()
          Clear all items from this DropDown.
 List<T> getItems()
          Get all items of this DropDown.
 int getSelectedIndex()
          Returns the index of the current selected item in the list of all items.
 T getSelection()
          Get the current selection.
 void insertItem(T item, int index)
          Insert the given item at the given index.
 int itemCount()
          Retrieve the number of items in the DropDown.
 void removeAllItems(List<T> itemsToRemove)
          Remove all items given in the List from this DropDown.
 void removeItem(T item)
          Remove the given item from the DropDown.
 void removeItemByIndex(int itemIndex)
          Remove an item from the DropDown by index.
 void selectItem(T item)
          Select the item in the DropDown.
 void selectItemByIndex(int selectionIndex)
          Select the item with the given index in the DropDown.
 void setViewConverter(DropDown.DropDownViewConverter<T> viewConverter)
          Change the DropDownViewConverter for this DropDown.
 
Methods inherited from interface de.lessvoid.nifty.controls.NiftyControl
disable, enable, getElement, getHeight, getId, getStyle, getWidth, hasFocus, isBound, isEnabled, layoutCallback, setEnabled, setFocus, setFocusable, setHeight, setId, setStyle, setWidth
 

Method Detail

setViewConverter

void setViewConverter(DropDown.DropDownViewConverter<T> viewConverter)
Change the DropDownViewConverter for this DropDown.

Parameters:
viewConverter - DropDownViewConverter

addItem

void addItem(T newItem)
Add a item to the DropDown.

Parameters:
newItem - the item to add

insertItem

void insertItem(T item,
                int index)
Insert the given item at the given index.

Parameters:
item - item
index - the index to insert the item.

itemCount

int itemCount()
Retrieve the number of items in the DropDown.

Returns:
number of items.

clear

void clear()
Clear all items from this DropDown.


selectItemByIndex

void selectItemByIndex(int selectionIndex)
Select the item with the given index in the DropDown.

Parameters:
selectionIndex - the item index to select in the DropDown

selectItem

void selectItem(T item)
Select the item in the DropDown.

Parameters:
item - the item to select

getSelection

T getSelection()
Get the current selection.

Returns:
the selected item in this DropDown.

getSelectedIndex

int getSelectedIndex()
Returns the index of the current selected item in the list of all items.

Returns:
selected item index

removeItemByIndex

void removeItemByIndex(int itemIndex)
Remove an item from the DropDown by index.

Parameters:
itemIndex - remove the item with the given index from the DropDown

removeItem

void removeItem(T item)
Remove the given item from the DropDown.

Parameters:
item - the item to remove from the DropDown

getItems

List<T> getItems()
Get all items of this DropDown.

Returns:
list of all items

addAllItems

void addAllItems(List<T> itemsToAdd)
Add all items to the DropDown.

Parameters:
itemsToAdd - all items to add

removeAllItems

void removeAllItems(List<T> itemsToRemove)
Remove all items given in the List from this DropDown.

Parameters:
itemsToRemove - list of items to remove


Copyright © 2011. All Rights Reserved.