org.xith3d.ui.hud.widgets
Class Scrollbar

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.Scrollbar
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 Scrollbar
extends RectangularWidget

A simple Scrollbar implementation used to scroll content on the HUD.


Nested Class Summary
static class Scrollbar.Description
          This class is used to describe a (set of) Scrollbar Widget(s).
static class Scrollbar.Direction
          Scrolldirection of the Scrollbar
 
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
Scrollbar(float width, float height, int zIndex, Scrollbar.Description sbDesc, float handleSize)
          Creates a new Scrollbar.
Scrollbar(float width, float height, int zIndex, Scrollbar.Direction direction)
          Creates a new Scrollbar.
Scrollbar(float width, float height, int zIndex, Scrollbar.Direction direction, float handleSize)
          Creates a new Scrollbar.
Scrollbar(float width, float height, int zIndex, Scrollbar.Direction direction, java.lang.String backgroundTex, java.lang.String handleTex)
          Creates a new Scrollbar.
Scrollbar(float width, float height, int zIndex, Scrollbar.Direction direction, java.lang.String backgroundTex, java.lang.String handleTex, float handleSize)
          Creates a new Scrollbar.
Scrollbar(float width, float height, int zIndex, Scrollbar.Direction direction, Texture backgroundTex, Texture handleTex)
          Creates a new Scrollbar.
Scrollbar(float width, float height, int zIndex, Scrollbar.Direction direction, Texture backgroundTex, Texture handleTex, float handleSize)
          Creates a new Scrollbar.
Scrollbar(float width, float height, Scrollbar.Direction direction)
          Creates a new Scrollbar.
Scrollbar(float width, float height, Scrollbar.Direction direction, float handleSize)
          Creates a new Scrollbar.
Scrollbar(float width, float height, Scrollbar.Direction direction, java.lang.String backgroundTex, java.lang.String handleTex)
          Creates a new Scrollbar.
Scrollbar(float width, float height, Scrollbar.Direction direction, java.lang.String backgroundTex, java.lang.String handleTex, float handleSize)
          Creates a new Scrollbar.
Scrollbar(float width, float height, Scrollbar.Direction direction, Texture backgroundTex, Texture handleTex)
          Creates a new Scrollbar.
Scrollbar(float width, float height, Scrollbar.Direction direction, Texture backgroundTex, Texture handleTex, float handleSize)
          Creates a new Scrollbar.
Scrollbar(float length, int zIndex, Scrollbar.Description sbDesc)
          Creates a new Scrollbar.
Scrollbar(float length, int zIndex, Scrollbar.Direction direction)
          Creates a new Scrollbar.
Scrollbar(float length, Scrollbar.Description sbDesc)
          Creates a new Scrollbar.
Scrollbar(float length, Scrollbar.Direction direction)
          Creates a new Scrollbar.
Scrollbar(org.openmali.types.twodee.Sized2fRO size, int zIndex, Scrollbar.Description sbDesc, float handleSize)
          Creates a new Scrollbar.
Scrollbar(org.openmali.types.twodee.Sized2fRO size, int zIndex, Scrollbar.Direction direction)
          Creates a new Scrollbar.
Scrollbar(org.openmali.types.twodee.Sized2fRO size, int zIndex, Scrollbar.Direction direction, float handleSize)
          Creates a new Scrollbar.
Scrollbar(org.openmali.types.twodee.Sized2fRO size, int zIndex, Scrollbar.Direction direction, java.lang.String backgroundTex, java.lang.String handleTex)
          Creates a new Scrollbar.
Scrollbar(org.openmali.types.twodee.Sized2fRO size, int zIndex, Scrollbar.Direction direction, java.lang.String backgroundTex, java.lang.String handleTex, float handleSize)
          Creates a new Scrollbar.
Scrollbar(org.openmali.types.twodee.Sized2fRO size, int zIndex, Scrollbar.Direction direction, Texture backgroundTex, Texture handleTex)
          Creates a new Scrollbar.
Scrollbar(org.openmali.types.twodee.Sized2fRO size, int zIndex, Scrollbar.Direction direction, Texture backgroundTex, Texture handleTex, float handleSize)
          Creates a new Scrollbar.
Scrollbar(org.openmali.types.twodee.Sized2fRO size, Scrollbar.Direction direction)
          Creates a new Scrollbar.
Scrollbar(org.openmali.types.twodee.Sized2fRO size, Scrollbar.Direction direction, float handleSize)
          Creates a new Scrollbar.
Scrollbar(org.openmali.types.twodee.Sized2fRO size, Scrollbar.Direction direction, java.lang.String backgroundTex, java.lang.String handleTex)
          Creates a new Scrollbar.
