Class DownloadSessionTask
java.lang.Object
org.openstreetmap.josm.actions.downloadtasks.AbstractDownloadTask<Object>
org.openstreetmap.josm.actions.downloadtasks.DownloadSessionTask
- All Implemented Interfaces:
DownloadTask
Task allowing to download JOSM session (*.jos, *.joz file).
- Since:
- 6215
-
Field Summary
FieldsFields inherited from class org.openstreetmap.josm.actions.downloadtasks.AbstractDownloadTask
downloadedData, zoomAfterDownload -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancels the asynchronous download task.Future<?>download(DownloadParams settings, Bounds downloadArea, ProgressMonitor progressMonitor) Asynchronously launches the download task for a given bounding box.Replies the HTML-formatted confirmation message to be shown to user when the given URL needs to be confirmed before loading.String[]Returns regular expressions that match the URLsgetTitle()Returns human-readable description of the taskbooleanDo not allow to load a session file via remotecontrol.Future<?>loadUrl(DownloadParams settings, String url, ProgressMonitor progressMonitor) Asynchronously launches the download task for a given bounding URL.Methods inherited from class org.openstreetmap.josm.actions.downloadtasks.AbstractDownloadTask
acceptsUrl, acceptsUrl, getDownloadedData, getDownloadProjectionBounds, getErrorObjects, isCanceled, isFailed, patterns, rememberDownloadedData, rememberErrorMessage, rememberException, setCanceled, setFailed, setZoomAfterDownload, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.openstreetmap.josm.actions.downloadtasks.DownloadTask
acceptsDocumentationSummary, getErrorMessages, providesOldData
-
Field Details
-
PATTERN_SESSION
- See Also:
-
loader
-
-
Constructor Details
-
DownloadSessionTask
public DownloadSessionTask()
-
-
Method Details
-
getTitle
Description copied from interface:DownloadTaskReturns human-readable description of the task- Specified by:
getTitlein interfaceDownloadTask- Overrides:
getTitlein classAbstractDownloadTask<Object>- Returns:
- The task description
-
getPatterns
Description copied from interface:DownloadTaskReturns regular expressions that match the URLs- Specified by:
getPatternsin interfaceDownloadTask- Overrides:
getPatternsin classAbstractDownloadTask<Object>- Returns:
- The array of accepted URL patterns
-
download
public Future<?> download(DownloadParams settings, Bounds downloadArea, ProgressMonitor progressMonitor) Description copied from interface:DownloadTaskAsynchronously launches the download task for a given bounding box.Set
progressMonitorto null, if the task should create, open, and close a progress monitor. Set progressMonitor toNullProgressMonitor.INSTANCEif 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 completeThe 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
-
loadUrl
Description copied from interface:DownloadTaskAsynchronously 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.INSTANCEif 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:
-
cancel
Description copied from interface:DownloadTaskCancels the asynchronous download task. -
getConfirmationMessage
Description copied from interface:DownloadTaskReplies 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
-
isSafeForRemotecontrolRequests
Do not allow to load a session file via remotecontrol. Session importers can be added by plugins and there is currently no way to ensure that these are safe for remotecontol.- Overrides:
isSafeForRemotecontrolRequestsin classAbstractDownloadTask<Object>- Returns:
trueif session import is allowed
-