Class EventQueue
- java.lang.Object
-
- adams.gui.visualization.annotator.EventQueue
-
- All Implemented Interfaces:
AnnotationListener
public class EventQueue extends Object implements AnnotationListener
A queue that ensures that events are added to the trail one at a time. This is to prevent race conditions- Version:
- $Revision$
- Author:
- sjb90
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanm_Playinga flag that says if we're paused or notprotected adams.flow.core.RunnableWithLoggingm_Runnablethe runable we use for the internal threadprotected ConcurrentLinkedQueue<Step>m_Stepsthe internal queueprotected Trailm_Trailthe trail we add the steps tostatic longSLEEP_TIMEa constant defining the amount of time to sleep for
-
Constructor Summary
Constructors Constructor Description EventQueue()Constructs a queue that adds steps to a trail.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidannotationOccurred(AnnotationEvent e)Receives an AnnotationEvent that contains a StepvoidcleanUp()Cleans up any loose endsprotected voidclearQueue()BufferedImagegetBackgroundImage()a getter for the background image stored with the trailTrailgetTrail()A getter for the trail EventQueue adds steps tovoidloadTrail(Trail trail)Loads a saved trail EventQueue adds steps to.voidresetTrail()Resets the trail to an empty one.voidsetBackgroundImage(BufferedImage backgroundImage)sets the background image to be stored with the trail.protected voidstart()adams.data.spreadsheet.SpreadSheettoSpreadSheet()Turns the inner trail into a spreadsheet.
-
-
-
Field Detail
-
SLEEP_TIME
public static final long SLEEP_TIME
a constant defining the amount of time to sleep for- See Also:
- Constant Field Values
-
m_Steps
protected ConcurrentLinkedQueue<Step> m_Steps
the internal queue
-
m_Trail
protected Trail m_Trail
the trail we add the steps to
-
m_Runnable
protected adams.flow.core.RunnableWithLogging m_Runnable
the runable we use for the internal thread
-
m_Playing
protected boolean m_Playing
a flag that says if we're paused or not
-
-
Method Detail
-
resetTrail
public void resetTrail()
Resets the trail to an empty one. Clears the queue so any left over steps are not added mistakenly to the new trail.
-
getTrail
public Trail getTrail()
A getter for the trail EventQueue adds steps to- Returns:
- The trail we've been adding steps to
-
loadTrail
public void loadTrail(Trail trail)
Loads a saved trail EventQueue adds steps to. Clears the steps queue so any remaining steps are not mistakenly added to the newly loaded queue.- Parameters:
trail- The trail we're loading in
-
clearQueue
protected void clearQueue()
-
start
protected void start()
-
toSpreadSheet
public adams.data.spreadsheet.SpreadSheet toSpreadSheet()
Turns the inner trail into a spreadsheet.- Returns:
- the spread sheet object
-
annotationOccurred
public void annotationOccurred(AnnotationEvent e)
Description copied from interface:AnnotationListenerReceives an AnnotationEvent that contains a Step- Specified by:
annotationOccurredin interfaceAnnotationListener- Parameters:
e- the event containing the Step
-
cleanUp
public void cleanUp()
Cleans up any loose ends
-
setBackgroundImage
public void setBackgroundImage(BufferedImage backgroundImage)
sets the background image to be stored with the trail.- Parameters:
backgroundImage-
-
getBackgroundImage
public BufferedImage getBackgroundImage()
a getter for the background image stored with the trail- Returns:
- the image
-
-