org.xith3d.ui.hud.widgets
Class List<Item extends Widget>

java.lang.Object
  extended by org.xith3d.ui.hud.base.WidgetBase
      extended by org.xith3d.ui.hud.base.RectangularWidget
          extended by org.xith3d.ui.hud.widgets.List<Item>
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 Implemented Interfaces:
org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.types.twodee.Positioned2f, org.openmali.types.twodee.Positioned2fRO, org.openmali.types.twodee.Sized2f, org.openmali.types.twodee.Sized2fRO, AbstractList<Item>, BackgroundSettable, BackgroundSettableWidget, BorderSettable, PaddingSettable, Widget
Direct Known Subclasses:
TextList

public class List<Item extends Widget>
extends RectangularWidget
implements AbstractList<Item>, BorderSettable, PaddingSettable, BackgroundSettableWidget

A Scrollable List Widget able to hold some of Widgets.

See Also:
BackgroundSettable, TextWidget

Nested Class Summary
static class List.Description
          This class is used to describe a List Widget.
 
Nested classes/interfaces inherited from interface org.xith3d.ui.hud.base.Widget
Widget.DescriptionBase
 
Field Summary
 
Fields inherited from class org.xith3d.ui.hud.base.WidgetBase
containerListeners, transformGroup, translation, Z_INDEX_UNIT, Z_INDEX_UNIT_ASSEMBLER
 
Constructor Summary
List(float width, float height)
          Creates a new List Widget.
List(float width, float height, int zIndex)
          Creates a new List Widget.
List(float width, float height, int zIndex, List.Description listDesc)
          Creates a new List Widget.
List(float width, float height, List.Description listDesc)
          Creates a new List Widget.
List(org.openmali.types.twodee.Sized2fRO size)
          Creates a new List Widget.
List(org.openmali.types.twodee.Sized2fRO size, int zIndex)
          Creates a new List Widget.
List(org.openmali.types.twodee.Sized2fRO size, int zIndex, List.Description listDesc)
          Creates a new List Widget.
List(org.openmali.types.twodee.Sized2fRO size, List.Description listDesc)
          Creates a new List Widget.
 
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.
protected  void cullItems()
           
 Texture getBackground()
          
 org.openmali.vecmath2.Colorf getBackgroundColor()
          
 float getBackgroundTileHeight()
          
 org.openmali.types.twodee.Sized2fRO getBackgroundTileSize()
          
 float getBackgroundTileWidth()
          
 Border getBorder()
          
 int getBottomIndex()
           
 Item getBottomItem()
           
 TextAlignment getFixAlignment()
           
 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.
 float getPaddingBottom()
          
 float getPaddingLeft()
          
 float getPaddingRight()
          
 float getPaddingTop()
          
 int getSelectedIndex()
          
 Item getSelectedItem()
          
 org.openmali.vecmath2.Colorf getSelectionBackgroundColor()
           
 org.openmali.vecmath2.Colorf getSelectionForegroundColor()
           
 int getTopIndex()
           
 Item getTopItem()
           
 float getTransparency()
          
protected  void init()
          This method is called when the WidgetContainer is set.
 boolean isFixedToBottom()
          If true, the List always scrolls to the lowest item, when a new Item is added and the List is currently scrolled to bottom.
 boolean isScrollBarForced()
          Returns the ScrollBar's forced visibility.
 boolean isScrollBarVisible()
          Returns the ScrollBar's visibility.
 boolean isScrolledToBottom()
           
 void onKeyPressed(org.jagatoo.input.devices.components.Key key, long when)
          This event is fired, when a key is pressed on a focused Widget.
 void onMouseButtonPressed(org.jagatoo.input.devices.components.MouseButton button, int x, int y, long when, long lastWhen, boolean isTopMost, boolean hasFocus)
          This event is fired, when a mouse button is pressed on a focused Widget.
 void onMouseWheelMoved(int delta, boolean isPageMove, int x, int y, long when, boolean isTopMost)
          This event is fired, when the mouse wheel is moved on a Widget.
 void removeItem(int index)
          Removes the given Item from the List
