ecologylab.services.logging.playback
Class LogPlayer<OP extends MixedInitiativeOp,LOG extends Logging<OP>>

java.lang.Object
  extended by ecologylab.generic.Debug
      extended by ecologylab.appframework.ApplicationEnvironment
          extended by ecologylab.services.logging.playback.LogPlayer<OP,LOG>
All Implemented Interfaces:
Environment, PlaybackControlCommands, XMLTranslationExceptionTypes, java.awt.event.ActionListener, java.awt.event.WindowListener, java.lang.Runnable, java.util.EventListener

public abstract class LogPlayer<OP extends MixedInitiativeOp,LOG extends Logging<OP>>
extends ApplicationEnvironment
implements java.awt.event.ActionListener, java.awt.event.WindowListener, PlaybackControlCommands, java.lang.Runnable

The main application for playing back log files.

Author:
Zachary O. Toups (toupsz@cs.tamu.edu)

Nested Class Summary
 
Nested classes/interfaces inherited from class ecologylab.appframework.ApplicationEnvironment
ApplicationEnvironment.LaunchType
 
Nested classes/interfaces inherited from interface ecologylab.appframework.Environment
Environment.The
 
Field Summary
protected  LogPlaybackControls<OP,LOG> controlsDisplay
           
static int DEFAULT_PLAYBACK_INTERVAL
           
protected  LogPlaybackControlModel<OP,LOG> log
           
protected  View<OP> logDisplay
           
protected  javax.swing.JFrame mainFrame
           
protected  int playbackInterval
          The number of milliseconds between ops when the log is playing.
protected  javax.swing.Timer t
           
static int TIMESTAMP_PLAYBACK_INTERVAL
           
protected  TranslationSpace translationSpace
           
 
Fields inherited from class ecologylab.appframework.ApplicationEnvironment
ECLIPSE_PREFS_DIR, prefsPURL
 
Fields inherited from interface ecologylab.services.logging.playback.PlaybackControlCommands
PAUSE, PLAY, STEP_BACK, STEP_FORWARD, STOP
 
Fields inherited from interface ecologylab.appframework.Environment
APPLICATION, IE, NS, PLUGIN, the
 
Fields inherited from interface ecologylab.xml.XMLTranslationExceptionTypes
FILE_NOT_FOUND, IO_EXCEPTION, NULL_PURL, UNKNOWN
 
Constructor Summary
LogPlayer(java.lang.String appName, java.lang.String[] args, TranslationSpace translationSpace)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void addActionListener(java.awt.event.ActionListener l)
           
protected abstract  LogPlaybackControlModel<OP,LOG> generateLogPlaybackControlModel(LOG incomingLog)
           
protected abstract  LogPlaybackControls<OP,LOG> generateLogPlaybackControls()
           
protected abstract  View<OP> generateView()
           
protected  LOG readInXMLFile(java.io.File logToRead)
           
 void run()
          Used to be thread safe with Swing.
 void showFileSelectGUI()
           
 void showLogPlaybackGUI()
           
 void startProgram()
           
protected abstract  LOG translateXMLFromFile(java.io.File logToRead)
          Translates the given file to XML.
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
          Sends the server notification that we are logging-out, then shuts down the program.
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 
Methods inherited from class ecologylab.appframework.ApplicationEnvironment
assetsDownloadProcessor, browser, codeBase, createPrefsEditor, createPrefsEditor, docBase, exit, launchType, lookupElementStatePreference, lookupStringPreference, metaPrefSet, navigate, preferencesDir, preferencesFileRelativeFromArg0, preferencesRegistry, prefSet, runtimeEnv, setCodeBase, showStatus, status, translationSpace
 
Methods inherited from class ecologylab.generic.Debug
classSimpleName, closeLoggingFile, debug, debug, debug, debug, debugA, debugA, debugA, debugI, debugI, debugI, error, error, getClassName, getClassName, getInteractive, getPackageName, getPackageName, getPackageName, initialize, level, level, level, logToFile, print, print, println, println, println, println, println, println, printlnA, printlnA, printlnA, printlnI, printlnI, printlnI, printlnI, setLoggingFile, show, show, superString, toggleInteractive, toString, toString, warning, warning, weird, weird
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

controlsDisplay

protected LogPlaybackControls<OP extends MixedInitiativeOp,LOG extends Logging<OP>> controlsDisplay

logDisplay

protected View<OP extends MixedInitiativeOp> logDisplay

log

protected LogPlaybackControlModel<OP extends MixedInitiativeOp,LOG extends Logging<OP>> log

mainFrame

protected javax.swing.JFrame mainFrame

t

protected javax.swing.Timer t

translationSpace

protected TranslationSpace translationSpace

DEFAULT_PLAYBACK_INTERVAL

public static final int DEFAULT_PLAYBACK_INTERVAL
See Also:
Constant Field Values

TIMESTAMP_PLAYBACK_INTERVAL

public static final int TIMESTAMP_PLAYBACK_INTERVAL
See Also:
Constant Field Values

playbackInterval

protected int playbackInterval
The number of milliseconds between ops when the log is playing. Setting to -1 will try to use op timestamps.

Constructor Detail

LogPlayer

public LogPlayer(java.lang.String appName,
                 java.lang.String[] args,
                 TranslationSpace translationSpace)
          throws XMLTranslationException
Throws:
XMLTranslationException
Method Detail

generateLogPlaybackControlModel

protected abstract LogPlaybackControlModel<OP,LOG> generateLogPlaybackControlModel(LOG incomingLog)

generateView

protected abstract View<OP> generateView()

generateLogPlaybackControls

protected abstract LogPlaybackControls<OP,LOG> generateLogPlaybackControls()

translateXMLFromFile

protected abstract LOG translateXMLFromFile(java.io.File logToRead)
                                                         throws XMLTranslationException
Translates the given file to XML. Necessary because it is not possible to cast directly to generic types.

Parameters:
logToRead -
Returns:
Throws:
XMLTranslationException

readInXMLFile

protected LOG readInXMLFile(java.io.File logToRead)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

addActionListener

public void addActionListener(java.awt.event.ActionListener l)

showLogPlaybackGUI

public void showLogPlaybackGUI()

showFileSelectGUI

public void showFileSelectGUI()

run

public void run()
Used to be thread safe with Swing. Either sets up the UI, or switches it, depending on whether or not a file has been selected.

Specified by:
run in interface java.lang.Runnable
See Also:
Runnable.run()

startProgram

public void startProgram()

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Sends the server notification that we are logging-out, then shuts down the program.

Specified by:
windowClosing in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener