net.sf.fmj.ejmf.toolkit.gui.controls
Class StandardGainControl

java.lang.Object
  extended by net.sf.fmj.ejmf.toolkit.gui.controls.AbstractListenerControl
      extended by net.sf.fmj.ejmf.toolkit.gui.controls.ActionListenerControl
          extended by net.sf.fmj.ejmf.toolkit.gui.controls.AbstractGainControl
              extended by net.sf.fmj.ejmf.toolkit.gui.controls.StandardGainControl
All Implemented Interfaces:
Control, GainChangeListener

public class StandardGainControl
extends AbstractGainControl
implements GainChangeListener

Gain Control for Standard Control Panel. Provides two Components, one each for increasing and decreasing gain.

See Also:
AbstractGainControl

Field Summary
 
Fields inherited from class net.sf.fmj.ejmf.toolkit.gui.controls.AbstractListenerControl
skin
 
Constructor Summary
StandardGainControl(Skin skin)
          Create a StandardGainControl
StandardGainControl(Skin skin, Controller controller)
          Create a StandardGainControl and associate it with a Controller.
 
Method Summary
protected  void addControlListener(java.util.EventListener listener)
          Over-rides addControlListener from AbstractActionListener because this Component is a JPanel and buttons need to be extracted from it.
protected  java.awt.Component createControlComponent(Skin skin)
          Create Control Component for Gain Control.
protected  java.util.EventListener createControlListener()
          Create and return the default listener for gain control.
 void gainChange(GainChangeEvent e)
          Set enable state of gain buttons based on gain level.
protected  void removeControlListener(java.util.EventListener listener)
          Remove listener from both gain increase button and gain decrease button.
 void setComponent(AbstractGainButtonPanel bp)
          Type-safe way to set Control Component.
 void setComponentAndListener(AbstractGainButtonPanel bp, java.awt.event.ActionListener listener)
          Type-safe way to set Control Component and control listener.
protected  void setControllerHook(Controller newController)
          This method is called when setController is called on an AbstractListenerControl.
 void setControlListener(java.awt.event.ActionListener listener)
          Type-safe way to set Control listener.
 
Methods inherited from class net.sf.fmj.ejmf.toolkit.gui.controls.AbstractGainControl
getGainControl
 
Methods inherited from class net.sf.fmj.ejmf.toolkit.gui.controls.ActionListenerControl
setComponent, setComponentAndListener
 
Methods inherited from class net.sf.fmj.ejmf.toolkit.gui.controls.AbstractListenerControl
getControlComponent, getController, getDefaultControlListener, initListener, isOperational, setComponent, setComponentAndListener, setController, setControlListener, setOperational, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StandardGainControl

public StandardGainControl(Skin skin,
                           Controller controller)
Create a StandardGainControl and associate it with a Controller.

Parameters:
controller - A Controller with which control is associated.

StandardGainControl

public StandardGainControl(Skin skin)
Create a StandardGainControl

Method Detail

setControllerHook

protected void setControllerHook(Controller newController)
This method is called when setController is called on an AbstractListenerControl.

Overrides:
setControllerHook in class AbstractGainControl
Parameters:
newController - A Controller with which this control is associated.

createControlComponent

protected java.awt.Component createControlComponent(Skin skin)
Create Control Component for Gain Control.

Specified by:
createControlComponent in class AbstractListenerControl
Returns:
component which acts as gain control.

addControlListener

protected void addControlListener(java.util.EventListener listener)
Over-rides addControlListener from AbstractActionListener because this Component is a JPanel and buttons need to be extracted from it. Same listener is posted to both buttons.

Overrides:
addControlListener in class ActionListenerControl
Parameters:
listener - Listener that implements semantics for gain control.

removeControlListener

protected void removeControlListener(java.util.EventListener listener)
Remove listener from both gain increase button and gain decrease button.

Overrides:
removeControlListener in class ActionListenerControl
Parameters:
listener - Listener is removed from listener list associated with this control.

createControlListener

protected java.util.EventListener createControlListener()
Create and return the default listener for gain control. Default listener increases gain level by 0.1 for each click of up button and decreases gain level by 0.1 for each click of down button.

Specified by:
createControlListener in class AbstractListenerControl
Returns:
Default listener for gain control.

gainChange

public void gainChange(GainChangeEvent e)
Set enable state of gain buttons based on gain level. If level has reached maximum, disable increase button. If level has reached minimum, enable descrease button.

Specified by:
gainChange in interface GainChangeListener
Parameters:
e - An GainChangeEvent triggerd by a GainControl
See Also:
GainControl, GainChangeEvent

setComponentAndListener

public void setComponentAndListener(AbstractGainButtonPanel bp,
                                    java.awt.event.ActionListener listener)
Type-safe way to set Control Component and control listener.

Parameters:
bp - An AbstractGainButtonPanel that serves as Control component.
listener - An ActionListener that implements Control semantics.

setComponent

public void setComponent(AbstractGainButtonPanel bp)
Type-safe way to set Control Component.

Parameters:
bp - An AbstractGainButtonPanel that serves as Control component.

setControlListener

public void setControlListener(java.awt.event.ActionListener listener)
Type-safe way to set Control listener.

Overrides:
setControlListener in class ActionListenerControl
Parameters:
listener - An ActionListener that implements gain control button semantics.