Class ImagesLoader
- java.lang.Object
-
- org.openstreetmap.josm.gui.PleaseWaitRunnable
-
- org.openstreetmap.josm.gui.layer.geoimage.ImagesLoader
-
- All Implemented Interfaces:
java.lang.Runnable,ProgressMonitor.CancelListener
final class ImagesLoader extends PleaseWaitRunnable
Loads a set of images, while displaying a dialog that indicates what the plugin is currently doing. In facts, this object is instantiated with a list of files. These files may be JPEG files or directories. In case of directories, they are scanned to find all the images they contain. Then all the images that have be found are loaded as ImageEntry instances.- Since:
- 18035 (extracted from GeoImageLayer)
-
-
Field Summary
Fields Modifier and Type Field Description private booleancanceledprivate java.util.Set<java.lang.String>errorMessagesprivate GpxLayergpxLayerprivate java.util.List<GeoImageLayer>layersprivate java.util.Set<java.lang.String>loadedDirectoriesprivate static BooleanPropertyPROP_ONE_LAYER_PER_FOLDERprivate java.util.Collection<java.io.File>selection-
Fields inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
progressMonitor
-
-
Constructor Summary
Constructors Constructor Description ImagesLoader(java.util.Collection<java.io.File> selection, GpxLayer gpxLayer)Constructs a newImagesLoader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddRecursiveFiles(java.util.Collection<java.io.File> files, java.util.Collection<java.io.File> sel)protected voidcancel()User pressed cancel button.protected voidfinish()Finish up the data work.private java.lang.StringformatErrorMessages()protected voidrealRun()Called in the worker thread to do the actual work.private voidrememberError(java.lang.String message)-
Methods inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
afterFinish, canRunInBackground, getProgressMonitor, operationCanceled, run
-
-
-
-
Field Detail
-
canceled
private boolean canceled
-
layers
private final java.util.List<GeoImageLayer> layers
-
selection
private final java.util.Collection<java.io.File> selection
-
loadedDirectories
private final java.util.Set<java.lang.String> loadedDirectories
-
errorMessages
private final java.util.Set<java.lang.String> errorMessages
-
PROP_ONE_LAYER_PER_FOLDER
private static final BooleanProperty PROP_ONE_LAYER_PER_FOLDER
-
-
Constructor Detail
-
ImagesLoader
ImagesLoader(java.util.Collection<java.io.File> selection, GpxLayer gpxLayer)
Constructs a newImagesLoader.- Parameters:
selection- image files to loadgpxLayer- associated GPX layer
-
-
Method Detail
-
rememberError
private void rememberError(java.lang.String message)
-
realRun
protected void realRun() throws java.io.IOException
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:
java.io.IOException- if an I/O error occurs
-
addRecursiveFiles
private void addRecursiveFiles(java.util.Collection<java.io.File> files, java.util.Collection<java.io.File> sel)
-
formatErrorMessages
private java.lang.String formatErrorMessages()
-
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
-
cancel
protected void cancel()
Description copied from class:PleaseWaitRunnableUser pressed cancel button.- Specified by:
cancelin classPleaseWaitRunnable
-
-