edu.stanford.hci.r3
Class Application

java.lang.Object
  extended by edu.stanford.hci.r3.Application
Direct Known Subclasses:
CaptureApplication

public class Application
extends java.lang.Object

The R3 approach suggests that you create Application objects to wrap your entire paper + digital application. This is only ONE approach to solving the paper + digital integration, as you can actually use R3's components separately...

An application will consist of Bundles and Sheets, and the actions that are bound to individual regions. A PaperToolkit can load/run an Application. When an Application is running, all events will go through the PaperToolkit's EventEngine.

The Application will be able to dispatch events to the correct handlers. An application will also be able to handle pens, but these pens must be registered with the PaperToolkit to enable the event engine to do its work.

This software is distributed under the BSD License.


Constructor Summary
Application(java.lang.String theName)
           
 
Method Summary
 void addBatchEventHandler(BatchedEventHandler beh)
           
 void addDevice(Device dev)
           
 void addPenInput(PenInput penInputDevice)
          Add a digital pen (or pen simulator) for this application.
 void addSheet(Sheet sheet)
          When a sheet is added to an application, we will need to determine how the pattern maps to the sheet.
 void addSheet(Sheet sheet, java.io.File patternInfoFile)
          This method is better than the one argument version, because it makes everything explicit.
 void addSheet(Sheet sheet, PatternLocationToSheetLocationMapping patternToSheetMapping)
          This method may be the best of the three, because you explicitly construct the patternToSheetMapping (using any method you prefer).
 java.util.List<BatchedEventHandler> getBatchEventHandlers()
          A Paper Application needs BatchEventHandlers to detect when a person synchronizes a pen with the computer.
 DebuggingEnvironment getDebuggingEnvironment()
           
 PaperToolkit getHostToolkit()
           
 java.lang.String getName()
           
 java.util.Collection<PatternLocationToSheetLocationMapping> getPatternMaps()
          We can calculate this set at paper-application runtime, because each sheet has a reference to its pattern map.
 java.util.List<PenInput> getPenInputDevices()
           
 java.util.List<Sheet> getSheets()
           
protected  void initializeBeforeStarting()
          Called right before an applications starts.
 boolean isRunning()
           
 boolean isUserChoosingDestinationForPDF()
           
 void removeAllSheets()
          Useful for manipulating the application at RUNTIME.
 void removeBatchEventHandler(BatchedEventHandler beh)
           
 void removeSheet(Sheet sheet)
          We can add and remove sheets before the application starts.
 void renderToPDF()
          Feel free to OVERRIDE this too.
 void renderToPDF(java.io.File parentDirectory, java.lang.String fileNameWithoutExtension)
           Renders all of the sheets to different PDF files...
 void setDebuggingEnvironment(DebuggingEnvironment debugEnvironment)
           
 void setHostToolkit(PaperToolkit toolkit)
          Set it to null when the application is not running.
 void setUserChoosesPDFDestinationFlag(boolean flag)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Application

public Application(java.lang.String theName)
Parameters:
theName -
Method Detail

addBatchEventHandler

public void addBatchEventHandler(BatchedEventHandler beh)
Parameters:
beh -

addDevice

public void addDevice(Device dev)
Parameters:
dev -

addPenInput

public void addPenInput(PenInput penInputDevice)
Add a digital pen (or pen simulator) for this application. An application may have multiple pens.

Parameters:
pen -

addSheet

public void addSheet(Sheet sheet)
When a sheet is added to an application, we will need to determine how the pattern maps to the sheet. We will create a PatternLocationToSheetLocationMapping object from this sheet. WARNING: The current design REQUIRES you to add the sheet AFTER you have added regions to the sheet. This is an unfortunate design (ordering constraints), and should be changed _if possible_. Alternative, we can warn when there is ambiguity in loading patternInfo files.

Parameters:
sheet -

addSheet

public void addSheet(Sheet sheet,
                     java.io.File patternInfoFile)
This method is better than the one argument version, because it makes everything explicit. We MAY deprecate the other one at some point.

Parameters:
sheet -
patternInfoFile -

addSheet

public void addSheet(Sheet sheet,
                     PatternLocationToSheetLocationMapping patternToSheetMapping)
This method may be the best of the three, because you explicitly construct the patternToSheetMapping (using any method you prefer). Highest flexibility, but possibly inconvenient.

Parameters:
sheet -
patternInfoFile -

getBatchEventHandlers

public java.util.List<BatchedEventHandler> getBatchEventHandlers()
A Paper Application needs BatchEventHandlers to detect when a person synchronizes a pen with the computer. In the future, this may be integrated with standard event handling on a region. Right now, this is not possible, as we need the ability to calibrate the batched coordinates (which are processed by the PAD files) with the streaming coordinates.

Returns:

getDebuggingEnvironment

public DebuggingEnvironment getDebuggingEnvironment()

getHostToolkit

public PaperToolkit getHostToolkit()
Returns:
the toolkit object that is running this application.

getName

public java.lang.String getName()
Returns:
the application's name

getPatternMaps

public java.util.Collection<PatternLocationToSheetLocationMapping> getPatternMaps()
We can calculate this set at paper-application runtime, because each sheet has a reference to its pattern map.

Returns:
the information that maps a pattern location to a location on a sheet.

getPenInputDevices

public java.util.List<PenInput> getPenInputDevices()
Returns:
the list of pens. The EventEngine will have to get the listeners to these pens...

getSheets

public java.util.List<Sheet> getSheets()
Returns:

initializeBeforeStarting

protected void initializeBeforeStarting()
Called right before an applications starts. Override to do anything you like right after a person clicks start, and right before the application actually starts.


isRunning

public boolean isRunning()
Returns:
true if this application is currently running.

isUserChoosingDestinationForPDF

public boolean isUserChoosingDestinationForPDF()
Returns:
whether to let the user choose where to render the Sheets...

removeAllSheets

public void removeAllSheets()
Useful for manipulating the application at RUNTIME.


removeBatchEventHandler

public void removeBatchEventHandler(BatchedEventHandler beh)
Parameters:
beh -

removeSheet

public void removeSheet(Sheet sheet)
We can add and remove sheets before the application starts. However, this is also useful for manipulating the application at RUNTIME.

Parameters:
sheet -

renderToPDF

public void renderToPDF()
Feel free to OVERRIDE this too. It is called if the userChoosesPDFDestination flag is set to false, and the user presses the Render PDF Button in the App Manager.


renderToPDF

public void renderToPDF(java.io.File parentDirectory,
                        java.lang.String fileNameWithoutExtension)

Renders all of the sheets to different PDF files... If there are four Sheets, it will make files as follows:

parentDirectory
|_fileName_1.pdf
|_fileName_2.pdf
|_fileName_3.pdf
|_fileName_4.pdf

Feel Free to OVERRIDE this method if you want to attach different behavior to the App Manager's RenderPDF Button.


setDebuggingEnvironment

public void setDebuggingEnvironment(DebuggingEnvironment debugEnvironment)

setHostToolkit

public void setHostToolkit(PaperToolkit toolkit)
Set it to null when the application is not running. Set it to a valid toolkit object when the application is running. This allows the application to access the toolkit object that is hosting it, during RUNTIME.

Parameters:
toolkit -

setUserChoosesPDFDestinationFlag

public void setUserChoosesPDFDestinationFlag(boolean flag)
Parameters:
flag -

toString

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

Copyright 2006 Stanford University