com.hdcookbook.grin.input
Class RCHandler

java.lang.Object
  extended by com.hdcookbook.grin.input.RCHandler
Direct Known Subclasses:
CommandRCHandler, VisualRCHandler

public abstract class RCHandler
extends java.lang.Object

Superclass for remote control keypress handlers. Some also handle mouse events.

Author:
Bill Foote (http://jovial.com)

Field Summary
protected  java.lang.String name
           
protected  Show show
           
 
Constructor Summary
RCHandler()
           
 
Method Summary
abstract  void activate(Segment s)
          Called for handlers in s when s is activated
 java.lang.String getName()
          Returns the name of this RCHandler, if known.
abstract  boolean handleKeyPressed(RCKeyEvent ke, Show caller)
          Handle a remote control key press.
abstract  boolean handleKeyReleased(RCKeyEvent ke, Show caller)
          Handle a remote control key release.
abstract  boolean handleKeyTyped(RCKeyEvent ke, Show caller)
          Handle a key typed event.
abstract  boolean handleMouse(int x, int y, boolean activate)
           
abstract  void nextFrame()
          Called by the show to let us know as the model progresses through time.
 void setName(java.lang.String name)
           
 void setShow(Show show)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

show

protected Show show

name

protected java.lang.String name
Constructor Detail

RCHandler

public RCHandler()
Method Detail

setShow

public void setShow(Show show)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getName

public java.lang.String getName()
Returns the name of this RCHandler, if known. All public handlers have names; private handlers might not.


setName

public void setName(java.lang.String name)

handleKeyPressed

public abstract boolean handleKeyPressed(RCKeyEvent ke,
                                         Show caller)
Handle a remote control key press. This is called on the animation thread, at a time when it's safe to modify the scene graph. The show lock will be held, and the show won't be between a call to addDisplayAreas() and paintFrame().

Returns:
true if the keypress is used

handleKeyReleased

public abstract boolean handleKeyReleased(RCKeyEvent ke,
                                          Show caller)
Handle a remote control key release. This is not supported on all devices. This is called on the animation thread, at a time when it's safe to modify the scene graph. The show lock will be held, and the show won't be between a call to addDisplayAreas() and paintFrame().

Returns:
true if the keypress is used

handleKeyTyped

public abstract boolean handleKeyTyped(RCKeyEvent ke,
                                       Show caller)
Handle a key typed event. Key typed events can be part of a GRIN extension; see the protected constructor of RCKeyEvent for details. This is called on the animatino thread when it's safe to modify the scene graph. The show lock will be held, and the show won't be between a call to addDisplayAreas() and paintFrame().

Returns:
true if the keypress is used

handleMouse

public abstract boolean handleMouse(int x,
                                    int y,
                                    boolean activate)
Returns:
true if something is done with the mouse

activate

public abstract void activate(Segment s)
Called for handlers in s when s is activated


nextFrame

public abstract void nextFrame()
Called by the show to let us know as the model progresses through time. This can be useful for things like timeouts.