org.openstreetmap.josm.gui.dialogs.changeset.query
Class ChangesetQueryTask

java.lang.Object
  extended by org.openstreetmap.josm.gui.PleaseWaitRunnable
      extended by org.openstreetmap.josm.gui.dialogs.changeset.query.ChangesetQueryTask
All Implemented Interfaces:
java.lang.Runnable, ChangesetDownloadTask, ProgressMonitor.CancelListener

public class ChangesetQueryTask
extends PleaseWaitRunnable
implements ChangesetDownloadTask

Asynchronous task to send a changeset query to the OSM API.


Field Summary
private  boolean canceled
          true if the task was canceled
private  OsmServerChangesetReader changesetReader
          the reader object used to submit the changeset query to the API
private  java.util.Set<Changeset> downloadedChangesets
          the set of downloaded changesets
private  java.lang.Exception lastException
          the last exception remembered, if any
private  ChangesetQuery query
          the changeset query
private  OsmServerUserInfoReader userInfoReader
          the reader object used to read information about the current user from the API
 
Fields inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
progressMonitor
 
Constructor Summary
ChangesetQueryTask(ChangesetQuery query)
          Creates the task.
ChangesetQueryTask(java.awt.Component parent, ChangesetQuery query)
          Creates the task.
 
Method Summary
protected  void cancel()
          User pressed cancel button.
protected  void finish()
          Finish up the data work.
protected  void fullyIdentifyCurrentUser()
          Tries to fully identify the current JOSM user
 java.util.Set<Changeset> getDownloadedChangesets()
           
 boolean isCanceled()
           
 boolean isFailed()
           
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
 
Methods inherited from interface java.lang.Runnable
run
 

Field Detail

query

private ChangesetQuery query
the changeset query


canceled

private boolean canceled
true if the task was canceled


downloadedChangesets

private java.util.Set<Changeset> downloadedChangesets
the set of downloaded changesets


lastException

private java.lang.Exception lastException
the last exception remembered, if any


userInfoReader

private OsmServerUserInfoReader userInfoReader
the reader object used to read information about the current user from the API


changesetReader

private OsmServerChangesetReader changesetReader
the reader object used to submit the changeset query to the API

Constructor Detail

ChangesetQueryTask

public ChangesetQueryTask(ChangesetQuery query)
                   throws java.lang.IllegalArgumentException
Creates the task.

Parameters:
query - the query to submit to the OSM server. Must not be null.
Throws:
java.lang.IllegalArgumentException - thrown if query is null.

ChangesetQueryTask

public ChangesetQueryTask(java.awt.Component parent,
                          ChangesetQuery query)
                   throws java.lang.IllegalArgumentException
Creates the task.

Parameters:
parent - the parent component relative to which the PleaseWaitDialog is displayed. Must not be null.
query - the query to submit to the OSM server. Must not be null.
Throws:
java.lang.IllegalArgumentException - thrown if query is null.
java.lang.IllegalArgumentException - thrown if parent is 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

fullyIdentifyCurrentUser

protected void fullyIdentifyCurrentUser()
                                 throws OsmTransferException
Tries to fully identify the current JOSM user

Throws:
OsmTransferException - thrown if something went wrong

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

getDownloadedChangesets

public java.util.Set<Changeset> getDownloadedChangesets()
Specified by:
getDownloadedChangesets in interface ChangesetDownloadTask

isCanceled

public boolean isCanceled()
Specified by:
isCanceled in interface ChangesetDownloadTask

isFailed

public boolean isFailed()
Specified by:
isFailed in interface ChangesetDownloadTask


JOSM