org.xith3d.ui.hud.listeners
Class WidgetEventsReceiverAdapter

java.lang.Object
  extended by org.xith3d.ui.hud.listeners.WidgetEventsReceiverAdapter
All Implemented Interfaces:
ButtonListener, DialogListener, ListSelectionListener, ScrollbarListener, SliderListener, WidgetContainerListener, WidgetControllerListener, WidgetFocusListener, WidgetInputListener, WidgetKeyboardListener, WidgetLocationListener, WidgetMouseListener, WidgetSizeListener, WidgetStateListener, WidgetVisibilityListener, WindowListener

public abstract class WidgetEventsReceiverAdapter
extends java.lang.Object
implements WidgetInputListener, WidgetFocusListener, WidgetLocationListener, WidgetSizeListener, WidgetVisibilityListener, WidgetContainerListener, ButtonListener, WidgetStateListener, ListSelectionListener, ScrollbarListener, SliderListener, WindowListener, DialogListener

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
WidgetEventsReceiverAdapter()
           
 
Method Summary
 void onButtonClicked(AbstractButton button, java.lang.Object userObject)
          This event is fired when a Button was clicked.
 void onButtonStateChanged(StateButton stateButton, boolean state, java.lang.Object userObject)
          This event will be fired when a StateButton's state has changed.
 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 onDialogClosed(Dialog dialog, java.lang.Object closeCommand)
          This event is fired when a Dialog is closed.
 void onFocusGained(Widget widget)
          This event is fired, when the focus is gained to a Widget.
 void onFocusLost(Widget widget)
          This event is fired, when the focus is lost by a Widget.
 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 onListItemClicked(AbstractList list, java.lang.Object item, int itemIndex)
          This event is fired, when a List Item is clicked.
 void onListSelectionChanged(AbstractList list, java.lang.Object oldSelectedItem, java.lang.Object newSelectedItem, int oldSelectedIndex, int newSelectedIndex)
          This event is fired, when the List's selection has changed.
 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.
 void onScrollbarValueChanged(Scrollbar scrollbar, int newValue)
          This event is fired when the value of a Scrollbar has changed.
 void onSliderValueChanged(Slider slider, int newValue)
          This event is fired when the value of a Slider has changed.
 void onWidgetAttachedToContainer(Widget widget, WidgetContainer container)
          This event is fired, when a Widget is added to a WidgetContainer.
 void onWidgetAttachedToHUD(Widget widget, HUD hud)
          This event is fired, when a Widget is added to a WidgetContainer and the container itself is already added to the HUD or is the HUD itself.
 void onWidgetDetachedFromContainer(Widget widget, WidgetContainer container)
          This event is fired, when a Widget is removed from a WidgetContainer.
 void onWidgetDetachedFromHUD(Widget widget, HUD hud)
          This event is fired, when a Widget is removed from a HUD.
 void onWidgetDragStarted(Widget widget)
          This event is fired when a Widget is started to be dragged.
 void onWidgetDragStopped(Widget widget)
          This event is fired when a Widget is stopped to be dragged.
 void onWidgetLocationChanged(Widget widget, float oldLeft, float oldTop, float newLeft, float newTop)
          This event is fired when a Widget's location has changed.
 void onWidgetSizeChanged(Widget widget, float oldWidth, float oldHeight, float newWidth, float newHeight)
          This event is fired when a Widget's size has changed.
 void onWidgetVisibilityChanged(Widget widget, boolean isVisible)
          This event is fired when a Widget's visibility state has changed.
 void onWindowClosed(Window frame)
          This event is fired when a Window is closed.
 void onWindowHidden(Window frame)
          This event is fired when a Window is set invisible.
 void onWindowShown(Window frame)
          This event is fired when a Window is set visible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WidgetEventsReceiverAdapter

public WidgetEventsReceiverAdapter()
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)
Description copied from interface: WidgetKeyboardListener
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

onFocusGained

public void onFocusGained(Widget widget)
This event is fired, when the focus is gained to a Widget.

Specified by:
onFocusGained in interface WidgetFocusListener
Parameters:
widget - the Widget, which was gained the focus

onFocusLost

public void onFocusLost(Widget widget)
This event is fired, when the focus is lost by a Widget.

Specified by:
onFocusLost in interface WidgetFocusListener
Parameters:
widget - the Widget, which has lost the focus

onWidgetDragStarted

public void onWidgetDragStarted(Widget widget)
This event is fired when a Widget is started to be dragged.

Specified by:
onWidgetDragStarted in interface WidgetLocationListener
Parameters:
widget - the Widget, which is dragged

onWidgetDragStopped

public void onWidgetDragStopped(Widget widget)
This event is fired when a Widget is stopped to be dragged.

Specified by:
onWidgetDragStopped in interface WidgetLocationListener
Parameters:
widget - the Widget, which was dragged

onWidgetLocationChanged

public void onWidgetLocationChanged(Widget widget,
                                    float oldLeft,
                                    float oldTop,
                                    float newLeft,
                                    float newTop)
This event is fired when a Widget's location has changed.

Specified by:
onWidgetLocationChanged in interface WidgetLocationListener
Parameters:
widget - the Widget, which's location has changed
oldLeft - the old left coordinate of the Widget
oldTop - the old top coordinate of the Widget
newLeft - the new left coordinate of the Widget
newTop - the new top coordinate of the Widget

