org.openstreetmap.josm.actions.downloadtasks
Class DownloadOsmCompressedTask

java.lang.Object
  extended by org.openstreetmap.josm.actions.downloadtasks.AbstractDownloadTask
      extended by org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask
          extended by org.openstreetmap.josm.actions.downloadtasks.DownloadOsmCompressedTask
All Implemented Interfaces:
DownloadTask

public class DownloadOsmCompressedTask
extends DownloadOsmTask


Nested Class Summary
 
Nested classes/interfaces inherited from class org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask
DownloadOsmTask.DownloadTask
 
Field Summary
 
Fields inherited from class org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask
currentBounds, downloadedData, downloadTask, newLayerName, targetLayer
 
Constructor Summary
DownloadOsmCompressedTask()
           
 
Method Summary
 boolean acceptsUrl(java.lang.String url)
          Returns true if the task is able to open the given URL, false otherwise.
 java.util.concurrent.Future<?> download(boolean newLayer, Bounds downloadArea, ProgressMonitor progressMonitor)
          Asynchronously launches the download task for a given bounding box.
 java.util.concurrent.Future<?> loadUrl(boolean new_layer, java.lang.String url, ProgressMonitor progressMonitor)
          Loads a given URL
 
Methods inherited from class org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask
cancel, download, download, extractOsmFilename, getDownloadedData, rememberDownloadedData
 
Methods inherited from class org.openstreetmap.josm.actions.downloadtasks.AbstractDownloadTask
getErrorObjects, isCanceled, isFailed, rememberErrorMessage, rememberException, setCanceled, setFailed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DownloadOsmCompressedTask

public DownloadOsmCompressedTask()
Method Detail

acceptsUrl

public boolean acceptsUrl(java.lang.String url)
Description copied from interface: DownloadTask
Returns true if the task is able to open the given URL, false otherwise.

Specified by:
acceptsUrl in interface DownloadTask
Overrides:
acceptsUrl in class DownloadOsmTask
Parameters:
url - the url to download from
Returns:
True if the task is able to open the given URL, false otherwise.

download

public java.util.concurrent.Future<?> download(boolean newLayer,
                                               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 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();
       }
    }
    Main.worker.submit(runAfterTask);
 

Specified by:
download in interface DownloadTask
Overrides:
download in class DownloadOsmTask
Parameters:
newLayer - true, if the data is to be downloaded into a new layer. If false, the task selects one of the existing layers as download layer, preferably the active layer.
downloadArea - the area to download
progressMonitor - the progressMonitor
Returns:
the future representing the asynchronous task

loadUrl

public java.util.concurrent.Future<?> loadUrl(boolean new_layer,
                                              java.lang.String url,
                                              ProgressMonitor progressMonitor)
Loads a given URL

Specified by:
loadUrl in interface DownloadTask
Overrides:
loadUrl in class DownloadOsmTask
Parameters:
True - if the data should be saved to a new layer
The - URL as String
Returns:
the future representing the asynchronous task
See Also:
DownloadTask.download(boolean, Bounds, ProgressMonitor)


JOSM