org.xith3d.ui.hud.listeners
Class WidgetInputAdapter

java.lang.Object
  extended by org.xith3d.ui.hud.listeners.WidgetInputAdapter
All Implemented Interfaces:
WidgetControllerListener, WidgetInputListener, WidgetKeyboardListener, WidgetMouseListener

public abstract class WidgetInputAdapter
extends java.lang.Object
implements WidgetInputListener

If a Widget makes use of other Widgets to be built and these Widgets produce events, that are to be catched be the Widget only, then you should create an inner class and let it extend this class to catch them, since it already implements all known Widget-Listeners (with empty method stubs).


Constructor Summary
WidgetInputAdapter()
           
 
Method Summary
 void onControllerAxisChanged(Widget widget, org.jagatoo.input.devices.components.ControllerAxis axis, float axisDelta, long when)
          This event is fired when a ControllerAxis has changed and this Widget is the currently focussed one.
 void onControllerButtonPressed(Widget widget, org.jagatoo.input.devices.components.ControllerButton button, long when)
          This event is fired when a ControllerButton has been pressed and this Widget is the currently focussed one.
 void onControllerButtonReleased(Widget widget, org.jagatoo.input.devices.components.ControllerButton button, long when)
          This event is fired when a ControllerButton has been released and this Widget is the currently focussed one.
 void onInputStateChanged(Widget widget, org.jagatoo.input.devices.components.DeviceComponent comp, int delta, int state, long when, boolean isTopMost, boolean hasFocus)
          This event is fired when the state of any DeviceComponent has changed.
 void onKeyPressed(Widget widget, org.jagatoo.input.devices.components.Key key, int modifierMask, long when)
          This event is fired, when a key is pressed on a focused Widget.
 void onKeyReleased(Widget widget, org.jagatoo.input.devices.components.Key key, int modifierMask, long when)
          This event is fired, when a key is released on a focused Widget.
 void onKeyTyped(Widget widget, char ch, int modifierMask, long when)
          This event is fired when a key is typed on the keyboard.
 void onMouseButtonPressed(Widget widget, org.jagatoo.input.devices.components.MouseButton button, float x, float 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(Widget widget, org.jagatoo.input.devices.components.MouseButton button, float x, float y, long when, long lastWhen, boolean isTopMost, boolean hasFocus)
          This event is fired, when a mouse button is released on a focused Widget.
 void onMouseEntered(Widget widget, boolean isTopMost, boolean hasFocus)
          This method is called when the mouse entered the Widget area.
 void onMouseExited(Widget widget, boolean isTopMost, boolean hasFocus)
          This method is called when the mouse exited the Widget area.
 void onMouseMoved(Widget widget, float x, float y, int buttonsState, long when, boolean isTopMost, boolean hasFocus)
          This event is fired, when the mouse is moved on a Widget.
 void onMouseStopped(Widget widget, float x, float y, long when, boolean isTopMost, boolean hasFocus)
          This event is fired, when the mouse position has not been changed on this Widget for a certain amount of time.
 void onMouseWheelMoved(Widget widget, int delta, boolean isPageMove, float x, float y, long when, boolean isTopMost)
          This event is fired, when the mouse wheel is moved on a Widget.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WidgetInputAdapter

public WidgetInputAdapter()
Method Detail

onKeyPressed

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

Specified by:
onKeyPressed in interface WidgetKeyboardListener
Parameters:
widget - the Widget for which this event was fired
key - the key that was pressed
modifierMask - the mask of modifier keys
when - the gameTime of the key event

onKeyReleased

public void onKeyReleased(Widget widget,
                          org.jagatoo.input.devices.components.Key key,
                          int modifierMask,
                          long when)
This event is fired, when a key is released on a focused Widget.

Specified by:
onKeyReleased in interface WidgetKeyboardListener
Parameters:
widget - the Widget for which this event was fired
key - the key that was released
modifierMask - the mask of modifier keys
when - the gameTime of the key event

onKeyTyped

public void onKeyTyped(Widget widget,
                       char ch,
                       int modifierMask,
                       long when)
This event is fired when a key is typed on the keyboard.

Specified by:
onKeyTyped in interface WidgetKeyboardListener
Parameters:
widget - the Widget for which this event was fired
ch - the typed key's character
modifierMask - the mask of modifier keys
when - the gameTime of the key event

onMouseButtonPressed

public void onMouseButtonPressed(Widget widget,
                                 org.jagatoo.input.devices.components.MouseButton button,
                                 float x,
                                 float 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 WidgetMouseListener
Parameters:
widget - the Widget for which this event was fired
button - the button that was pressed
x - the current mouse x position
y - the current mouse y position
when - the gameTime of the mouse event
lastWhen - the milli-time when the button has last been pressed
isTopMost - is this Widget topMost
hasFocus - is this Widget focused

onMouseButtonReleased

public void onMouseButtonReleased(Widget widget,
                                  org.jagatoo.input.devices.components.MouseButton button,
                                  float x,
                                  float 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 WidgetMouseListener
Parameters:
widget - the Widget for which this event was fired
button - the button that was released
x - the current mouse x position
y - the current mouse y position
when - the gameTime of the mouse event
lastWhen - the milli-time when the button has last been released
isTopMost - is this Widget topMost
hasFocus - is this Widget focused

onMouseMoved

public void onMouseMoved(Widget widget,
                         float x,
                         float 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 WidgetMouseListener
Parameters:
widget - the Widget for which this event was fired
x - the new X coordinate
y - the new Y coordinate
buttonsState - the buttons' state bitmask
when - the gameTime of the mouse event
isTopMost - is this Widget topMost
hasFocus - is this Widget focused

onMouseStopped

public void onMouseStopped(Widget widget,
                           float x,
                           float y,
                           long when,
                           boolean isTopMost,
                           boolean hasFocus)
This event is fired, when the mouse position has not been changed on this Widget for a certain amount of time.

Specified by:
onMouseStopped in interface WidgetMouseListener
Parameters:
widget - the Widget for which this event was fired
x - the new X coordinate
y - the new Y coordinate
when - the gameTime of the mouse event
isTopMost - is this Widget topMost
hasFocus - is this Widget focused

onMouseWheelMoved

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

Specified by:
onMouseWheelMoved in interface WidgetMouseListener
Parameters:
widget - the Widget for which this event was fired
delta - a positive value when the wheel was moved up
isPageMove - true, if whole pages are to be scrolled with this wheel move
x - the current mouse x position
y - the current mouse y position
when - the gameTime of the mouse event
isTopMost - is this Widget topMost

onMouseEntered

public void onMouseEntered(Widget widget,
                           boolean isTopMost,
                           boolean hasFocus)
This method is called when the mouse entered the Widget area.

Specified by:
onMouseEntered in interface WidgetMouseListener
Parameters:
widget - the Widget for which this event was fired
isTopMost - is this Widget topMost
hasFocus - is this Widget focused

onMouseExited

public void onMouseExited(Widget widget,
                          boolean isTopMost,
                          boolean hasFocus)
This method is called when the mouse exited the Widget area.

Specified by:
onMouseExited in interface WidgetMouseListener
Parameters:
widget - the Widget for which this event was fired
isTopMost - is this Widget topMost
hasFocus - is this Widget focused

onControllerButtonPressed

public void onControllerButtonPressed(Widget widget,
                                      org.jagatoo.input.devices.components.ControllerButton button,
                                      long when)
This event is fired when a ControllerButton has been pressed and this Widget is the currently focussed one.

Specified by:
onControllerButtonPressed in interface WidgetControllerListener
Parameters:
widget - the Widget for which this event was fired
button - the pressed button
when - the gameTime of the event

onControllerButtonReleased

public void onControllerButtonReleased(Widget widget,
                                       org.jagatoo.input.devices.components.ControllerButton button,
                                       long when)
This event is fired when a ControllerButton has been released and this Widget is the currently focussed one.

Specified by:
onControllerButtonReleased in interface WidgetControllerListener
Parameters:
widget - the Widget for which this event was fired
button - the released button
when - the gameTime of the event

onControllerAxisChanged

public void onControllerAxisChanged(Widget widget,
                                    org.jagatoo.input.devices.components.ControllerAxis axis,
                                    float axisDelta,
                                    long when)
This event is fired when a ControllerAxis has changed and this Widget is the currently focussed one.

Specified by:
onControllerAxisChanged in interface WidgetControllerListener
Parameters:
widget - the Widget for which this event was fired
axis - the changed axis
when - the gameTime of the event

onInputStateChanged

public void onInputStateChanged(Widget widget,
                                org.jagatoo.input.devices.components.DeviceComponent comp,
                                int delta,
                                int state,
                                long when,
                                boolean isTopMost,
                                boolean hasFocus)
This event is fired when the state of any DeviceComponent has changed.

Specified by:
onInputStateChanged in interface WidgetControllerListener
Specified by:
onInputStateChanged in interface WidgetKeyboardListener
Specified by:
onInputStateChanged in interface WidgetMouseListener
Parameters:
widget - the Widget for which this event was fired
when - the gameTime of the event