org.openstreetmap.josm.actions.downloadtasks
Class DownloadReferrersTask

java.lang.Object
  extended by org.openstreetmap.josm.gui.PleaseWaitRunnable
      extended by org.openstreetmap.josm.actions.downloadtasks.DownloadReferrersTask
All Implemented Interfaces:
java.lang.Runnable, ProgressMonitor.CancelListener

public class DownloadReferrersTask
extends PleaseWaitRunnable

The asynchronous task for downloading referring primitives


Field Summary
private  boolean canceled
           
private  java.util.Map<java.lang.Long,OsmPrimitiveType> children
          the collection of child primitives
private  java.lang.Exception lastException
           
private  DataSet parents
          the parents
private  OsmServerReader reader
           
private  OsmDataLayer targetLayer
          the target layer
 
Fields inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
progressMonitor
 
Constructor Summary
DownloadReferrersTask(OsmDataLayer targetLayer, java.util.Collection<OsmPrimitive> children)
          constructor
DownloadReferrersTask(OsmDataLayer targetLayer, long id, OsmPrimitiveType type)
          constructor
DownloadReferrersTask(OsmDataLayer targetLayer, java.util.Map<java.lang.Long,OsmPrimitiveType> children)
          constructor
DownloadReferrersTask(OsmDataLayer targetLayer, PrimitiveId primitiveId)
          constructor
 
Method Summary
protected  void cancel()
          User pressed cancel button.
protected  void downloadParents(long id, OsmPrimitiveType type, ProgressMonitor progressMonitor)
           
protected  void finish()
          Finish up the data work.
protected  void realRun()
          Called in the worker thread to do the actual work.
 
Methods inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
afterFinish, canRunInBackground, getProgressMonitor, operationCanceled, run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

canceled

private boolean canceled

lastException

private java.lang.Exception lastException

reader

private OsmServerReader reader

targetLayer

private OsmDataLayer targetLayer
the target layer


children

private java.util.Map<java.lang.Long,OsmPrimitiveType> children
the collection of child primitives


parents

private DataSet parents
the parents

Constructor Detail

DownloadReferrersTask

public DownloadReferrersTask(OsmDataLayer targetLayer,
                             java.util.Collection<OsmPrimitive> children)
constructor

Parameters:
targetLayer - the target layer for the downloaded primitives. Must not be null.
children - the collection of child primitives for which parents are to be downloaded

DownloadReferrersTask

public DownloadReferrersTask(OsmDataLayer targetLayer,
                             java.util.Map<java.lang.Long,OsmPrimitiveType> children)
constructor

Parameters:
targetLayer - the target layer for the downloaded primitives. Must not be null.
primitives - the collection of children for which parents are to be downloaded. Children are specified by their id and their type.

DownloadReferrersTask

public DownloadReferrersTask(OsmDataLayer targetLayer,
                             long id,
                             OsmPrimitiveType type)
                      throws java.lang.IllegalArgumentException
constructor

Parameters:
targetLayer - the target layer. Must not be null.
id - the primitive id. id > 0 required.
type - the primitive type. type != null required
Throws:
java.lang.IllegalArgumentException - thrown if id <= 0
java.lang.IllegalArgumentException - thrown if type == null
java.lang.IllegalArgumentException - thrown if targetLayer == null

DownloadReferrersTask

public DownloadReferrersTask(OsmDataLayer targetLayer,
                             PrimitiveId primitiveId)
                      throws java.lang.IllegalArgumentException
constructor

Parameters:
targetLayer - the target layer. Must not be null.
primitiveId - a PrimitiveId object.
Throws:
java.lang.IllegalArgumentException - thrown if id <= 0
java.lang.IllegalArgumentException - thrown if targetLayer == null
Method Detail

cancel

protected void cancel()
Description copied from class: PleaseWaitRunnable
User pressed cancel button.

Specified by:
cancel in class PleaseWaitRunnable

finish

protected void finish()
Description copied from class: PleaseWaitRunnable
Finish up the data work. Is guaranteed to be called if realRun is called. Finish is called in the gui thread just after the dialog disappeared.

Specified by:
finish in class PleaseWaitRunnable

downloadParents

protected void downloadParents(long id,
                               OsmPrimitiveType type,
                               ProgressMonitor progressMonitor)
                        throws OsmTransferException
Throws:
OsmTransferException

realRun

protected void realRun()
                throws org.xml.sax.SAXException,
                       java.io.IOException,
                       OsmTransferException
Description copied from class: PleaseWaitRunnable
Called in the worker thread to do the actual work. When any of the exception is thrown, a message box will be displayed and closeDialog is called. finish() is called in any case.

Specified by:
realRun in class PleaseWaitRunnable
Throws:
org.xml.sax.SAXException
java.io.IOException
OsmTransferException


JOSM