protected  void removeItem(int index, boolean updateSelItem)
           
 void removeItem(Item item)
          Removes the given Item from the List
protected  void removeItem(Item item, boolean updateSelItem)
           
 void removeSelectionListener(ListSelectionListener<Item> l)
          Removes a ListSelectionListener.
 void scrollToBottom()
          Scrolls the list to the bottom-most item.
 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 setBackground(org.openmali.vecmath2.Colorf color)
          Sets the background color of the Widget.
 void setBackground(java.lang.String texture)
          Sets the background Texture of the Widget.
 void setBackground(Texture texture)
          Sets the background texture of the Widget.
 void setBackgroundTileSize(float tileWidth, float tileHeight)
          Sets the background tile size.
 void setBackgroundTileSize(org.openmali.types.twodee.Sized2fRO tileSize)
          Sets the background tile size.
 void setBorder(Border.Description borderDesc)
          Creates a new Border from the given Border.Desctiption and invokes setBorder(Border).
 void setBorder(Border border)
          Sets the Border to use for this BorderSettable Widget.
 void setFixAlignment(TextAlignment alignment)
          If a Label is added to the List, its TextAlignment is fixed to this value.
 void setFixedToBottom(boolean fixed)
          Fixes or releases this List to always scroll to the lowest item, when a new Item is added and the List is currently scrolled to bottom.
 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.
 boolean setPadding(float padding)
          Sets padding for this PaddingSettable Widget.
 boolean setPadding(float paddingBottom, float paddingRight, float paddingTop, float paddingLeft)
          Sets padding for this PaddingSettable Widget.
 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.
 void setSelectionBackgroundColor(org.openmali.vecmath2.Colorf color)
          Sets the background-color of the selected Item.
 void setSelectionForegroundColor(org.openmali.vecmath2.Colorf color)
          Sets the foreground-color of the selected Item.
 boolean setSize(float width, float height, boolean forced)
          
 void setTopIndex(int index)
          Scrolls the List to a position with the given index at the top.
 void setTopItem(Item item)
          Scrolls the List to a position with the given item at the top.
 void setTopItem(java.lang.String itemName)
          Scrolls the List to a position with the given item at the top.
protected  void setVerticalScrollbarValue(int value)
           
 void update()
          Updates the Widget's internals.
 
Methods inherited from class org.xith3d.ui.hud.base.RectangularWidget
getPickHeight, getPickSGZPosition, getPickWidth, pick
 
Methods inherited from class org.xith3d.ui.hud.base.WidgetBase
addContainerListener, addFocusListener, addInputListener, addLocationListener, addSizeListener, addVisibilityListener, detach, detach, getAspect, getAssembly, getCachedToolTipWidget, getContainer, getContextMenu, getCursor, getHeight, getHUD, getInheritedCursor, getLeft, getLocation, getName, getSGNode, getSGZPosition, getSize, getToolTip, getTop, getUserObject, getWidgetAssembler, getWidth, getZIndex, hasFocus, hasFocus, hasToolTip, isClickable, isDraggable, isFocussable, isInitialized, isInitializing, isPickable, isVisible, onAddedToContainer, onAddedToHUD, onControllerAxisChanged, onControllerButtonPressed, onControllerButtonReleased, onDetached, onFocusGained, onFocusLost, onInputStateChanged, onKeyReleased, onKeyTyped, onMouseButtonReleased, onMouseEntered, onMouseLeft, onMouseMoved, onMouseStopped, onMouseUnbound, onRemovedFromContainer, pickWidgetAssembler, removeContainerListener, removeFocusListener, removeInputListener, removeLocationListener, removeSizeListener, removeVisibilityListener, requestFocus, setAssembly, setCachedToolTipWidget, setClickable, setContainer, setContextMenu, setCursor, setDraggable, setFocussable, setHeight, setLocation, setLocation, setLocation, setName, setPickable, setSize, setSize, setSize, setToolTip, setTransparency, setUserObject, setVisible, setWidth, setZIndex, toString, updateTranslation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.xith3d.ui.hud.base.Widget
addContainerListener, addFocusListener, addInputListener, addLocationListener, addSizeListener, addVisibilityListener, detach, detach, getAspect, getAssembly, getCachedToolTipWidget, getContainer, getContextMenu, getCursor, getHeight, getHUD, getInheritedCursor, getLeft, getLocation, getName, getSGNode, getSGZPosition, getSize, getToolTip, getTop, getUserObject, getWidth, getZIndex, hasFocus, hasFocus, hasToolTip, isClickable, isDraggable, isFocussable, isPickable, isVisible, onControllerAxisChanged, onControllerButtonPressed, onControllerButtonReleased, onDetached, onFocusGained, onFocusLost, onInputStateChanged, onKeyReleased, onKeyTyped, onMouseButtonReleased, onMouseEntered, onMouseLeft, onMouseMoved, onMouseStopped, onMouseUnbound, pick, removeContainerListener, removeFocusListener, removeInputListener, removeLocationListener, removeSizeListener, removeVisibilityListener, requestFocus, setAssembly, setCachedToolTipWidget, setClickable, setContainer, setContextMenu, setCursor, setDraggable, setFocussable, setLocation, setLocation, setName, setPickable, setSize, setSize, setSize, setToolTip, setTransparency, setUserObject, setVisible, setZIndex
 
