Class AbstractChangesetDownloadTask
- java.lang.Object
-
- org.openstreetmap.josm.actions.downloadtasks.AbstractDownloadTask<java.util.Set<Changeset>>
-
- org.openstreetmap.josm.actions.downloadtasks.AbstractChangesetDownloadTask
-
- All Implemented Interfaces:
DownloadTask
- Direct Known Subclasses:
ChangesetContentDownloadTask
,ChangesetHeaderDownloadTask
,ChangesetQueryTask
public abstract class AbstractChangesetDownloadTask extends AbstractDownloadTask<java.util.Set<Changeset>>
Common abstract implementation of other changeset download tasks.- Since:
- 10124
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
AbstractChangesetDownloadTask.RunnableDownloadTask
-
Field Summary
Fields Modifier and Type Field Description private AbstractChangesetDownloadTask.RunnableDownloadTask
downloadTaskRunnable
-
Fields inherited from class org.openstreetmap.josm.actions.downloadtasks.AbstractDownloadTask
downloadedData, zoomAfterDownload
-
-
Constructor Summary
Constructors Constructor Description AbstractChangesetDownloadTask()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancel()
Cancels the asynchronous download task.java.util.concurrent.Future<?>
download()
Asynchronously launches the changeset download task.java.util.concurrent.Future<?>
download(DownloadParams settings, Bounds downloadArea, ProgressMonitor progressMonitor)
Asynchronously launches the download task for a given bounding box.java.lang.String
getConfirmationMessage(java.net.URL url)
Replies the HTML-formatted confirmation message to be shown to user when the given URL needs to be confirmed before loading.java.util.concurrent.Future<?>
loadUrl(DownloadParams settings, java.lang.String url, ProgressMonitor progressMonitor)
Asynchronously launches the download task for a given bounding URL.protected void
setDownloadTask(AbstractChangesetDownloadTask.RunnableDownloadTask downloadTask)
-
Methods inherited from class org.openstreetmap.josm.actions.downloadtasks.AbstractDownloadTask
acceptsUrl, acceptsUrl, getDownloadedData, getDownloadProjectionBounds, getErrorObjects, getPatterns, getTitle, isCanceled, isFailed, isSafeForRemotecontrolRequests, patterns, rememberDownloadedData, rememberErrorMessage, rememberException, setCanceled, setFailed, setZoomAfterDownload, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.actions.downloadtasks.DownloadTask
acceptsDocumentationSummary, getErrorMessages
-
-
-
-
Field Detail
-
downloadTaskRunnable
private AbstractChangesetDownloadTask.RunnableDownloadTask downloadTaskRunnable
-
-
Constructor Detail
-
AbstractChangesetDownloadTask
public AbstractChangesetDownloadTask()
-
-
Method Detail
-
setDownloadTask
protected final void setDownloadTask(AbstractChangesetDownloadTask.RunnableDownloadTask downloadTask)
-
download
public final java.util.concurrent.Future<?> download(DownloadParams settings, Bounds downloadArea, ProgressMonitor progressMonitor)
Description copied from interface:DownloadTask
Asynchronously launches the download task for a given bounding box.Set
progressMonitor
to null, if the task should create, open, and close a progress monitor. Set progressMonitor toNullProgressMonitor.INSTANCE
if progress information is to be discarded.You can wait for the asynchronous download task to finish by synchronizing on the returned
Future
, but make sure not to freeze up JOSM. Example:Future<?> future = task.download(...); // DON'T run this on the Swing EDT or JOSM will freeze future.get(); // waits for the dowload task to complete
The following example uses a pattern which is better suited if a task is launched from the Swing EDT:final Future<?> future = task.download(...); Runnable runAfterTask = new Runnable() { public void run() { // this is not strictly necessary because of the type of executor service // Main.worker is initialized with, but it doesn't harm either // future.get(); // wait for the download task to complete doSomethingAfterTheTaskCompleted(); } } MainApplication.worker.submit(runAfterTask);
- Parameters:
settings
- download settingsdownloadArea
- the area to downloadprogressMonitor
- the progressMonitor- Returns:
- the future representing the asynchronous task
-
download
public final java.util.concurrent.Future<?> download()
Asynchronously launches the changeset download task. This is equivalent todownload(false, null, null)
. You can wait for the asynchronous download task to finish by synchronizing on the returnedFuture
, but make sure not to freeze up JOSM. Example:Future<?> future = task.download(); // DON'T run this on the Swing EDT or JOSM will freeze future.get(); // waits for the download task to complete
The following example uses a pattern which is better suited if a task is launched from the Swing EDT:final Future<?> future = task.download(); Runnable runAfterTask = new Runnable() { public void run() { // this is not strictly necessary because of the type of executor service // Main.worker is initialized with, but it doesn't harm either // future.get(); // wait for the download task to complete doSomethingAfterTheTaskCompleted(); } } MainApplication.worker.submit(runAfterTask);
- Returns:
- the future representing the asynchronous task
-
loadUrl
public final java.util.concurrent.Future<?> loadUrl(DownloadParams settings, java.lang.String url, ProgressMonitor progressMonitor)
Description copied from interface:DownloadTask
Asynchronously launches the download task for a given bounding URL.Set progressMonitor to null, if the task should create, open, and close a progress monitor. Set progressMonitor to
NullProgressMonitor.INSTANCE
if progress information is to be discarded.- Parameters:
settings
- download settingsurl
- the url to download fromprogressMonitor
- the progressMonitor- Returns:
- the future representing the asynchronous task
- See Also:
DownloadTask.download(DownloadParams, Bounds, ProgressMonitor)
-
cancel
public final void cancel()
Description copied from interface:DownloadTask
Cancels the asynchronous download task.
-
getConfirmationMessage
public java.lang.String getConfirmationMessage(java.net.URL url)
Description copied from interface:DownloadTask
Replies the HTML-formatted confirmation message to be shown to user when the given URL needs to be confirmed before loading.- Parameters:
url
- The URL to be confirmed- Returns:
- The HTML-formatted confirmation message to be shown to user
-
-