public class ChangesetContentDownloadTask extends PleaseWaitRunnable implements ChangesetDownloadTask
Modifier and Type | Field and Description |
---|---|
private boolean |
canceled
true if the task was canceled
|
private Set<Changeset> |
downloadedChangesets
the set of downloaded changesets
|
private Exception |
lastException
keeps the last exception thrown in the task, if any
|
private OsmServerChangesetReader |
reader
the reader object used to read changesets from the API
|
private List<Integer> |
toDownload
the list of changeset ids to download
|
progressMonitor
Constructor and Description |
---|
ChangesetContentDownloadTask(Collection<Integer> changesetIds)
Creates a download task for a collection of changesets.
|
ChangesetContentDownloadTask(Component parent,
Collection<Integer> changesetIds)
Creates a download task for a collection of changesets.
|
ChangesetContentDownloadTask(Component parent,
int changesetId)
Creates a download task for a single changeset
|
ChangesetContentDownloadTask(int changesetId)
Creates a download task for a single changeset
|
Modifier and Type | Method and Description |
---|---|
protected void |
cancel()
User pressed cancel button.
|
protected void |
downloadChangeset(int changesetId)
Downloads the changeset with id
changesetId (only "header"
information, no content) |
protected void |
finish()
Finish up the data work.
|
Set<Changeset> |
getDownloadedChangesets() |
protected void |
init(Collection<Integer> ids)
Initialize the task with a collection of changeset ids to download
|
protected boolean |
isAvailableLocally(int changesetId)
Replies true if the local
ChangesetCache already includes the changeset with
id changesetId . |
boolean |
isCanceled() |
boolean |
isFailed() |
protected void |
realRun()
Called in the worker thread to do the actual work.
|
afterFinish, canRunInBackground, getProgressMonitor, operationCanceled, run
private final List<Integer> toDownload
private boolean canceled
private Exception lastException
private OsmServerChangesetReader reader
private Set<Changeset> downloadedChangesets
public ChangesetContentDownloadTask(int changesetId) throws IllegalArgumentException
changesetId
- the changeset id. > 0 required.IllegalArgumentException
- thrown if changesetId <= 0public ChangesetContentDownloadTask(Collection<Integer> changesetIds)
changesetIds
- the changeset ids. Empty collection assumed, if null.public ChangesetContentDownloadTask(Component parent, int changesetId) throws IllegalArgumentException
parent
- the parent component for the PleaseWaitDialog
. Must not be null
.changesetId
- the changeset id. >0
required.IllegalArgumentException
- thrown if changesetId <= 0
IllegalArgumentException
- thrown if parent is null
public ChangesetContentDownloadTask(Component parent, Collection<Integer> changesetIds) throws IllegalArgumentException
parent
- the parent component for the PleaseWaitDialog
. Must not be null
.changesetIds
- the changeset ids. Empty collection assumed, if null
.IllegalArgumentException
- thrown if parent is null
protected void init(Collection<Integer> ids)
ids
- the collection of ids. May be null.protected boolean isAvailableLocally(int changesetId)
ChangesetCache
already includes the changeset with
id changesetId
.changesetId
- the changeset idChangesetCache
already includes the changeset with
id changesetId
protected void downloadChangeset(int changesetId) throws OsmTransferException
changesetId
(only "header"
information, no content)changesetId
- the changeset idOsmTransferException
- thrown if something went wrongprotected void cancel()
PleaseWaitRunnable
cancel
in class PleaseWaitRunnable
protected void finish()
PleaseWaitRunnable
finish
in class PleaseWaitRunnable
protected void realRun() throws SAXException, IOException, OsmTransferException
PleaseWaitRunnable
realRun
in class PleaseWaitRunnable
SAXException
IOException
OsmTransferException
public Set<Changeset> getDownloadedChangesets()
getDownloadedChangesets
in interface ChangesetDownloadTask
public boolean isCanceled()
isCanceled
in interface ChangesetDownloadTask
public boolean isFailed()
isFailed
in interface ChangesetDownloadTask