Methods inherited from interface org.openmali.types.twodee.Sized2f
setHeight, setWidth
 

Constructor Detail

List

public List(float width,
            float height,
            int zIndex,
            List.Description listDesc)
Creates a new List Widget.

Parameters:
width - the new (outer) width
height - the new (outer) height
zIndex - the new z-index
listDesc - the List.Description to describe this new List Widget

List

public List(float width,
            float height,
            List.Description listDesc)
Creates a new List Widget.

Parameters:
width - the new (outer) width
height - the new (outer) height
listDesc - the List.Description to describe this new List Widget

List

public List(org.openmali.types.twodee.Sized2fRO size,
            int zIndex,
            List.Description listDesc)
Creates a new List Widget.

Parameters:
size - the new (outer) size
zIndex - the new z-index
listDesc - the List.Description to describe this new List Widget

List

public List(org.openmali.types.twodee.Sized2fRO size,
            List.Description listDesc)
Creates a new List Widget.

Parameters:
size - the new (outer) size
listDesc - the List.Description to describe this new List Widget

List

public List(float width,
            float height,
            int zIndex)
Creates a new List Widget.

Parameters:
width - the new (outer) width
height - the new (outer) height
zIndex - the new z-index

List

public List(float width,
            float height)
Creates a new List Widget.

Parameters:
width - the new (outer) width
height - the new (outer) height

List

public List(org.openmali.types.twodee.Sized2fRO size,
            int zIndex)
Creates a new List Widget.

Parameters:
size - the new (outer) size
zIndex - the new z-index

List

public List(org.openmali.types.twodee.Sized2fRO size)
Creates a new List Widget.

Parameters:
size - the new (outer) size
Method Detail

getTransparency

public float getTransparency()

Specified by:
getTransparency in interface Widget
Returns:
the whole Widget's Transparency.

addSelectionListener

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

Specified by:
addSelectionListener in interface AbstractList<Item extends Widget>
Parameters:
l - the new listener

removeSelectionListener

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

Specified by:
removeSelectionListener in interface AbstractList<Item extends Widget>
Parameters:
l - the listener to be removed

setBorder

public void setBorder(Border border)
Sets the Border to use for this BorderSettable Widget.

Specified by:
setBorder in interface BorderSettable
Parameters:
border - the new Border (null for no border)

setBorder

public void setBorder(Border.Description borderDesc)
Creates a new Border from the given Border.Desctiption and invokes setBorder(Border).

Specified by:
setBorder in interface BorderSettable
Parameters:
borderDesc - the Border.Description to create the new Border from (null for no border)
See Also:
BorderSettable.setBorder(Border)

getBorder

public Border getBorder()

Specified by:
getBorder in interface BorderSettable
Returns:
the Border used for this BorderSettable Widget

setPadding

public boolean setPadding(float paddingBottom,
                          float paddingRight,
                          float paddingTop,
                          float paddingLeft)
