|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openstreetmap.josm.gui.PleaseWaitRunnable
org.openstreetmap.josm.gui.dialogs.relation.ParentRelationLoadingTask
public class ParentRelationLoadingTask
This is an asynchronous task for loading the parents of a given relation. Typical usage:
final ParentRelationLoadingTask task = new ParentRelationLoadingTask( child, // the child relation Main.main.getEditLayer(), // the edit layer true, // load fully new PleaseWaitProgressMonitor() // a progress monitor ); task.setContinuation( new Runnable() { public void run() { if (task.isCanceled() || task.hasError()) return; Listparents = task.getParents(); // do something with the parent relations } ); // start the task Main.worker.submit(task);
Field Summary | |
---|---|
private boolean |
canceled
|
private Relation |
child
|
private java.lang.Runnable |
continuation
|
private boolean |
full
|
private java.lang.Exception |
lastException
|
private OsmDataLayer |
layer
|
private java.util.ArrayList<Relation> |
parents
|
private DataSet |
referrers
|
Fields inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable |
---|
progressMonitor |
Constructor Summary | |
---|---|
ParentRelationLoadingTask(Relation child,
OsmDataLayer layer,
boolean full,
PleaseWaitProgressMonitor monitor)
Creates a new task for asynchronously downloading the parents of a child relation. |
Method Summary | |
---|---|
protected void |
cancel()
User pressed cancel button. |
protected void |
finish()
Finish up the data work. |
protected OsmDataLayer |
getLayer()
|
java.util.List<Relation> |
getParents()
|
boolean |
hasError()
Replies true if an exception has been caught during the execution of this task. |
boolean |
isCanceled()
Replies true if this has been canceled by the user. |
protected void |
realRun()
Called in the worker thread to do the actual work. |
void |
setContinuation(java.lang.Runnable continuation)
Set a continuation which is called upon the job finished. |
protected void |
showLastException()
|
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 |
---|
private boolean canceled
private java.lang.Exception lastException
private DataSet referrers
private boolean full
private OsmDataLayer layer
private Relation child
private java.util.ArrayList<Relation> parents
private java.lang.Runnable continuation
Constructor Detail |
---|
public ParentRelationLoadingTask(Relation child, OsmDataLayer layer, boolean full, PleaseWaitProgressMonitor monitor)
child
- the child relation. Must not be null. Must have an id > 0.layer
- the OSM data layer. Must not be null.full
- if true, parent relations are fully downloaded (i.e. with their members)monitor
- the progress monitor to be used
java.lang.IllegalArgumentException
- thrown if child is null
java.lang.IllegalArgumentException
- thrown if layer is null
java.lang.IllegalArgumentException
- thrown if child.getId() == 0Method Detail |
---|
public void setContinuation(java.lang.Runnable continuation)
continuation
- the continuationpublic boolean isCanceled()
public boolean hasError()
protected OsmDataLayer getLayer()
public java.util.List<Relation> getParents()
protected void cancel()
PleaseWaitRunnable
cancel
in class PleaseWaitRunnable
protected void showLastException()
protected void finish()
PleaseWaitRunnable
finish
in class PleaseWaitRunnable
protected void realRun() throws org.xml.sax.SAXException, java.io.IOException, OsmTransferException
PleaseWaitRunnable
realRun
in class PleaseWaitRunnable
org.xml.sax.SAXException
java.io.IOException
OsmTransferException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |