public abstract class SaveWorker
extends java.lang.Object
attemptSave(uk.ac.starlink.table.StarTable[]) method and call
invoke() on it from the event dispatch thread.
A progress bar will advise the user on how
the save is going, and if the save fails a popup will advise of the
error. When the save has completed one way or another, the
done(boolean) method will be called.| Modifier | Constructor and Description |
|---|---|
protected |
SaveWorker(java.awt.Component parent,
StarTable[] tables,
java.lang.String location)
Constructs a save worker which will use its own popup widow for
progress display.
|
protected |
SaveWorker(javax.swing.JProgressBar progBar,
StarTable[] tables,
java.lang.String location)
Constructs a save worker which will use a given progress bar for
progress display.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
attemptSave(StarTable[] tables)
This method should do the work of saving the given tables.
|
void |
cancel()
Interrupts any save which is in progress.
|
protected abstract void |
done(boolean success)
Called from the event dispatch thread when the save has completed.
|
void |
invoke()
Begins the save.
|
protected SaveWorker(java.awt.Component parent,
StarTable[] tables,
java.lang.String location)
parent - parent component used for progress bar popuptables - tables to be savedlocation - string identifying the save destination - used for
display purposes onlyprotected SaveWorker(javax.swing.JProgressBar progBar,
StarTable[] tables,
java.lang.String location)
progBar - progress bar which will be updated to display progresstables - tables to be savedlocation - string identifying the save destination - used for
display purposes onlyprotected abstract void attemptSave(StarTable[] tables) throws java.io.IOException
tables - tables to savejava.io.IOException - if the table cannot be savedprotected abstract void done(boolean success)
The default implementation does nothing, but subclasses may override it to react in some way to the save's completion.
success - save statuspublic void cancel()
public void invoke()