Sets padding for this PaddingSettable Widget.
Padding translates local coordinates and shrinks the clipping area.

Specified by:
setPadding in interface PaddingSettable
Returns:
true, if the padding actually has changed

setPadding

public final boolean setPadding(float padding)
Sets padding for this PaddingSettable Widget.
Padding translates local coordinates and shrinks the clipping area.

Specified by:
setPadding in interface PaddingSettable
Parameters:
padding - padding for bottom, right, top and left
Returns:
true, if the padding actually has changed

getPaddingBottom

public float getPaddingBottom()

Specified by:
getPaddingBottom in interface PaddingSettable
Returns:
bottom-padding for this PaddingSettable Widget.
Padding translates local coordinates and shrinks the clipping area.

getPaddingRight

public float getPaddingRight()

Specified by:
getPaddingRight in interface PaddingSettable
Returns:
right-padding for this PaddingSettable Widget.
Padding translates local coordinates and shrinks the clipping area.

getPaddingTop

public float getPaddingTop()

Specified by:
getPaddingTop in interface PaddingSettable
Returns:
top-padding for this PaddingSettable Widget.
Padding translates local coordinates and shrinks the clipping area.

getPaddingLeft

public float getPaddingLeft()

Specified by:
getPaddingLeft in interface PaddingSettable
Returns:
left-padding for this PaddingSettable Widget.
Padding translates local coordinates and shrinks the clipping area.

setBackground

public void setBackground(org.openmali.vecmath2.Colorf color)
Sets the background color of the Widget.

Specified by:
setBackground in interface BackgroundSettable
Parameters:
color - the color to use

setBackground

public void setBackground(java.lang.String texture)
Sets the background Texture of the Widget.

Specified by:
setBackground in interface BackgroundSettable
Parameters:
texture - the texture resource to use

setBackground

public void setBackground(Texture texture)
Sets the background texture of the Widget.

Specified by:
setBackground in interface BackgroundSettable
Parameters:
texture - the texture resource to use

getBackground

public Texture getBackground()

Specified by:
getBackground in interface BackgroundSettable
Returns:
the background Texture of the WidgetContainer.

getBackgroundColor

public org.openmali.vecmath2.Colorf getBackgroundColor()

Specified by:
getBackgroundColor in interface BackgroundSettable
Returns:
the background color of the Widget.

setBackgroundTileSize

public void setBackgroundTileSize(float tileWidth,
                                  float tileHeight)
Sets the background tile size.
Use any negative value for no tiling.

Specified by:
setBackgroundTileSize in interface BackgroundSettable
Parameters:
tileWidth - the tile width (or negative for no tiling of width)
tileHeight - the tile height (or negative for no tiling of height)

setBackgroundTileSize

public void setBackgroundTileSize(org.openmali.types.twodee.Sized2fRO tileSize)
Sets the background tile size.
Use any negative value for no tiling.

Specified by:
setBackgroundTileSize in interface BackgroundSettable
Parameters:
tileSize - the tile size (or null for no tiling)

getBackgroundTileSize

public org.openmali.types.twodee.Sized2fRO getBackgroundTileSize()

Specified by:
getBackgroundTileSize in interface BackgroundSettable
Returns:
the background tile size (or null for no tiling)

getBackgroundTileWidth

public float getBackgroundTileWidth()

Specified by:
getBackgroundTileWidth in interface BackgroundSettable
Returns:
the background tile width (or negative for no tiling)

getBackgroundTileHeight

public float getBackgroundTileHeight()

Specified by:
getBackgroundTileHeight in interface BackgroundSettable
Returns:
the background tile width (or negative for no tiling)

setFixAlignment

public void setFixAlignment(TextAlignment alignment)
If a Label is added to the List, its TextAlignment is fixed to this value.
Set this to null to remain the original alignment of the Label.

Parameters:
alignment - the new TextAlignment for an added Label (or null for no fix)

getFixAlignment

public TextAlignment getFixAlignment()
Returns:
the TextAlignment an added Label's one is fixed to when it's added.
No fix is applied, if this is null.

cullItems