Scrollbar(org.openmali.types.twodee.Sized2fRO size, Scrollbar.Direction direction, java.lang.String backgroundTex, java.lang.String handleTex, float handleSize)
          Creates a new Scrollbar.
Scrollbar(org.openmali.types.twodee.Sized2fRO size, Scrollbar.Direction direction, Texture backgroundTex, Texture handleTex)
          Creates a new Scrollbar.
Scrollbar(org.openmali.types.twodee.Sized2fRO size, Scrollbar.Direction direction, Texture backgroundTex, Texture handleTex, float handleSize)
          Creates a new Scrollbar.
 
Method Summary
 void addScrollbarListener(ScrollbarListener l)
          Adds a ScrollbarListener to the List to be notified, when the value has changed.
 Scrollbar.Direction getDirection()
           
 int getLower()
           
 int getSmallIncrement()
           
 float getTransparency()
          
 int getUpper()
           
 int getValue()
           
protected  void init()
          This method is called when the WidgetContainer is set.
 boolean isSmoothScrolling()
           
 void link(WidgetContainer container)
          Links this ScrollBar with the given WidgetContainer.
 void link(WidgetContainer container, float scale)
          Links this ScrollBar with the given WidgetContainer.
 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 removeScrollbarListener(ScrollbarListener l)
          Removes a ScrollbarListener from the List.
 void setLower(int lower)
          Sets the lower bound of scroll values.
 boolean setSize(float width, float height, boolean forced)
          
 void setSmallIncrement(int value)
          Sets the step to increment the Scrollbar's value by when the increment button is clicked.
 void setSmoothScrolling(boolean b)
          If true, the handle doesn't snap to discrete positiones depending on the available scroll 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

Scrollbar

public Scrollbar(float width,
                 float height,
                 int zIndex,
                 Scrollbar.Description sbDesc,
                 float handleSize)
Creates a new Scrollbar.

Parameters:
width - the width of the Scrollbar
height - the height of the Scrollbar
zIndex - the z-index of the Scrollbar
sbDesc - a ScrollbarDescription instance holding information about this new Scrollbar
handleSize - the handle size

Scrollbar

public Scrollbar(org.openmali.types.twodee.Sized2fRO size,
                 int zIndex,
                 Scrollbar.Description sbDesc,
                 float handleSize)
Creates a new Scrollbar.

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

Scrollbar

public Scrollbar(float length,
                 int zIndex,
                 Scrollbar.Description sbDesc)
Creates a new Scrollbar.

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

Scrollbar

public Scrollbar(float length,
                 Scrollbar.Direction direction)
Creates a new Scrollbar.

Parameters:
length - if (direction == HORIZONTAL), this is the width of the Scrollbar.
if (direction == VERTICAL), this is the height of the Scrollbar.
direction - the scroll-direction

Scrollbar

public Scrollbar(float length,
                 int zIndex,
                 Scrollbar.Direction direction)
Creates a new Scrollbar.

Parameters:
length - if (direction == HORIZONTAL), this is the width of the Scrollbar. if (direction == VERTICAL), this is the height of the Scrollbar.
zIndex - the z-index of the Scrollbar
direction - the scroll-direction

Scrollbar

public Scrollbar(org.openmali.types.twodee.Sized2fRO size,
                 Scrollbar.Direction direction,
                 float handleSize)
Creates a new Scrollbar.

Parameters:
size - the size of the Scrollbar
direction - the scroll-direction
handleSize - the handle size

Scrollbar

public Scrollbar(float width,
                 float height,
                 Scrollbar.Direction direction,
                 float handleSize)
Creates a new Scrollbar.

Parameters:
width - the width of the Scrollbar
height - the height of the Scrollbar
direction - the scroll-direction
handleSize - the handle size

Scrollbar

public Scrollbar(org.openmali.types.twodee.Sized2fRO size,
                 int zIndex,
                 Scrollbar.Direction direction,
                 float handleSize)
Creates a new Scrollbar.

Parameters:
size - the size of the Scrollbar
zIndex - the z-index of the Scrollbar
direction - the scroll-direction
handleSize - the handle size

Scrollbar

public Scrollbar(float width,
                 float height,
                 int zIndex,
                 Scrollbar.Direction direction,
                 float handleSize)
Creates a new Scrollbar.

Parameters:
width - the width of the Scrollbar
height - the height of the Scrollbar
zIndex - the z-index of the Scrollbar
direction - the scroll-direction
handleSize - the handle size

Scrollbar

public Scrollbar(org.openmali.types.twodee.Sized2fRO size,
                 Scrollbar.Direction direction)
