org.xith3d.ui.hud.utils
Class WidgetMover

java.lang.Object
  extended by org.xith3d.ui.hud.utils.WidgetMover
All Implemented Interfaces:
WidgetWrapper
Direct Known Subclasses:
MouseHoverWidgetMover

public class WidgetMover
extends java.lang.Object
implements WidgetWrapper

A WidgetMover interpolatedly moves a Widget from its current location to a destination location.


Constructor Summary
WidgetMover(Widget widget)
          Creates a new WidgetMover for the given Widget and destination location.
WidgetMover(Widget widget, float destX, float destY, float speed)
          Creates a new WidgetMover for the given Widget and destination location.
WidgetMover(Widget widget, org.openmali.vecmath2.Tuple2f destLocation, float speed)
          Creates a new WidgetMover for the given Widget and destination location.
 
Method Summary
 org.openmali.vecmath2.Tuple2f getDestinationLocation()
           
 float getDestinationLocationX()
           
 float getDestinationLocationY()
           
 float getSpeed()
           
 org.openmali.vecmath2.Tuple2f getStartLocation()
           
 float getStartLocationX()
           
 float getStartLocationY()
           
 Widget getWidget()
          
 void invert()
           
 boolean isMoving()
           
protected  void onMovementStopped()
          This method is invoked when the Widget has reached its destination location.
 void setDestinationLocation(float destLocationX, float destLocationY)
          Sets the Widget's destination location for the movement.
 void setDestinationLocation(org.openmali.vecmath2.Tuple2f destLocation)
          Sets the Widget's destination location for the movement.
 void setSpeed(float speed)
          Sets the speed for the movement (in units per second).
 void startMoving()
          Starts the movement from the Widget's current location to the destination location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WidgetMover

public WidgetMover(Widget widget,
                   float destX,
                   float destY,
                   float speed)
Creates a new WidgetMover for the given Widget and destination location.

Parameters:
widget - the Widget to be moved
destX - the destination location x-coordinate
destY - the destination location y-coordinate
speed - the speed for the movement (in units per second)

WidgetMover

public WidgetMover(Widget widget,
                   org.openmali.vecmath2.Tuple2f destLocation,
                   float speed)
Creates a new WidgetMover for the given Widget and destination location.

Parameters:
widget - the Widget to be moved
destLocation - the destination location
speed - the speed for the movement (in units per second)

WidgetMover

public WidgetMover(Widget widget)
Creates a new WidgetMover for the given Widget and destination location.

Parameters:
widget - the Widget to be moved
Method Detail

getWidget

public Widget getWidget()

Specified by:
getWidget in interface WidgetWrapper
Returns:
the held Widget

getStartLocation

public org.openmali.vecmath2.Tuple2f getStartLocation()
Returns:
the Widget's start location of the current the movement. The returned values are invalid, if the Widget isn't currently moving.

getStartLocationX

public float getStartLocationX()
Returns:
the Widget's start x-location of the current the movement. The returned value is invalid, if the Widget isn't currently moving.

getStartLocationY

public float getStartLocationY()
Returns:
the Widget's start y-location of the current the movement. The returned value is invalid, if the Widget isn't currently moving.

setDestinationLocation

public void setDestinationLocation(org.openmali.vecmath2.Tuple2f destLocation)
Sets the Widget's destination location for the movement.

Parameters:
destLocation -

setDestinationLocation

public void setDestinationLocation(float destLocationX,
                                   float destLocationY)
Sets the Widget's destination location for the movement.

Parameters:
destLocationX -
destLocationY -

getDestinationLocation

public org.openmali.vecmath2.Tuple2f getDestinationLocation()
Returns:
the Widget's destination location for the movement

getDestinationLocationX

public float getDestinationLocationX()
Returns:
the Widget's destination x-location for the movement

getDestinationLocationY

public float getDestinationLocationY()
Returns:
the Widget's destination y-location for the movement

setSpeed

public void setSpeed(float speed)
Sets the speed for the movement (in units per second).

Parameters:
speed -

getSpeed

public float getSpeed()
Returns:
the speed for the movement (in units per second)

startMoving

public void startMoving()
Starts the movement from the Widget's current location to the destination location.


isMoving

public boolean isMoving()
Returns:
true, if the WidgetMover is currently active

onMovementStopped

protected void onMovementStopped()
This method is invoked when the Widget has reached its destination location.


invert

public void invert()