org.xith3d.ui.hud.utils
Class ButtonGroup

java.lang.Object
  extended by org.xith3d.ui.hud.utils.ButtonGroup

public class ButtonGroup
extends java.lang.Object

This class can be used to group StateButton Widgets. Only one StateButton in the group can have an ACTIVATED state.

The attached WidgetStateListeners are only notified for the StateButton, that has been activated, but not for the one, that has been deactivated (automatically).


Constructor Summary
ButtonGroup()
          Creates a new ButtonGroup.
 
Method Summary
 void addStateButton(StateButton button)
          Adds a new StateButton to this group.
 void addStateListener(WidgetStateListener listener)
          Adds a WidgetStateListener.
protected  void notifyListeners(StateButton button)
          Notifies all added listeners about a state event.
 void onButtonActivated(StateButton button)
          This method is invoked by the appropriate event in the StateButton class.
 void removeStateButton(StateButton button)
          Removes a StateButton from this group.
 void removeStateListener(WidgetStateListener listener)
          Removes a WidgetStateListener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ButtonGroup

public ButtonGroup()
Creates a new ButtonGroup.

Method Detail

addStateListener

public void addStateListener(WidgetStateListener listener)
Adds a WidgetStateListener.

Parameters:
listener - org.xith3d.ui.hud.listeners.WidgetStateListener - the listener to add.

removeStateListener

public void removeStateListener(WidgetStateListener listener)
Removes a WidgetStateListener.

Parameters:
listener - org.xith3d.ui.hud.listeners.WidgetStateListener - the listener to remove.

notifyListeners

protected final void notifyListeners(StateButton button)
Notifies all added listeners about a state event.

Parameters:
button - org.xith3d.ui.hud.base.StateButton - the button whose state just changed.

onButtonActivated

public void onButtonActivated(StateButton button)
This method is invoked by the appropriate event in the StateButton class. It will deactivate the currently activated StateButton.

Parameters:
button - org.xith3d.ui.hud.base.StateButton - the new activated StateButton

addStateButton

public void addStateButton(StateButton button)
Adds a new StateButton to this group.

Parameters:
button - org.xith3d.ui.hud.base.StateButton - the StateButton to add to this group.

removeStateButton

public void removeStateButton(StateButton button)
Removes a StateButton from this group.

Parameters:
button - org.xith3d.ui.hud.base.StateButton - the StateButton to remove.