Creates a new Scrollbar.

Parameters:
size - the size of the Scrollbar
direction - the scroll-direction

Scrollbar

public Scrollbar(float width,
                 float height,
                 Scrollbar.Direction direction)
Creates a new Scrollbar.

Parameters:
width - the width of the Scrollbar
height - the height of the Scrollbar
direction - the scroll-direction

Scrollbar

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

Parameters:
size - the size of the Scrollbar
zIndex - the z-index of the Scrollbar
direction - the scroll-direction

Scrollbar

public Scrollbar(float width,
                 float height,
                 int zIndex,
                 Scrollbar.Direction direction)
Creates a new Scrollbar.

Parameters:
width - the width of the Scrollbar
height - the height of the Scrollbar
zIndex - the z-index of the Scrollbar
direction - the scroll-direction

Scrollbar

public Scrollbar(org.openmali.types.twodee.Sized2fRO size,
                 Scrollbar.Direction direction,
                 java.lang.String backgroundTex,
                 java.lang.String handleTex,
                 float handleSize)
Creates a new Scrollbar.

Parameters:
size - the size of the Scrollbar
direction - the scroll-direction
backgroundTex - the background image
handleTex - the handle image
handleSize - the handle size

Scrollbar

public Scrollbar(float width,
                 float height,
                 Scrollbar.Direction direction,
                 java.lang.String backgroundTex,
                 java.lang.String handleTex,
                 float handleSize)
Creates a new Scrollbar.

Parameters:
width - the width of the Scrollbar
height - the height of the Scrollbar
direction - the scroll-direction
backgroundTex - the background image
handleTex - the handle image
handleSize - the handle size

Scrollbar

public Scrollbar(org.openmali.types.twodee.Sized2fRO size,
                 Scrollbar.Direction direction,
                 java.lang.String backgroundTex,
                 java.lang.String handleTex)
Creates a new Scrollbar.

Parameters:
size - the size of the Scrollbar
direction - the scroll-direction
backgroundTex - the background image
handleTex - the handle image

Scrollbar

public Scrollbar(float width,
                 float height,
                 Scrollbar.Direction direction,
                 java.lang.String backgroundTex,
                 java.lang.String handleTex)
Creates a new Scrollbar.

Parameters:
width - the width of the Scrollbar
height - the height of the Scrollbar
direction - the scroll-direction
backgroundTex - the background image
handleTex - the handle image

Scrollbar

public Scrollbar(org.openmali.types.twodee.Sized2fRO size,
                 Scrollbar.Direction direction,
                 Texture backgroundTex,
                 Texture handleTex,
                 float handleSize)
Creates a new Scrollbar.

Parameters:
size - the size of the Scrollbar
direction - the scroll-direction
backgroundTex - the background image
handleTex - the handle image
handleSize - the handle size

Scrollbar

public Scrollbar(float width,
                 float height,
                 Scrollbar.Direction direction,
                 Texture backgroundTex,
                 Texture handleTex,
                 float handleSize)
Creates a new Scrollbar.

Parameters:
width - the width of the Scrollbar
height - the height of the Scrollbar
direction - the scroll-direction
backgroundTex - the background image
handleTex - the handle image
handleSize - the handle size

Scrollbar

public Scrollbar(org.openmali.types.twodee.Sized2fRO size,
                 Scrollbar.Direction direction,
                 Texture backgroundTex,
                 Texture handleTex)
Creates a new Scrollbar.

Parameters:
size - the size of the Scrollbar
direction - the scroll-direction
backgroundTex - the background image
handleTex - the handle image

Scrollbar

public Scrollbar(float width,
                 float height,
                 Scrollbar.Direction direction,
                 Texture backgroundTex,
                 Texture handleTex)
Creates a new Scrollbar.

Parameters:
width - the width of the Scrollbar
height - the height of the Scrollbar
direction - the scroll-direction
backgroundTex - the background image
handleTex - the handle image

Scrollbar

public Scrollbar(org.openmali.types.twodee.Sized2fRO size,
                 int zIndex,
                 Scrollbar.Direction direction,
                 java.lang.String backgroundTex,
                 java.lang.String handleTex)
Creates a new Scrollbar.

Parameters:
size - the size of the Scrollbar
zIndex - the z-index of the Scrollbar
direction - the scroll-direction
backgroundTex - the background image
handleTex - the handle image

Scrollbar

public Scrollbar(float width,
                 float height,
                 int zIndex,
                 Scrollbar.Direction direction,
                 java.lang.String backgroundTex,
                 java.lang.String handleTex)
Creates a new Scrollbar.

