org.xith3d.ui.hud.widgets
Class Slider

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.Slider
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, Widget

public class Slider
extends RectangularWidget

A simple Slider implementation used to select a certain value from a range.


Nested Class Summary
static class Slider.Description
          This class is used to describe a (set of) Slider Widget(s).
 
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
Slider(float width)
          Creates a new Slider.
Slider(float width, float height)
          Creates a new Slider.
Slider(float width, float height, int zIndex)
          Creates a new Slider.
Slider(float width, float height, int zIndex, Slider.Description desc)
          Creates a new Slider.
Slider(float width, float height, int zIndex, java.lang.String leftTex, java.lang.String rightTex, java.lang.String bodyTex, java.lang.String handleTex)
          Creates a new Slider.
Slider(float width, float height, int zIndex, Texture leftTex, Texture rightTex, Texture bodyTex, Texture handleTex)
          Creates a new Slider.
Slider(float width, float height, Slider.Description desc)
          Creates a new Slider.
Slider(float width, float height, java.lang.String leftTex, java.lang.String rightTex, java.lang.String bodyTex, java.lang.String handleTex)
          Creates a new Slider.
Slider(float width, float height, Texture leftTex, Texture rightTex, Texture bodyTex, Texture handleTex)
          Creates a new Slider.
Slider(float width, int zIndex)
          Creates a new Slider.
Slider(float width, int zIndex, Slider.Description desc)
          Creates a new Slider.
Slider(float width, int zIndex, java.lang.String leftTex, java.lang.String rightTex, java.lang.String bodyTex, java.lang.String handleTex)
          Creates a new Slider.
Slider(float width, int zIndex, Texture leftTex, Texture rightTex, Texture bodyTex, Texture handleTex)
          Creates a new Slider.
Slider(float width, Slider.Description desc)
          Creates a new Slider.
Slider(float width, java.lang.String leftTex, java.lang.String rightTex, java.lang.String bodyTex, java.lang.String handleTex)
          Creates a new Slider.
Slider(float width, Texture leftTex, Texture rightTex, Texture bodyTex, Texture handleTex)
          Creates a new Slider.
Slider(org.openmali.types.twodee.Sized2fRO size)
          Creates a new Slider.
Slider(org.openmali.types.twodee.Sized2fRO size, int zIndex)
          Creates a new Slider.
Slider(org.openmali.types.twodee.Sized2fRO size, int zIndex, Slider.Description desc)
          Creates a new Slider.
Slider(org.openmali.types.twodee.Sized2fRO size, int zIndex, java.lang.String leftTex, java.lang.String rightTex, java.lang.String bodyTex, java.lang.String handleTex)
          Creates a new Slider.
Slider(org.openmali.types.twodee.Sized2fRO size, int zIndex, Texture leftTex, Texture rightTex, Texture bodyTex, Texture handleTex)
          Creates a new Slider.
Slider(org.openmali.types.twodee.Sized2fRO size, Slider.Description desc)
          Creates a new Slider.
Slider(org.openmali.types.twodee.Sized2fRO size, java.lang.String leftTex, java.lang.String rightTex, java.lang.String bodyTex, java.lang.String handleTex)
          Creates a new Slider.
Slider(org.openmali.types.twodee.Sized2fRO size, Texture leftTex, Texture rightTex, Texture bodyTex, Texture handleTex)
          Creates a new Slider.
 
Method Summary
 void addSliderListener(SliderListener l)
          Adds a SliderListener to the List to be notified, when the value has changed.
 float getHandleYOffset()
           
 int getLower()
           
 float getTransparency()
          
 int getUpper()
           
 int getValue()
           
