public class HistoryLoadTask extends PleaseWaitRunnable
HistoryLoadTask task = new HistoryLoadTask() .add(node) .add(way) .add(relation) .add(aHistoryItem); Main.worker.execute(task);
Modifier and Type | Field and Description |
---|---|
private boolean |
canceled |
private java.lang.Exception |
lastException |
private HistoryDataSet |
loadedData |
private OsmServerHistoryReader |
reader |
private java.util.Set<PrimitiveId> |
toLoad |
progressMonitor
Constructor and Description |
---|
HistoryLoadTask()
Constructs a new
HistoryLoadTask . |
HistoryLoadTask(java.awt.Component parent)
Constructs a new
HistoryLoadTask . |
Modifier and Type | Method and Description |
---|---|
HistoryLoadTask |
add(java.util.Collection<? extends OsmPrimitive> primitives)
Adds a collection of objects to loaded, specified by a collection of OSM primitives.
|
HistoryLoadTask |
add(History history)
Adds an object to be loaded, the object is specified by an already loaded object history.
|
HistoryLoadTask |
add(HistoryOsmPrimitive primitive)
Adds an object to be loaded, the object is specified by a history item.
|
HistoryLoadTask |
add(OsmPrimitive primitive)
Adds an object to be loaded, the object is specified by an OSM primitive.
|
HistoryLoadTask |
add(PrimitiveId pid)
Adds an object whose history is to be loaded.
|
protected void |
cancel()
User pressed cancel button.
|
protected void |
finish()
Finish up the data work.
|
java.lang.Exception |
getLastException()
Returns the last exception that occured during loading, if any.
|
protected static java.lang.String |
getLoadingMessage(PrimitiveId pid) |
boolean |
isCanceled()
Determines if this task has ben canceled.
|
protected static HistoryDataSet |
loadHistory(OsmServerHistoryReader reader,
ProgressMonitor progressMonitor) |
protected void |
realRun()
Called in the worker thread to do the actual work.
|
afterFinish, canRunInBackground, getProgressMonitor, operationCanceled, run
private boolean canceled
private java.lang.Exception lastException
private final java.util.Set<PrimitiveId> toLoad
private HistoryDataSet loadedData
private OsmServerHistoryReader reader
public HistoryLoadTask()
HistoryLoadTask
.public HistoryLoadTask(java.awt.Component parent)
HistoryLoadTask
.parent
- the component to be used as reference to find the
parent for PleaseWaitDialog
.
Must not be null
.java.lang.IllegalArgumentException
- if parent is null
public HistoryLoadTask add(PrimitiveId pid)
pid
- the primitive id. Must not be null. Id > 0 required.public HistoryLoadTask add(HistoryOsmPrimitive primitive)
primitive
- the history itemjava.lang.IllegalArgumentException
- if primitive is nullpublic HistoryLoadTask add(History history)
history
- the history. Must not be null.java.lang.IllegalArgumentException
- if history is nullpublic HistoryLoadTask add(OsmPrimitive primitive)
primitive
- the OSM primitive. Must not be null. primitive.getId() > 0 required.java.lang.IllegalArgumentException
- if the primitive is nulljava.lang.IllegalArgumentException
- if primitive.getId() <= 0public HistoryLoadTask add(java.util.Collection<? extends OsmPrimitive> primitives)
primitives
- the OSM primitives. Must not be null
.
primitive.getId() > 0
required.java.lang.IllegalArgumentException
- if primitives is null
java.lang.IllegalArgumentException
- if one of the ids in the collection <= 0protected void cancel()
PleaseWaitRunnable
cancel
in class PleaseWaitRunnable
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
- if a SAX error occursjava.io.IOException
- if an I/O error occursOsmTransferException
- if a communication error with the OSM server occursprotected static HistoryDataSet loadHistory(OsmServerHistoryReader reader, ProgressMonitor progressMonitor) throws OsmTransferException
OsmTransferException
protected static java.lang.String getLoadingMessage(PrimitiveId pid)
public boolean isCanceled()
true
if this task has ben canceledpublic java.lang.Exception getLastException()
null