public abstract class Downloader<T>
extends java.lang.Object
Constructor | Description |
---|---|
Downloader(java.lang.Class<T> clazz,
java.lang.String dataDescription) |
Constructor.
|
Modifier and Type | Method | Description |
---|---|---|
void |
addActionListener(java.awt.event.ActionListener listener) |
Adds a listener that will be notified if the data acquisition status
changes.
|
abstract T |
attemptReadData() |
Performs the actual download.
|
void |
clearData() |
Resets the state of this downloader, as if the no download attempt
had been made.
|
javax.swing.JComponent |
createMonitorComponent() |
Returns a little component that monitors status of this downloader.
|
T |
getData() |
Immediately returns the downloaded data, or null if it has not been
downloaded, or if a download has failed.
|
boolean |
isComplete() |
Indicates whether the data has been downloaded.
|
void |
removeActionListener(java.awt.event.ActionListener listener) |
Removes a previously added listener.
|
T |
waitForData() |
Downloads the data if necessary, and returns its content.
|
public Downloader(java.lang.Class<T> clazz, java.lang.String dataDescription)
clazz
- type of data downloadeddataDescription
- short description of downloaded data,
may be used in logging messagespublic abstract T attemptReadData() throws java.io.IOException
java.io.IOException
public boolean isComplete()
getData()
will return the
result.public T getData()
public void clearData()
public T waitForData()
public javax.swing.JComponent createMonitorComponent()
public void addActionListener(java.awt.event.ActionListener listener)
listener
- listenerpublic void removeActionListener(java.awt.event.ActionListener listener)
listener
- listenerCopyright © 2018 Central Laboratory of the Research Councils. All Rights Reserved.