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

java.lang.Object
  extended by net.sf.fmj.ejmf.toolkit.gui.controls.AbstractListenerControl
All Implemented Interfaces:
Control
Direct Known Subclasses:
ActionListenerControl, ChangeListenerControl, MouseListenerControl

public abstract class AbstractListenerControl
extends java.lang.Object
implements Control

An AbstractListenerControl provides a Component-Listener model for Controls, allowing the two elements to be changed independently of each other.

This is the root class from which all EJMF control panel controls extend.

Subclasses must implement these methods:


Field Summary
protected  Skin skin
           
 
Constructor Summary
protected AbstractListenerControl(Skin skin)
          Create an AbstractListenerControl
protected AbstractListenerControl(Skin skin, Controller controller)
          Create an AbstractListenerControl
 
Method Summary
protected abstract  void addControlListener(java.util.EventListener listener)
          Since different controls may have different types of listeners, each subclass should define addControlListener to register the correct type of listener with component.
protected abstract  java.awt.Component createControlComponent(Skin skin)
          Subclasses defined this method to supply their GUI component.
protected abstract  java.util.EventListener createControlListener()
          Subclasses of AbstractListenerControl must define this method to supply an EventListener to handle events originating from control's component.
 java.awt.Component getControlComponent()
          Return Control Component as required by Control inteface.
 Controller getController()
           
protected  java.util.EventListener getDefaultControlListener()
           
protected  void initListener(java.util.EventListener listener)
          Initializes listener, establishes it as default and registers it with Control Compoent.
 boolean isOperational()
          Return the operational state of this Control.
protected abstract  void removeControlListener(java.util.EventListener listener)
          Since different controls may have different types of listeners, each subclass should define removeControlListener to remove listener from component listener list in a type-safe way.
protected  void setComponent(java.awt.Component component)
          Set the GUI component associated with this Control.
protected  void setComponentAndListener(java.awt.Component component, java.util.EventListener listener)
          Set both GUI component and control listener associated with this Control.
 void setController(Controller controller)
          Associates Controller with this Control.
protected  void setControllerHook(Controller controller)
          Subclasses override and provide the guts to setControllerHook if they want to augment the the work of setController.
protected  void setControlListener(java.util.EventListener listener)
          Set the control listener associated with this Control.
protected  void setOperational(boolean flag)
          Set the operational state of this Control.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

skin

protected final Skin skin
Constructor Detail

AbstractListenerControl

protected AbstractListenerControl(Skin skin)
Create an AbstractListenerControl


AbstractListenerControl

protected AbstractListenerControl(Skin skin,
                                  Controller controller)
Create an AbstractListenerControl

Parameters:
controller - Controller with which this control is associated.
Method Detail

setController

public void setController(Controller controller)
Associates Controller with this Control.

Parameters:
controller - Controller with which this control is associated.
Throws:
java.lang.IllegalArgumentException - is thrown if attempt is made to set Controller a second time.

setControllerHook

protected void setControllerHook(Controller controller)
Subclasses override and provide the guts to setControllerHook if they want to augment the the work of setController.

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

initListener

protected void initListener(java.util.EventListener listener)
Initializes listener, establishes it as default and registers it with Control Compoent.

Parameters:
listener - Listener object for this control

getControlComponent

public java.awt.Component getControlComponent()
Return Control Component as required by Control inteface.

Specified by:
getControlComponent in interface Control
Returns:
Control component

setControlListener

protected void setControlListener(java.util.EventListener listener)
Set the control listener associated with this Control.

Subclasses should override this method to provide a type-safe public version.

Parameters:
listener - Listener object for this control

setComponent

protected void setComponent(java.awt.Component component)
Set the GUI component associated with this Control.

Subclasses should override this method to provide a type-safe public version.

Parameters:
component - Component to associate with this control.

setComponentAndListener

protected void setComponentAndListener(java.awt.Component component,
                                       java.util.EventListener listener)
Set both GUI component and control listener associated with this Control.

Subclasses should override this method to provide a type-safe public version.

Parameters:
component - Component to associate with this control.
listener - Listener object for this control

getDefaultControlListener

protected java.util.EventListener getDefaultControlListener()
Returns:
the default listener for this Control.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
fully-qualified class name. This value can be used as search key in response to Controller.getControl(name)

createControlListener

protected abstract java.util.EventListener createControlListener()
Subclasses of AbstractListenerControl must define this method to supply an EventListener to handle events originating from control's component.

Subclasses must not return a null listener.

Returns:
an EventListener

createControlComponent

protected abstract java.awt.Component createControlComponent(Skin skin)
Subclasses defined this method to supply their GUI component. Subclasses must not return a null component.

Listener registration is handled by AbstractListenerControl.

Returns:
a Component

addControlListener

protected abstract void addControlListener(java.util.EventListener listener)
Since different controls may have different types of listeners, each subclass should define addControlListener to register the correct type of listener with component.

Parameters:
listener - Listener object to be added.

removeControlListener

protected abstract void removeControlListener(java.util.EventListener listener)
Since different controls may have different types of listeners, each subclass should define removeControlListener to remove listener from component listener list in a type-safe way.

Parameters:
listener - Listener object to be removed.

setOperational

protected void setOperational(boolean flag)
Set the operational state of this Control.

Parameters:
flag - Set to true to make control operational.

isOperational

public boolean isOperational()
Return the operational state of this Control.

Returns:
true if control is operational

getController

public Controller getController()
Returns:
associated Controller.