PenInput Class Reference

Inheritance diagram for PenInput:

Pen PenSimulator List of all members.

Public Member Functions

 PenInput (String penName)
void addLivePenListener (PenListener penListener)
 Adds a low-level pen data listener to the live pen.
String getName ()
boolean isLive ()
void removeLivePenListener (PenListener penListener)
 Removes the pen listener from the live pen.
void setName (String nomDePlume)
abstract void startLiveMode ()
abstract void stopLiveMode ()

Protected Attributes

boolean liveMode = false
 TRUE if the PenInput object is currently connected to the underlying (physical or simulated) pen in streaming mode.
List< PenListenerpenListenersToAdd = new ArrayList<PenListener>()
 Cached pen listeners, so we can add them when/if you go live.

Detailed Description

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.

Author:
Ron B Yeh (ronyeh(AT)cs.stanford.edu)

Definition at line 21 of file PenInput.java.


Constructor & Destructor Documentation

PenInput ( String  penName  ) 

Parameters:
penName 

Definition at line 44 of file PenInput.java.

References PenInput.setName().


Member Function Documentation

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 
Returns:
true if we cached the pen listener on the penListenersToAdd list

Reimplemented in Pen, and PenSimulator.

Definition at line 58 of file PenInput.java.

References PenInput.isLive(), and PenInput.penListenersToAdd.

String getName (  ) 

Returns:
the name of this pen

Definition at line 70 of file PenInput.java.

Referenced by Pen.startLiveMode().

boolean isLive (  ) 

Returns:
if this pen in live mode.

Definition at line 77 of file PenInput.java.

References PenInput.liveMode.

Referenced by PenInput.addLivePenListener(), Pen.addLivePenListener(), Pen.removeLivePenListener(), and Pen.startLiveMode().

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 

Reimplemented in Pen, and PenSimulator.

Definition at line 87 of file PenInput.java.

References PenInput.penListenersToAdd.

void setName ( String  nomDePlume  ) 

Parameters:
nomDePlume For differentiating pens during debugging.

Definition at line 98 of file PenInput.java.

Referenced by PenInput.PenInput().


Member Data Documentation

List<PenListener> penListenersToAdd = new ArrayList<PenListener>() [protected]

Cached pen listeners, so we can add them when/if you go live.

TODO: How will we handle batched events later on?

Definition at line 39 of file PenInput.java.

Referenced by PenInput.addLivePenListener(), PenInput.removeLivePenListener(), and Pen.startLiveMode().


The documentation for this class was generated from the following file:
Generated on Sat Apr 14 18:21:43 2007 for R3 Paper Toolkit by  doxygen 1.4.7