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 boolean
canceled
private java.util.Set<java.lang.String>
errorMessages
private GpxLayer
gpxLayer
private java.util.List<GeoImageLayer>
layers
private java.util.Set<java.lang.String>
loadedDirectories
private static BooleanProperty
PROP_ONE_LAYER_PER_FOLDER
private 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 void
addRecursiveFiles(java.util.Collection<java.io.File> files, java.util.Collection<java.io.File> sel)
protected void
cancel()
User pressed cancel button.protected void
finish()
Finish up the data work.private java.lang.String
formatErrorMessages()
protected void
realRun()
Called in the worker thread to do the actual work.private void
rememberError(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: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 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: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 classPleaseWaitRunnable
-
cancel
protected void cancel()
Description copied from class:PleaseWaitRunnable
User pressed cancel button.- Specified by:
cancel
in classPleaseWaitRunnable
-
-