onWidgetSizeChanged

public void onWidgetSizeChanged(Widget widget,
                                float oldWidth,
                                float oldHeight,
                                float newWidth,
                                float newHeight)
This event is fired when a Widget's size has changed.

Specified by:
onWidgetSizeChanged in interface WidgetSizeListener
Parameters:
widget - the Widget, which's size has changed
oldWidth - the new width of the Widget
oldHeight - the new height of the Widget
newWidth - the new width of the Widget
newHeight - the new height of the Widget

onWidgetVisibilityChanged

public void onWidgetVisibilityChanged(Widget widget,
                                      boolean isVisible)
This event is fired when a Widget's visibility state has changed.

Specified by:
onWidgetVisibilityChanged in interface WidgetVisibilityListener

onWidgetAttachedToContainer

public void onWidgetAttachedToContainer(Widget widget,
                                        WidgetContainer container)
This event is fired, when a Widget is added to a WidgetContainer.

Specified by:
onWidgetAttachedToContainer in interface WidgetContainerListener
Parameters:
widget - the Widget, which is added to a WidgetContainer
container - the WidgetContainer, the Widget is added to

onWidgetDetachedFromContainer

public void onWidgetDetachedFromContainer(Widget widget,
                                          WidgetContainer container)
This event is fired, when a Widget is removed from a WidgetContainer.

Specified by:
onWidgetDetachedFromContainer in interface WidgetContainerListener
Parameters:
widget - the Widget, which is removed from a WidgetContainer
container - the WidgetContainer, the Widget is removed from

onWidgetAttachedToHUD

public void onWidgetAttachedToHUD(Widget widget,
                                  HUD hud)
This event is fired, when a Widget is added to a WidgetContainer and the container itself is already added to the HUD or is the HUD itself.

Specified by:
onWidgetAttachedToHUD in interface WidgetContainerListener
Parameters:
widget - the Widget, which is added to a WidgetContainer
hud - the HUD, the Widget is added to

onWidgetDetachedFromHUD

public void onWidgetDetachedFromHUD(Widget widget,
                                    HUD hud)
This event is fired, when a Widget is removed from a HUD.

Specified by:
onWidgetDetachedFromHUD in interface WidgetContainerListener
Parameters:
widget - the Widget, which is removed from a HUD
hud - the HUD, the Widget is removed from

onButtonClicked

public void onButtonClicked(AbstractButton button,
                            java.lang.Object userObject)
This event is fired when a Button was clicked.

Specified by:
onButtonClicked in interface ButtonListener
Parameters:
button - the clicked Button
userObject - the Button's userObject

onButtonStateChanged

public void onButtonStateChanged(StateButton stateButton,
                                 boolean state,
                                 java.lang.Object userObject)
This event will be fired when a StateButton's state has changed.

Specified by:
onButtonStateChanged in interface WidgetStateListener
Parameters:
stateButton - the StateButton, which's state has changed
state - the new state
userObject - the StateButton's user-object

onListSelectionChanged

public void onListSelectionChanged(AbstractList list,
                                   java.lang.Object oldSelectedItem,
                                   java.lang.Object newSelectedItem,
                                   int oldSelectedIndex,
                                   int newSelectedIndex)
This event is fired, when the List's selection has changed.

Specified by:
onListSelectionChanged in interface ListSelectionListener
Parameters:
list - the list, that fired this event
oldSelectedItem - the pre-event selected Item
newSelectedItem - the new current selected Item
oldSelectedIndex - the pre-event selected index
newSelectedIndex - the new current selected index

onListItemClicked

public void onListItemClicked(AbstractList list,
                              java.lang.Object item,
                              int itemIndex)
This event is fired, when a List Item is clicked.

Specified by:
onListItemClicked in interface ListSelectionListener
Parameters:
list - the list, that fired this event
item - the clicked Item

onScrollbarValueChanged

public void onScrollbarValueChanged(Scrollbar scrollbar,
                                    int newValue)
This event is fired when the value of a Scrollbar has changed.

Specified by:
onScrollbarValueChanged in interface ScrollbarListener
Parameters:
scrollbar - the Scrollbar, which's value has changed
newValue - the new (current) value of the Scrollbar

onSliderValueChanged

public void onSliderValueChanged(Slider slider,
                                 int newValue)
This event is fired when the value of a Slider has changed.

Specified by:
onSliderValueChanged in interface SliderListener
Parameters:
slider - the Slider, which's value has changed
newValue - the new (current) value of the Slider

onWindowClosed

public void onWindowClosed(Window frame)
This event is fired when a Window is closed.

Specified by:
onWindowClosed in interface WindowListener
Parameters:
frame - the closed Window

onWindowHidden

public void onWindowHidden(Window frame)
This event is fired when a Window is set invisible.

Specified by:
onWindowHidden in interface WindowListener
Parameters:
frame - the hidden Window

onWindowShown

public void onWindowShown(Window frame)
This event is fired when a Window is set visible.

Specified by:
onWindowShown in interface WindowListener
Parameters:
frame - the shown Window

onDialogClosed

public void onDialogClosed(Dialog dialog,
                           java.lang.Object closeCommand)
This event is fired when a Dialog is closed.

Specified by:
onDialogClosed in interface DialogListener
Parameters:
dialog - the Dialog that was closed
closeCommand - the close-command