org.xith3d.ui.hud.listmodels
Class StateButtonListModel

java.lang.Object
  extended by org.xith3d.ui.hud.base.ListModel
      extended by org.xith3d.ui.hud.listmodels.DefaultAbstractListModel
          extended by org.xith3d.ui.hud.listmodels.TextListModel
              extended by org.xith3d.ui.hud.listmodels.StateButtonListModel

public class StateButtonListModel
extends TextListModel

The TextListModel converts all items to String through String.valueOf(Object).
It also honors the font and font-color properties of the List.
A LabeledStateButton is used to render the items to the List.


Constructor Summary
StateButtonListModel()
           
StateButtonListModel(java.util.List<java.lang.Object> items)
           
StateButtonListModel(java.util.List<java.lang.Object> items, LabeledStateButton widget)
           
 
Method Summary
 boolean checkOnMouseButtonPressedImpl(int itemIndex, float itemTop, float itemBottom, float mouseX, float mouseY)
          Checks, if the item should be selected after it was clicked at the specified location.
protected  void checkWidgetType(Widget widget)
           
protected  LabeledStateButton createWidget()
           
protected  float getItemHeightImpl(int itemIndex)
          Gets the item's height in HUD space.
 boolean getItemState(int itemIndex)
          Gets an item's state.
protected  float getMinItemWidthImpl(int itemIndex)
          Gets the item's minimum width in HUD space.
 boolean hoverNeedsRedraw()
          Checks, whether hovering the items needs the List to be redrawn.
protected  void prepareWidgetImpl(float listContentWidth, Widget widget, java.lang.Object item, int itemIndex)
          This method is called right before the Widget is used to render a specific item.
 void setItemState(int itemIndex, boolean state)
          Sets an item's state.
 
Methods inherited from class org.xith3d.ui.hud.listmodels.TextListModel
applyValueToWidget, clear, getItemColor, getItemFont, getUsedWidgets, getWidgetImpl, setItemColor, setItemFont
 
Methods inherited from class org.xith3d.ui.hud.listmodels.DefaultAbstractListModel
addItemImpl, getItemImpl, getItemsCount, getItemUserObject, removeItemImpl, setItemImpl, setItemUserObject
 
Methods inherited from class org.xith3d.ui.hud.base.ListModel
addItem, addItem, addItems, addItems, checkOnMouseButtonPressed, getItem, getItemHeight, getList, getMinItemWidth, getSelectedIndex, getSelectedItem, getUsesFixedHeight, getWidget, isSelected, markListDirty, prepareWidget, removeItem, setItem, setSelectedIndex, setUsesFixedHeight
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateButtonListModel

public StateButtonListModel(java.util.List<java.lang.Object> items,
                            LabeledStateButton widget)

StateButtonListModel

public StateButtonListModel(java.util.List<java.lang.Object> items)

StateButtonListModel

public StateButtonListModel()
Method Detail

setItemState

public void setItemState(int itemIndex,
                         boolean state)
Sets an item's state.

Parameters:
itemIndex -
state - the item's state.

getItemState

public final boolean getItemState(int itemIndex)
Gets an item's state.

Parameters:
itemIndex -
Returns:
the items state.

prepareWidgetImpl

protected void prepareWidgetImpl(float listContentWidth,
                                 Widget widget,
                                 java.lang.Object item,
                                 int itemIndex)
Description copied from class: TextListModel
This method is called right before the Widget is used to render a specific item.
It must only return the Widget.

Overrides:
prepareWidgetImpl in class TextListModel

hoverNeedsRedraw

public boolean hoverNeedsRedraw()
Checks, whether hovering the items needs the List to be redrawn.

Overrides:
hoverNeedsRedraw in class ListModel
Returns:
if hovering the items needs a redraw.

checkOnMouseButtonPressedImpl

public boolean checkOnMouseButtonPressedImpl(int itemIndex,
                                             float itemTop,
                                             float itemBottom,
                                             float mouseX,
                                             float mouseY)
Checks, if the item should be selected after it was clicked at the specified location.

Overrides:
checkOnMouseButtonPressedImpl in class ListModel
Returns:
should the item get selected?

getItemHeightImpl

protected float getItemHeightImpl(int itemIndex)
Description copied from class: TextListModel
Gets the item's height in HUD space. If getUsesFixedHeight() is true, only the value of the first item is used for all.

Overrides:
getItemHeightImpl in class TextListModel
Returns:
the item's height.

getMinItemWidthImpl

protected float getMinItemWidthImpl(int itemIndex)
Description copied from class: TextListModel
Gets the item's minimum width in HUD space.

Overrides:
getMinItemWidthImpl in class TextListModel
Returns:
the item's minimum height.

createWidget

protected LabeledStateButton createWidget()
Overrides:
createWidget in class TextListModel

checkWidgetType

protected void checkWidgetType(Widget widget)
Overrides:
checkWidgetType in class TextListModel