protected void cullItems()

setVerticalScrollbarValue

protected void setVerticalScrollbarValue(int value)

setSize

public boolean setSize(float width,
                       float height,
                       boolean forced)

Overrides:
setSize in class WidgetBase

setHeightByItems

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

Specified by:
setHeightByItems in interface AbstractList<Item extends Widget>
Parameters:
height - the new height by items unit

getHeightByItems

public int getHeightByItems()

Specified by:
getHeightByItems in interface AbstractList<Item extends Widget>
Returns:
the height by items count

setMaxHeight

public 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).

Specified by:
setMaxHeight in interface AbstractList<Item extends Widget>
Parameters:
maxHeight - the maximum height of this List or (-1) for no limit

getMaxHeight

public 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).

Specified by:
getMaxHeight in interface AbstractList<Item extends Widget>
Returns:
the maximum height of this List in Items count units (or -1 for no limit).

setScrollBarVisible

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

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

Specified by:
setScrollBarVisible in interface AbstractList<Item extends Widget>
Parameters:
visible - the ScrollBar's possible visibility

isScrollBarVisible

public boolean isScrollBarVisible()
Returns the ScrollBar's visibility.

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

Specified by:
isScrollBarVisible in interface AbstractList<Item extends Widget>
Returns:
the ScrollBar's visibility.

setScrollBarForced

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

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

Specified by:
setScrollBarForced in interface AbstractList<Item extends Widget>
Parameters:
forced - the ScrollBar's forced visibility

isScrollBarForced

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

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

Specified by:
isScrollBarForced in interface AbstractList<Item extends Widget>
Returns:
the ScrollBar's forced visibility.

setFixedToBottom

public void setFixedToBottom(boolean fixed)
Fixes or releases this List to always scroll to the lowest item, when a new Item is added and the List is currently scrolled to bottom.

Parameters:
fixed -

isFixedToBottom

public boolean isFixedToBottom()
If true, the List always scrolls to the lowest item, when a new Item is added and the List is currently scrolled to bottom.


setSelectionBackgroundColor

public void setSelectionBackgroundColor(org.openmali.vecmath2.Colorf color)
Sets the background-color of the selected Item.

Parameters:
color -

getSelectionBackgroundColor

public org.openmali.vecmath2.Colorf getSelectionBackgroundColor()
Returns:
the background-color of the selected Item.

setSelectionForegroundColor

public void setSelectionForegroundColor(org.openmali.vecmath2.Colorf color)
Sets the foreground-color of the selected Item.

Parameters:
color -

getSelectionForegroundColor

public org.openmali.vecmath2.Colorf getSelectionForegroundColor()
Returns:
the foreground-color of the selected Item.

setTopIndex

public void setTopIndex(int index)
Scrolls the List to a position with the given index at the top.

Parameters:
index - the new topmost item's index

setTopItem

public void setTopItem(Item item)
Scrolls the List to a position with the given item at the top.

Parameters:
item - the new topmost item

setTopItem

public void setTopItem(java.lang.String itemName)
Scrolls the List to a position with the given item at the top.

Parameters:
itemName - the new topmost item's name

getTopIndex

public int getTopIndex()
Returns:
the topmost item's index visible in the List (or -1, if the List is empty)

getTopItem

public Item getTopItem()
Returns:
the topmost item visible in the List (or null, if the List is empty)

getBottomIndex

public int getBottomIndex()
Returns:
the bottom-most item's index visible in the List (or -1, if the List is empty)

getBottomItem

public Item getBottomItem()
Returns:
the bottom-most item visible in the List (or null, if the List is empty)

isScrolledToBottom

public boolean isScrolledToBottom()
Returns:
true, if the List is currently scrollt to the bottom-most item.

scrollToBottom

public void scrollToBottom()
Scrolls the list to the bottom-most item.


setSelectedItem

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

Specified by:
setSelectedItem in interface AbstractList<Item extends Widget>

setSelectedItem

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

Specified by:
setSelectedItem in interface AbstractList<Item extends Widget>

getSelectedItem

public Item getSelectedItem()