protected  void init()
          This method is called when the WidgetContainer is set.
 boolean isSmoothSliding()
           
 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 onMouseButtonReleased(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 released on a focused Widget.
 void onMouseMoved(int x, int y, int buttonsState, long when, boolean isTopMost, boolean hasFocus)
          This event is fired, when the mouse is moved on a Widget.
 void onMouseUnbound()
          This event is fired, when the mouse is released.
 boolean removeSliderListener(SliderListener l)
          Removes a SliderListener from the List.
 void setHandleYOffset(float yOffset)
           
 void setLower(int lower)
          Sets the lower bound of scroll values.
 boolean setSize(float width, float height, boolean forced)
          
 void setSmoothSliding(boolean b)
          If true, the handle doesn't snap to discrete positiones depending on the available slide values.
 void setUpper(int upper)
          Sets the upper bound of scroll values.
 boolean setValue(int value)
          Sets the current scroll value
 
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, onKeyPressed, onKeyReleased, onKeyTyped, onMouseEntered, onMouseLeft, onMouseStopped, onMouseWheelMoved, 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, update, updateTranslation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Slider

public Slider(float width,
              float height,
              int zIndex,
              Slider.Description desc)
Creates a new Slider.

Parameters:
width - the width of the Slider
height - the height of the Slider
zIndex - the z-index of the Scrollbar
desc - a ScrollbarDescription instance holding information about this new Scrollbar

Slider

public Slider(float width,
              int zIndex,
              Slider.Description desc)
Creates a new Slider.

Parameters:
width - the width of the Slider
zIndex - the z-index of the Scrollbar
desc - a ScrollbarDescription instance holding information about this new Scrollbar

Slider

public Slider(float width,
              float height,
              Slider.Description desc)
Creates a new Slider.

Parameters:
width - the width of the Slider
height - the height of the Slider
desc - a ScrollbarDescription instance holding information about this new Scrollbar

Slider

public Slider(float width,
              Slider.Description desc)
Creates a new Slider.

Parameters:
width - the width of the Slider
desc - a ScrollbarDescription instance holding information about this new Scrollbar

Slider

public Slider(org.openmali.types.twodee.Sized2fRO size,
              int zIndex,
              Slider.Description desc)
Creates a new Slider.

Parameters:
size - the size of the Scrollbar
zIndex - the z-index of the Scrollbar
desc - a ScrollbarDescription instance holding information about this new Scrollbar

Slider

public Slider(org.openmali.types.twodee.Sized2fRO size,
              Slider.Description desc)
Creates a new Slider.

Parameters:
size - the size of the Scrollbar
desc - a ScrollbarDescription instance holding information about this new Scrollbar

Slider

public Slider(float width,
              float height,
              int zIndex,
              Texture leftTex,
              Texture rightTex,
              Texture bodyTex,
              Texture handleTex)
Creates a new Slider.

Parameters:
width - the width of the Slider
height - the height of the Slider
zIndex - the new zIndex
leftTex - the left end Texture
rightTex - the right end Texture
bodyTex - the body Texture
handleTex - the handle image

Slider

public Slider(float width,
              float height,
              Texture leftTex,
              Texture rightTex,
              Texture bodyTex,
              Texture handleTex)
Creates a new Slider.

Parameters:
width - the width of the Slider
height - the height of the Slider
leftTex - the left end Texture
rightTex - the right end Texture
bodyTex - the body Texture
handleTex - the handle image

Slider

public Slider(float width,
              int zIndex,
              Texture leftTex,
              Texture rightTex,
              Texture bodyTex,
              Texture handleTex)
Creates a new Slider.

Parameters:
width - the width of the Slider
zIndex - the new zIndex
leftTex - the left end Texture
rightTex - the right end Texture
bodyTex - the body Texture
handleTex - the handle image

Slider

public Slider(float width,
              Texture leftTex,
              Texture rightTex,
              Texture bodyTex,
              Texture handleTex)
Creates a new Slider.

Parameters:
width - the width of the Slider
leftTex - the left end Texture
rightTex - the right end Texture
bodyTex - the body Texture
handleTex - the handle image

Slider

public Slider(org.openmali.types.twodee.Sized2fRO size,
              int zIndex,
              Texture leftTex,
              Texture rightTex,
              Texture bodyTex,
              Texture handleTex)
Creates a new Slider.

Parameters:
size - the size of the Slider
zIndex - the new zIndex
leftTex - the left end Texture
rightTex - the right end Texture
bodyTex - the body Texture
handleTex - the handle image

Slider

public Slider(org.openmali.types.twodee.Sized2fRO size,
              Texture leftTex,
              Texture rightTex,
              Texture bodyTex,
              Texture handleTex)
Creates a new Slider.

Parameters:
size - the size of the Slider
leftTex - the left end Texture
rightTex - the right end Texture
bodyTex - the body Texture
handleTex - the handle image

Slider

public Slider(float width,
              float height,
              int zIndex,
              java.lang.String leftTex,
              java.lang.String rightTex,
              java.lang.String bodyTex,
              java.lang.String handleTex)
Creates a new Slider.

Parameters:
width - the width of the Slider
height - the height of the Slider
zIndex - the new zIndex
leftTex - the left end Texture
rightTex - the right end Texture
bodyTex - the body Texture
handleTex - the handle image

Slider

public Slider(float width,
              float height,
              java.lang.String leftTex,
              java.lang.String rightTex,
              java.lang.String bodyTex,
              java.lang.String handleTex)
Creates a new Slider.

Parameters:
width - the width of the Slider
height - the height of the Slider
leftTex - the left end Texture
rightTex - the right end Texture
bodyTex - the body Texture
handleTex - the handle image

Slider

public Slider(float width,
              int zIndex,
              java.lang.String leftTex,
              java.lang.String rightTex,
              java.lang.String bodyTex,
              java.lang.String handleTex)
Creates a new Slider.

Parameters:
width - the width of the Slider
zIndex - the new zIndex
leftTex - the left end Texture
rightTex - the right end Texture
bodyTex - the body Texture
handleTex - the handle image

Slider

public Slider(float width,
              java.lang.String leftTex,
              java.lang.String rightTex,
              java.lang.String bodyTex,
              java.lang.String handleTex)
Creates a new Slider.

Parameters:
width - the width of the Slider
leftTex - the left end Texture
rightTex - the right end Texture
bodyTex - the body Texture
handleTex - the handle image

Slider

public Slider(org.openmali.types.twodee.Sized2fRO size,
              int zIndex,
              java.lang.String leftTex,
              java.lang.String rightTex,
              java.lang.String bodyTex,
              java.lang.String handleTex)
Creates a new Slider.

Parameters:
size - the size of the Slider
zIndex - the new zIndex
leftTex - the left end Texture
rightTex - the right end Texture
bodyTex - the body Texture
handleTex - the handle image

Slider

public Slider(org.openmali.types.twodee.Sized2fRO size,
              java.lang.String leftTex,
              java.lang.String rightTex,
              java.lang.String bodyTex,
              java.lang.String handleTex)
Creates a new Slider.

Parameters:
size - the size of the Slider
leftTex - the left end Texture
rightTex - the right end Texture
bodyTex - the body Texture
handleTex - the handle image

Slider

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

Parameters:
width - the width of the Slider
height - the height of the Slider
zIndex - the new zIndex

Slider

public Slider(float width,
              int zIndex)
Creates a new Slider.

Parameters:
width - the width of the Slider
zIndex - the new zIndex

Slider

public Slider(float width,
              float height)
Creates a new Slider.

Parameters:
width - the width of the Slider
height - the height of the Slider

Slider

public Slider(float width)
Creates a new Slider.

Parameters:
width - the width of the Slider

Slider

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

Parameters:
size - the size of the Slider
zIndex - the new zIndex

Slider

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

Parameters:
size - the size of the Slider
Method Detail

getTransparency

public float getTransparency()

Returns:
the whole Widget's Transparency.

setHandleYOffset

public void setHandleYOffset(float yOffset)

getHandleYOffset

public float getHandleYOffset()

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

onMouseButtonReleased

public void onMouseButtonReleased(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 released on a focused Widget.

Specified by:
onMouseButtonReleased in interface Widget
Overrides:
onMouseButtonReleased in class WidgetBase
Parameters:
button - the button that was released
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

onMouseUnbound

public void onMouseUnbound()
This event is fired, when the mouse is released. onMouseMoved will not be called on the Widget anymore, when the mouse is not over it.

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

onMouseMoved

public void onMouseMoved(int x,
                         int y,
                         int buttonsState,
                         long when,
                         boolean isTopMost,
                         boolean hasFocus)
This event is fired, when the mouse is moved on a Widget.

Specified by:
onMouseMoved in interface Widget
Overrides:
onMouseMoved in class WidgetBase
Parameters:
x - the new X coordinate
y - the new Y coordinate
isTopMost - is this Widget topMost
hasFocus - is this Widget focused

getLower

public int getLower()
Returns:
the lower bound of scroll values

setLower

public void setLower(int lower)
Sets the lower bound of scroll values.


getUpper

public int getUpper()
Returns:
the upper bound of scroll values

setUpper

public void setUpper(int upper)
Sets the upper bound of scroll values.


getValue

public int getValue()
Returns:
the current scroll value

setValue

public boolean setValue(int value)
Sets the current scroll value


addSliderListener

public void addSliderListener(SliderListener l)
Adds a SliderListener to the List to be notified, when the value has changed.

Parameters:
l - the new SliderListener

removeSliderListener

public boolean removeSliderListener(SliderListener l)
Removes a SliderListener from the List.

Parameters:
l - the SliderListener to be removed

setSmoothSliding

public void setSmoothSliding(boolean b)
If true, the handle doesn't snap to discrete positiones depending on the available slide values.

Parameters:
b - enable/disable

isSmoothSliding

public boolean isSmoothSliding()
Returns:
true, if the handle doesn't snap to discrete positiones depending on the available slide values.

setSize

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

Overrides:
setSize in class WidgetBase

init

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

Specified by:
init in class WidgetBase