Package uk.ac.starlink.topcat
Class Scheduler
java.lang.Object
uk.ac.starlink.topcat.Scheduler
Schedules tasks to run conditionally on on the Event Dispatch Thread.
Such tasks are only run if this object's (abstract)
isActive
method returns true at both scheduling time and run time.- Since:
- 5 Jun 2014
- Author:
- Mark Taylor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the component specified for this scheduler at construction time.abstract boolean
isActive()
Indicates whether this object is considered active.void
Schedules a runnable to be performed later on the Event Dispatch Thread, as long as this object is considered active.void
scheduleError
(String title, Throwable error) Schedules display of an ErrorDialog error message.void
Schedules display of an OutOfMemoryError.void
scheduleMessage
(String message, String title, int messageType) Schedules display of a JOptionPane message.
-
Constructor Details
-
Scheduler
Constructor.- Parameters:
parent
- parent component used for parenting popup windows; may be null
-
-
Method Details
-
isActive
public abstract boolean isActive()Indicates whether this object is considered active. If not, no jobs will be scheduled, and any scheduled jobs will be ignored when they are run on the EDT.The expectation is that this method starts off by returning true, but may eventually transition to returning false. Once that has happened, it will not return true again.
- Returns:
- true iff this object is considered active
-
schedule
Schedules a runnable to be performed later on the Event Dispatch Thread, as long as this object is considered active. IfisActive
returns false either when this method is called, or when the runnable comes to be executed on the EDT, nothing is done.This method may be called on any thread.
- Parameters:
runnable
- action to run on the EDT if still active
-
scheduleMessage
Schedules display of a JOptionPane message.This method may be called on any thread.
- Parameters:
message
- the Object to displaytitle
- the title string for the dialogmessageType
- the type of message to be displayed, one of the JOptionPane.*_MESSAGE constants- See Also:
-
scheduleError
Schedules display of an ErrorDialog error message.This method may be called on any thread.
- Parameters:
title
- window titleerror
- throwable- See Also:
-
ErrorDialog
-
scheduleMemoryError
Schedules display of an OutOfMemoryError.- Parameters:
error
- throwable- See Also:
-
getParent
Returns the component specified for this scheduler at construction time.- Returns:
- parent component, may be null
-