Specified by:
getSelectedItem in interface AbstractList<Item extends Widget>
Returns:
the currently selected Item

getSelectedIndex

public int getSelectedIndex()

Specified by:
getSelectedIndex in interface AbstractList<Item extends Widget>
Returns:
the selected Item's index or null

selectPreviousItem

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

Specified by:
selectPreviousItem in interface AbstractList<Item extends Widget>
Returns:
the new selected index

selectNextItem

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

Specified by:
selectNextItem in interface AbstractList<Item extends Widget>
Returns:
the new selected index

setAddItemSetsSelectedItem

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

Specified by:
setAddItemSetsSelectedItem in interface AbstractList<Item extends Widget>

addItemSetsSelectedItem

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

Specified by:
addItemSetsSelectedItem in interface AbstractList<Item extends Widget>

onKeyPressed

public void onKeyPressed(org.jagatoo.input.devices.components.Key key,
                         long when)
This event is fired, when a key is pressed on a focused Widget.

Specified by:
onKeyPressed in interface Widget
Overrides:
onKeyPressed in class WidgetBase
Parameters:
key - the key that was pressed
when - the keyevent's timestamp

onMouseWheelMoved

public void onMouseWheelMoved(int delta,
                              boolean isPageMove,
                              int x,
                              int y,
                              long when,
                              boolean isTopMost)
This event is fired, when the mouse wheel is moved on a Widget.

Specified by:
onMouseWheelMoved in interface Widget
Overrides:
onMouseWheelMoved in class WidgetBase
Parameters:
delta - a positive value when the wheel was moved up
x - the current mouse x position
y - the current mouse y position
isTopMost - is this Widget topMost

onMouseButtonPressed

public void onMouseButtonPressed(org.jagatoo.input.devices.components.MouseButton button,
                                 int x,
                                 int y,
                                 long when,
                                 long lastWhen,
                                 boolean isTopMost,
                                 boolean hasFocus)
This event is fired, when a mouse button is pressed on a focused Widget.

Specified by:
onMouseButtonPressed in interface Widget
Overrides:
onMouseButtonPressed in class WidgetBase
Parameters:
button - the button that was pressed
x - the current mouse x position
y - the current mouse y position
isTopMost - is this Widget topMost
hasFocus - is this Widget focused
See Also:
net.jtank.input.MouseCode

addItem

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

Specified by:
addItem in interface AbstractList<Item extends Widget>
Parameters:
index - the position to add the Item at
item - the new Item to add to the List

addItem

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

Specified by:
addItem in interface AbstractList<Item extends Widget>
Parameters:
item - the new Item to add to the List

removeItem

protected void removeItem(int index,
                          boolean updateSelItem)

removeItem

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

Specified by:
removeItem in interface AbstractList<Item extends Widget>
Parameters:
index - the position of the Item to be removed

removeItem

protected final void removeItem(Item item,
                                boolean updateSelItem)

removeItem

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

Specified by:
removeItem in interface AbstractList<Item extends Widget>
Parameters:
item - the Item to be removed from the List

clear

public void clear()
Removes all items from the List.

Specified by:
clear in interface AbstractList<Item extends Widget>

getItemsCount

public final int getItemsCount()

Specified by:
getItemsCount in interface AbstractList<Item extends Widget>
Returns:
the number of Items in this List

getItems

public final java.util.List<Item> getItems()

Specified by:
getItems in interface AbstractList<Item extends Widget>
Returns:
a java.util.List of all Items in this List

getItem

public final Item getItem(int index)

Specified by:
getItem in interface AbstractList<Item extends Widget>
Parameters:
index - the index to get the Item from
Returns:
the Item at the given index

getItem

public final Item getItem(java.lang.String itemName)

Specified by:
getItem in interface AbstractList<Item extends Widget>
Parameters:
itemName - the name to get the Item from
Returns:
the Item with the given name

update

public void update()
Updates the Widget's internals.
Called by the Widget system and can be called from outside.

Specified by:
update in interface Widget
Overrides:
update in class WidgetBase

init

protected void init()
This method is called when the WidgetContainer is set.

Specified by:
init in class WidgetBase