public class DownloadNotesTask extends AbstractDownloadTask<NoteData>
It handles two URL patterns: API call and dump file export.
| Modifier and Type | Class and Description |
|---|---|
(package private) class |
DownloadNotesTask.DownloadBoundingBoxTask |
(package private) class |
DownloadNotesTask.DownloadCompressedRawUrlTask |
(package private) class |
DownloadNotesTask.DownloadRawUrlTask |
(package private) class |
DownloadNotesTask.DownloadTask |
| Modifier and Type | Field and Description |
|---|---|
static IntegerProperty |
DAYS_CLOSED
Property defining number of days a bug needs to be closed to no longer be downloaded
|
static IntegerProperty |
DOWNLOAD_LIMIT
Property defining the number of notes to be downloaded
|
private DownloadNotesTask.DownloadTask |
downloadTask |
private NoteLayer |
noteLayer |
private static java.lang.String |
PATTERN_COMPRESS |
downloadedData, zoomAfterDownload| Constructor and Description |
|---|
DownloadNotesTask() |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancels the asynchronous download task.
|
java.util.concurrent.Future<?> |
download(DownloadParams settings,
Bounds downloadArea,
ProgressMonitor progressMonitor)
Asynchronously launches the download task for a given bounding box.
|
java.util.concurrent.Future<?> |
download(long id,
ProgressMonitor progressMonitor)
Download a specific note by its id.
|
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.
|
ProjectionBounds |
getDownloadProjectionBounds()
Returns the projection bounds of downloaded data.
|
java.lang.String[] |
getPatterns()
Returns regular expressions that match the URLs
|
java.lang.String |
getTitle()
Returns human-readable description of the task
|
boolean |
isSafeForRemotecontrolRequests()
Check / decide if the task is safe for remotecontrol.
|
java.util.concurrent.Future<?> |
loadUrl(DownloadParams settings,
java.lang.String url,
ProgressMonitor progressMonitor)
Asynchronously launches the download task for a given bounding URL.
|
acceptsDocumentationSummary, acceptsUrl, acceptsUrl, getDownloadedData, getErrorObjects, isCanceled, isFailed, rememberDownloadedData, rememberErrorMessage, rememberException, setCanceled, setFailed, setZoomAfterDownload, toStringpublic static final IntegerProperty DOWNLOAD_LIMIT
public static final IntegerProperty DAYS_CLOSED
private static final java.lang.String PATTERN_COMPRESS
private DownloadNotesTask.DownloadTask downloadTask
public DownloadNotesTask()
public java.util.concurrent.Future<?> download(long id, ProgressMonitor progressMonitor)
id - Note identifierprogressMonitor - progress monitorpublic java.util.concurrent.Future<?> download(DownloadParams settings, Bounds downloadArea, ProgressMonitor progressMonitor)
DownloadTaskprogressMonitor 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.
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);
settings - download settingsdownloadArea - the area to downloadprogressMonitor - the progressMonitorpublic java.util.concurrent.Future<?> loadUrl(DownloadParams settings, java.lang.String url, ProgressMonitor progressMonitor)
DownloadTaskNullProgressMonitor.INSTANCE if progress information is to
be discarded.settings - download settingsurl - the url to download fromprogressMonitor - the progressMonitorDownloadTask.download(DownloadParams, Bounds, ProgressMonitor)public void cancel()
DownloadTaskpublic java.lang.String getConfirmationMessage(java.net.URL url)
DownloadTaskurl - The URL to be confirmedpublic java.lang.String getTitle()
DownloadTaskgetTitle in interface DownloadTaskgetTitle in class AbstractDownloadTask<NoteData>public java.lang.String[] getPatterns()
DownloadTaskgetPatterns in interface DownloadTaskgetPatterns in class AbstractDownloadTask<NoteData>public boolean isSafeForRemotecontrolRequests()
AbstractDownloadTaskisSafeForRemotecontrolRequests in class AbstractDownloadTask<NoteData>public ProjectionBounds getDownloadProjectionBounds()
AbstractDownloadTaskgetDownloadProjectionBounds in class AbstractDownloadTask<NoteData>null