com.mtp.pounder
Class PounderModel

java.lang.Object
  |
  +--com.mtp.pounder.PounderModel
All Implemented Interfaces:
PounderConstants
Direct Known Subclasses:
PounderControllerTest.PlayForeverPounderModel, PounderControllerTest.RecordForeverPounderModel

public class PounderModel
extends Object
implements PounderConstants

Keeps track of the current pounding taking place. This includes the list of actions needed for the pounding, the component to be test pounded, and possibly an XML file for output.

Author:
Matthew Pekar

Field Summary
protected  PlainDocument comment
           
protected  FileModel fileModel
           
protected  Listeners listeners
           
protected  DefaultComboBoxModel loadedTestObjects
           
protected  PlaybackThread playbackThread
           
protected  PounderPrefs preferences
           
protected  DefaultBoundedRangeModel progressModel
           
protected  RecordingRecord record
           
protected  RecordingThread recordingThread
           
protected  StatusModel statusModel
           
protected  TestInstanceFactory testInstanceFactory
           
 
Fields inherited from interface com.mtp.pounder.PounderConstants
FILE_EXTENSION, FILE_FORMAT_VERSION, VERSION
 
Constructor Summary
PounderModel()
          Default constructor.
PounderModel(boolean loadDataFromSystem)
          Loads data from system as specified.
PounderModel(PounderPrefs preferences)
          Initialize with given PounderPrefs.
 
Method Summary
 void addListener(PounderModelListener l)
           
protected  void addLoadedTestObject(String name)
           
 void beginVerbatimRecording()
           
 boolean equals(Object o)
          Override equals.
protected  void finalize()
           
 void fireChange()
           
 PlainDocument getComment()
          Return our comment.
 FileModel getFileModel()
           
 DefaultComboBoxModel getLoadedTestObjects()
          Returns the DefaultComboBoxModel used to track our loaded test objects.
 PounderPrefs getPreferences()
           
 DefaultBoundedRangeModel getProgressModel()
          Return model used to track progress of playback and other actions.
 RecordingRecord getRecord()
           
 StatusModel getStatusModel()
           
 ClassLoader getTestClassLoader()
           
 TestInstanceFactory getTestInstanceFactory()
           
 boolean isPaused()
           
 boolean isPlaying()
          Returns true if we are currently playing.
 boolean isRecording()
          Returns true if we are currently recording.
 boolean isSaveNeeded()
          Return true if a save is needed.
 boolean isTestClassSet()
          Returns true if the test class is set.
protected  boolean loadedTestObjectExists(String name)
           
 void newInstance()
           
 void playback()
           
 void playbackFinished()
           
 void recordingFinished()
           
 void removeListener(PounderModelListener l)
           
 void setPaused(boolean b)
           
 void setPreferences(PounderPrefs p)
           
 void setTestClass(String name)
          Attempt to load an instance of this component from 'name'.
 void setTestInstanceFactory(TestInstanceFactory si)
           
 void stop()
          Stop recording or playing.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

recordingThread

protected RecordingThread recordingThread

record

protected RecordingRecord record

statusModel

protected StatusModel statusModel

playbackThread

protected PlaybackThread playbackThread

testInstanceFactory

protected TestInstanceFactory testInstanceFactory

preferences

protected PounderPrefs preferences

loadedTestObjects

protected DefaultComboBoxModel loadedTestObjects

progressModel

protected DefaultBoundedRangeModel progressModel

comment

protected PlainDocument comment

listeners

protected Listeners listeners

fileModel

protected FileModel fileModel
Constructor Detail

PounderModel

public PounderModel()
Default constructor. Calls other constructor with new PounderPrefs.


PounderModel

public PounderModel(boolean loadDataFromSystem)
Loads data from system as specified.


PounderModel

public PounderModel(PounderPrefs preferences)
Initialize with given PounderPrefs.

Method Detail

isSaveNeeded

public boolean isSaveNeeded()
Return true if a save is needed. This is true if the current file is null and no data exists, or if the data in the file doesn't match what is present.


getFileModel

public FileModel getFileModel()

addListener

public void addListener(PounderModelListener l)

removeListener

public void removeListener(PounderModelListener l)

fireChange

public void fireChange()

getComment

public PlainDocument getComment()
Return our comment.


getProgressModel

public DefaultBoundedRangeModel getProgressModel()
Return model used to track progress of playback and other actions.


getLoadedTestObjects

public DefaultComboBoxModel getLoadedTestObjects()
Returns the DefaultComboBoxModel used to track our loaded test objects.


isRecording

public boolean isRecording()
Returns true if we are currently recording.


isPlaying

public boolean isPlaying()
Returns true if we are currently playing.


isTestClassSet

public boolean isTestClassSet()
Returns true if the test class is set.


equals

public boolean equals(Object o)
Override equals. Return true based on equality of our testInstanceFactory, and record. Note that preferences are not taken into account.

Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

getPreferences

public PounderPrefs getPreferences()

setPreferences

public void setPreferences(PounderPrefs p)

getTestInstanceFactory

public TestInstanceFactory getTestInstanceFactory()

getTestClassLoader

public ClassLoader getTestClassLoader()

newInstance

public void newInstance()

setPaused

public void setPaused(boolean b)

isPaused

public boolean isPaused()

stop

public void stop()
Stop recording or playing.


playbackFinished

public void playbackFinished()

recordingFinished

public void recordingFinished()

getStatusModel

public StatusModel getStatusModel()

getRecord

public RecordingRecord getRecord()

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throwable

playback

public void playback()

beginVerbatimRecording

public void beginVerbatimRecording()

loadedTestObjectExists

protected boolean loadedTestObjectExists(String name)

addLoadedTestObject

protected void addLoadedTestObject(String name)

setTestInstanceFactory

public void setTestInstanceFactory(TestInstanceFactory si)

setTestClass

public void setTestClass(String name)
Attempt to load an instance of this component from 'name'.



Copyright © 2002 Matthew Pekar. All Rights Reserved.