Parameters:
width - the width of the Scrollbar
height - the height of the Scrollbar
zIndex - the z-index of the Scrollbar
direction - the scroll-direction
backgroundTex - the background image
handleTex - the handle image

Scrollbar

public Scrollbar(org.openmali.types.twodee.Sized2fRO size,
                 int zIndex,
                 Scrollbar.Direction direction,
                 Texture backgroundTex,
                 Texture handleTex)
Creates a new Scrollbar.

Parameters:
size - the size of the Scrollbar
zIndex - the z-index of the Scrollbar
direction - the scroll-direction
backgroundTex - the background image
handleTex - the handle image

Scrollbar

public Scrollbar(float width,
                 float height,
                 int zIndex,
                 Scrollbar.Direction direction,
                 Texture backgroundTex,
                 Texture handleTex)
Creates a new Scrollbar.

Parameters:
width - the width of the Scrollbar
height - the height of the Scrollbar
zIndex - the z-index of the Scrollbar
direction - the scroll-direction
backgroundTex - the background image
handleTex - the handle image

Scrollbar

public Scrollbar(float width,
                 float height,
                 int zIndex,
                 Scrollbar.Direction direction,
                 java.lang.String backgroundTex,
                 java.lang.String handleTex,
                 float handleSize)
Creates a new Scrollbar.

Parameters:
width - the width of the Scrollbar
height - the height of the Scrollbar
zIndex - the z-index of the Scrollbar
direction - the scroll-direction
backgroundTex - the background image
handleTex - the handle image
handleSize - the handle size

Scrollbar

public Scrollbar(org.openmali.types.twodee.Sized2fRO size,
                 int zIndex,
                 Scrollbar.Direction direction,
                 java.lang.String backgroundTex,
                 java.lang.String handleTex,
                 float handleSize)
Creates a new Scrollbar.

Parameters:
size - the size of the Scrollbar
zIndex - the z-index of the Scrollbar
direction - the scroll-direction
backgroundTex - the background image
handleTex - the handle image
handleSize - the handle size

Scrollbar

public Scrollbar(float width,
                 float height,
                 int zIndex,
                 Scrollbar.Direction direction,
                 Texture backgroundTex,
                 Texture handleTex,
                 float handleSize)
Creates a new Scrollbar.

Parameters:
width - the width of the Scrollbar
height - the height of the Scrollbar
zIndex - the z-index of the Scrollbar
direction - the scroll-direction
backgroundTex - the background image
handleTex - the handle image
handleSize - the handle size

Scrollbar

public Scrollbar(org.openmali.types.twodee.Sized2fRO size,
                 int zIndex,
                 Scrollbar.Direction direction,
                 Texture backgroundTex,
                 Texture handleTex,
                 float handleSize)
Creates a new Scrollbar.

Parameters:
size - the size of the Scrollbar
zIndex - the z-index of the Scrollbar
direction - the scroll-direction
backgroundTex - the background image
handleTex - the handle image
handleSize - the handle size

Scrollbar

public Scrollbar(float length,
                 Scrollbar.Description sbDesc)
Creates a new Scrollbar.

Parameters:
length - the length of the Scrollbar
sbDesc - a ScrollbarDescription instance holding information about this new Scrollbar
Method Detail

getTransparency

public float getTransparency()

Returns:
the whole Widget's Transparency.

getDirection

public final Scrollbar.Direction getDirection()
Returns:
the direction in which the Scrollbar scrolls

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

setLower

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


getLower

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

setUpper

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


getUpper

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

setSmallIncrement

public void setSmallIncrement(int value)
Sets the step to increment the Scrollbar's value by when the increment button is clicked.


getSmallIncrement

public final int getSmallIncrement()
Returns:
the step to increment the Scrollbar's value by when the increment button is clicked

setValue

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


getValue

public final int getValue()
Returns:
the current scroll value

addScrollbarListener

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

Parameters:
l - the new ScrollbarListener

removeScrollbarListener

public boolean removeScrollbarListener(ScrollbarListener l)
Removes a ScrollbarListener from the List.

Parameters:
l - the ScrollbarListener to be removed

setSmoothScrolling

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

Parameters:
b - enable/disable

isSmoothScrolling

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

link

public void link(WidgetContainer container)
Links this ScrollBar with the given WidgetContainer.

Parameters:
container - the WidgetContainer to link with the Scrollbar

link

public void link(WidgetContainer container,
                 float scale)
Links this ScrollBar with the given WidgetContainer.

Parameters:
container - the WidgetContainer to link with the Scrollbar
scale - the factor to multiply the Scrollbar-value by before applying it to the offset value of the container

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