Package org.openstreetmap.josm.gui.io
Class AbstractPrimitiveTask
- java.lang.Object
-
- org.openstreetmap.josm.gui.PleaseWaitRunnable
-
- org.openstreetmap.josm.gui.io.AbstractPrimitiveTask
-
- All Implemented Interfaces:
java.lang.Runnable,ProgressMonitor.CancelListener
- Direct Known Subclasses:
DownloadPrimitivesTask,UpdatePrimitivesTask
public abstract class AbstractPrimitiveTask extends PleaseWaitRunnable
Abstract superclass of download/update primitives tasks.- Since:
- 10129
-
-
Field Summary
Fields Modifier and Type Field Description protected booleancanceledprotected DataSetdsprotected booleanfullRelationprotected java.lang.ExceptionlastExceptionprotected OsmDataLayerlayerprivate java.util.Set<PrimitiveId>missingPrimitivesprotected MultiFetchServerObjectReadermultiObjectReaderprotected OsmServerObjectReaderobjectReaderprivate booleanzoom-
Fields inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
progressMonitor
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractPrimitiveTask(java.lang.String title, OsmDataLayer layer)protectedAbstractPrimitiveTask(java.lang.String title, ProgressMonitor progressMonitor, OsmDataLayer layer)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcancel()User pressed cancel button.protected voidfinish()Finish up the data work.java.util.Set<PrimitiveId>getMissingPrimitives()Replies the set of ids of all primitives for which a fetch request to the server was submitted but which are not available from the server (the server replied a return code of 404)protected abstract voidinitMultiFetchReader(MultiFetchServerObjectReader reader)protected voidloadIncompleteNodes()protected voidrealRun()Called in the worker thread to do the actual work.AbstractPrimitiveTasksetDownloadRelations(boolean fullRelation)Sets whether all members of the relation should be downloaded completely.AbstractPrimitiveTasksetZoom(boolean zoom)Sets whether the map view should zoom to impacted primitives at the end.-
Methods inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
afterFinish, canRunInBackground, getProgressMonitor, operationCanceled, run
-
-
-
-
Field Detail
-
canceled
protected boolean canceled
-
lastException
protected java.lang.Exception lastException
-
missingPrimitives
private java.util.Set<PrimitiveId> missingPrimitives
-
layer
protected final OsmDataLayer layer
-
multiObjectReader
protected MultiFetchServerObjectReader multiObjectReader
-
objectReader
protected OsmServerObjectReader objectReader
-
zoom
private boolean zoom
-
fullRelation
protected boolean fullRelation
-
-
Constructor Detail
-
AbstractPrimitiveTask
protected AbstractPrimitiveTask(java.lang.String title, OsmDataLayer layer)
-
AbstractPrimitiveTask
protected AbstractPrimitiveTask(java.lang.String title, ProgressMonitor progressMonitor, OsmDataLayer layer)
-
-
Method Detail
-
initMultiFetchReader
protected abstract void initMultiFetchReader(MultiFetchServerObjectReader reader)
-
setZoom
public final AbstractPrimitiveTask setZoom(boolean zoom)
Sets whether the map view should zoom to impacted primitives at the end.- Parameters:
zoom-trueif the map view should zoom to impacted primitives at the end- Returns:
this
-
setDownloadRelations
public final AbstractPrimitiveTask setDownloadRelations(boolean fullRelation)
Sets whether all members of the relation should be downloaded completely.- Parameters:
fullRelation-trueif a full download is required, i.e., a download including the immediate children of a relation.- Returns:
thissince 15811 (changed parameter list)
-
getMissingPrimitives
public java.util.Set<PrimitiveId> getMissingPrimitives()
Replies the set of ids of all primitives for which a fetch request to the server was submitted but which are not available from the server (the server replied a return code of 404)- Returns:
- the set of ids of missing primitives
-
realRun
protected void realRun() throws org.xml.sax.SAXException, java.io.IOException, OsmTransferException
Description copied from class:PleaseWaitRunnableCalled 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:
realRunin classPleaseWaitRunnable- Throws:
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 occurs
-
loadIncompleteNodes
protected void loadIncompleteNodes() throws OsmTransferException
- Throws:
OsmTransferException
-
cancel
protected void cancel()
Description copied from class:PleaseWaitRunnableUser pressed cancel button.- Specified by:
cancelin classPleaseWaitRunnable
-
finish
protected void finish()
Description copied from class:PleaseWaitRunnableFinish 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:
finishin classPleaseWaitRunnable
-
-