org.xith3d.ui.hud.base
Interface AbstractList<Item extends Widget>

Type Parameters:
Item - the generic type of the list items.
If must be a subclass of BackgroundSettable to accept the themeable selection background color.
If must be a subclass of TextWidget to accept the themeable selection foreground color.
All Known Subinterfaces:
AbstractTextList<T>
All Known Implementing Classes:
ComboBox, List, TextList

public interface AbstractList<Item extends Widget>

Any List implementation must implement this interface for common usage.


Method Summary
 Item addItem(int index, Item item)
          Adds the given Item to the List (at the given position).
 Item addItem(Item item)
          Adds the given Item to the List (at the end).
 boolean addItemSetsSelectedItem()
          If set to true, the addItem() method sets the selected item to the added one.
 void addSelectionListener(ListSelectionListener<Item> l)
          Adds a new ListSelectionListener.
 void clear()
          Removes all items from the List.
 int getHeightByItems()
           
 Item getItem(int index)
           
 Item getItem(java.lang.String itemName)
           
 java.util.List<Item> getItems()
           
 int getItemsCount()
           
 int getMaxHeight()
          Returns the maximum height of this List in Items count units.
 int getSelectedIndex()
           
 Item getSelectedItem()
           
 boolean isScrollBarForced()
          Returns the ScrollBar's forced visibility.
 boolean isScrollBarVisible()
          Returns the ScrollBar's visibility.
 void removeItem(int index)
          Removes the given Item from the List
 void removeItem(Item item)
          Removes the given Item from the List
 void removeSelectionListener(ListSelectionListener<Item> l)
          Removes a ListSelectionListener.
 int selectNextItem()
          Sets the selected item to the following one of the currently selected item.
 int selectPreviousItem()
          Sets the selected item to the previous one of the currently selected item.
 void setAddItemSetsSelectedItem(boolean b)
          If set to true, the addItem() method sets the selected item to the added one.
 void setHeightByItems(int height)
          Sets the height by items count.
 void setMaxHeight(int maxHeight)
          Sets the maximum height of this List in Items count units.
 void setScrollBarForced(boolean forced)
          Sets the ScrollBar's forced visibility.
 void setScrollBarVisible(boolean visible)
          Sets the ScrollBar's visibility.
 void setSelectedItem(Item item)
          Sets the currently selected Item.
 void setSelectedItem(java.lang.String itemName)
          Sets the currently selected Item.
 

Method Detail

addSelectionListener

void addSelectionListener(ListSelectionListener<Item> l)
Adds a new ListSelectionListener.

Parameters:
l - the new listener

removeSelectionListener

void removeSelectionListener(ListSelectionListener<Item> l)
Removes a ListSelectionListener.

Parameters:
l - the listener to be removed

setSelectedItem

void setSelectedItem(Item item)
Sets the currently selected Item.

Parameters:
item -

setSelectedItem

void setSelectedItem(java.lang.String itemName)
Sets the currently selected Item.

Parameters:
itemName -

getSelectedItem

Item getSelectedItem()
Returns:
the currently selected Item

getSelectedIndex

int getSelectedIndex()
Returns:
the selected Item's index or null

selectPreviousItem

int selectPreviousItem()
Sets the selected item to the previous one of the currently selected item.

Returns:
the new selected index

selectNextItem

int selectNextItem()
Sets the selected item to the following one of the currently selected item.

Returns:
the new selected index

setAddItemSetsSelectedItem

void setAddItemSetsSelectedItem(boolean b)
If set to true, the addItem() method sets the selected item to the added one.

Parameters:
b -

addItemSetsSelectedItem

boolean addItemSetsSelectedItem()
If set to true, the addItem() method sets the selected item to the added one.


addItem

Item addItem(int index,
             Item item)
Adds the given Item to the List (at the given position).

Parameters:
index - the position to add the Item at
item - the new Item to add to the List

addItem

Item addItem(Item item)
Adds the given Item to the List (at the end).

Parameters:
item - the new Item to add to the List

removeItem

void removeItem(int index)
Removes the given Item from the List

Parameters:
index - the position of the Item to be removed

removeItem

void removeItem(Item item)
Removes the given Item from the List

Parameters:
item - the Item to be removed from the List

clear

void clear()
Removes all items from the List.


getItemsCount

int getItemsCount()
Returns:
the number of Items in this List

getItems

java.util.List<Item> getItems()
Returns:
a java.util.List of all Items in this List

getItem

Item getItem(int index)
Parameters:
index - the index to get the Item from
Returns:
the Item at the given index

getItem

Item getItem(java.lang.String itemName)
Parameters:
itemName - the name to get the Item from
Returns:
the Item with the given name

setHeightByItems

void setHeightByItems(int height)
Sets the height by items count.

Parameters:
height - the new height by items unit

getHeightByItems

int getHeightByItems()
Returns:
the height by items count

setMaxHeight

void setMaxHeight(int maxHeight)
Sets the maximum height of this List in Items count units.

If the List has more Items than this number, the ScrollBar shown.
If getScrollBarForced() is true, the ScrollBar is always visible.
If getScrollBarVisible() is false, the ScrollBar is never visible.
As a result the ScrollBar is visible, if (&&) or if (getScrollBarForced() == true).

Parameters:
maxHeight - the maximum height of this List or (-1) for no limit

getMaxHeight

int getMaxHeight()
Returns the maximum height of this List in Items count units.

If the List has more Items than this number, the ScrollBar shown.
If getScrollBarForced() is true, the ScrollBar is always visible.
If getScrollBarVisible() is false, the ScrollBar is never visible.
As a result the ScrollBar is visible, if (&&) or if (getScrollBarForced() == true).

Returns:
the maximum height of this List in Items count units (or -1 for no limit).

setScrollBarVisible

void setScrollBarVisible(boolean visible)
Sets the ScrollBar's visibility.

The ScrollBar is visible, if (&&) or if (getScrollBarForced() == true).

Parameters:
visible - the ScrollBar's possible visibility

isScrollBarVisible

boolean isScrollBarVisible()
Returns the ScrollBar's visibility.

The ScrollBar is visible, if (&&) or if (getScrollBarForced() == true).

Returns:
the ScrollBar's visibility.

setScrollBarForced

void setScrollBarForced(boolean forced)
Sets the ScrollBar's forced visibility.

The ScrollBar is visible, if (&&) or if (getScrollBarForced() == true).

Parameters:
forced - the ScrollBar's forced visibility

isScrollBarForced

boolean isScrollBarForced()
Returns the ScrollBar's forced visibility.

The ScrollBar is visible, if (&&) or if (getScrollBarForced() == true).

Returns:
the ScrollBar's forced visibility.