edu.stanford.hci.r3.pen
Class PenInput

java.lang.Object
  extended by edu.stanford.hci.r3.pen.PenInput
Direct Known Subclasses:
Pen, PenSimulator

public abstract class PenInput
extends java.lang.Object

Applications need some way to get Pen Input. We can either provide this through the Pen class (which implements this as a digital streaming pen), OR we can simulate this with a graphics tablet.

This software is distributed under the BSD License.


Field Summary
protected  boolean liveMode
          TRUE if the PenInput object is currently connected to the underlying (physical or simulated) pen in streaming mode.
protected  java.util.List<PenListener> penListenersToAdd
          Cached pen listeners, so we can add them when/if you go live.
 
Constructor Summary
PenInput(java.lang.String penName)
           
 
Method Summary
 void addLivePenListener(PenListener penListener)
          Adds a low-level pen data listener to the live pen.
 java.lang.String getName()
           
 boolean isLive()
           
 void removeLivePenListener(PenListener penListener)
          Removes the pen listener from the live pen.
 void setName(java.lang.String nomDePlume)
           
abstract  void startLiveMode()
           
abstract  void stopLiveMode()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

liveMode

protected boolean liveMode
TRUE if the PenInput object is currently connected to the underlying (physical or simulated) pen in streaming mode.


penListenersToAdd

protected java.util.List<PenListener> penListenersToAdd
Cached pen listeners, so we can add them when/if you go live. TODO: How will we handle batched events later on?

Constructor Detail

PenInput

public PenInput(java.lang.String penName)
Parameters:
penName -
Method Detail

addLivePenListener

public void addLivePenListener(PenListener penListener)
Adds a low-level pen data listener to the live pen. You SHOULD call this after starting live mode.... However, we can cache the listener for you, if you really want. This is to eliminate annoying ordering constraints. Subclasses *should* override this, and call the super, to actually make use of PenListeners.

Parameters:
penListener -

getName

public java.lang.String getName()
Returns:
the name of this pen

isLive

public boolean isLive()
Returns:
if this pen in live mode.

removeLivePenListener

public void removeLivePenListener(PenListener penListener)
Removes the pen listener from the live pen. Subclasses *should* override this, and call the super's implementation if necessary, to actually make use of PenListeners.

Parameters:
penListener -

setName

public void setName(java.lang.String nomDePlume)
Parameters:
nomDePlume - For differentiating pens during debugging.

startLiveMode

public abstract void startLiveMode()

stopLiveMode

public abstract void stopLiveMode()

Copyright 2006 Stanford University