public abstract class FileImporter extends Object implements Comparable<FileImporter>, MapView.LayerChangeListener
| Modifier and Type | Field and Description |
|---|---|
private boolean |
enabled |
ExtensionFileFilter |
filter
The extension file filter used to accept files.
|
| Constructor and Description |
|---|
FileImporter(ExtensionFileFilter filter)
Constructs a new
FileImporter with the given extension file filter. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
acceptFile(File pathname)
Determines if this file importer accepts the given file.
|
void |
activeLayerChange(Layer oldLayer,
Layer newLayer)
Notifies this listener that the active layer has changed.
|
int |
compareTo(FileImporter other) |
private static void |
displayCancel(Throwable t) |
private static void |
displayError(File f,
Exception e) |
double |
getPriority()
If multiple files (with multiple file formats) are selected,
they are opened in the order of their priorities.
|
void |
importData(File file,
ProgressMonitor progressMonitor)
Needs to be implemented if isBatchImporter() returns false.
|
void |
importData(List<File> files,
ProgressMonitor progressMonitor)
Needs to be implemented if isBatchImporter() returns true.
|
boolean |
importDataHandleExceptions(File f,
ProgressMonitor progressMonitor)
Wrapper to
importData(File, ProgressMonitor) to give meaningful output if things go wrong. |
boolean |
importDataHandleExceptions(List<File> files,
ProgressMonitor progressMonitor)
Wrapper to
importData(List, ProgressMonitor) to give meaningful output if things go wrong. |
boolean |
isBatchImporter()
A batch importer is a file importer that prefers to read multiple files at the same time.
|
boolean |
isEnabled()
Returns the enabled state of this
FileImporter. |
void |
layerAdded(Layer newLayer)
Notifies this listener that a layer has been added.
|
void |
layerRemoved(Layer oldLayer)
Notifies this listener that a layer has been removed.
|
void |
setEnabled(boolean enabled)
Sets the enabled state of the
FileImporter. |
public final ExtensionFileFilter filter
private boolean enabled
public FileImporter(ExtensionFileFilter filter)
FileImporter with the given extension file filter.filter - The extension file filterpublic boolean acceptFile(File pathname)
pathname - The file to testtrue if this file importer accepts the given file, false otherwisepublic boolean isBatchImporter()
true if this importer is a batch importerpublic void importData(File file, ProgressMonitor progressMonitor) throws IOException, IllegalDataException
file - file to importprogressMonitor - progress monitorIOException - if any I/O error occursIllegalDataException - if invalid data is readpublic void importData(List<File> files, ProgressMonitor progressMonitor) throws IOException, IllegalDataException
files - files to importprogressMonitor - progress monitorIOException - if any I/O error occursIllegalDataException - if invalid data is readpublic boolean importDataHandleExceptions(File f, ProgressMonitor progressMonitor)
importData(File, ProgressMonitor) to give meaningful output if things go wrong.f - data file to importprogressMonitor - progress monitorprivate static void displayError(File f, Exception e)
private static void displayCancel(Throwable t)
public boolean importDataHandleExceptions(List<File> files, ProgressMonitor progressMonitor)
importData(List, ProgressMonitor) to give meaningful output if things go wrong.files - data files to importprogressMonitor - progress monitorpublic double getPriority()
public int compareTo(FileImporter other)
compareTo in interface Comparable<FileImporter>public final boolean isEnabled()
FileImporter. When enabled, it is listed and usable in "File->Open" dialog.FileImporter is enabledpublic final void setEnabled(boolean enabled)
FileImporter. When enabled, it is listed and usable in "File->Open" dialog.enabled - true to enable this FileImporter, false to disable itpublic void activeLayerChange(Layer oldLayer, Layer newLayer)
MapView.LayerChangeListeneractiveLayerChange in interface MapView.LayerChangeListeneroldLayer - The previous active layernewLayer - The new activer layerpublic void layerAdded(Layer newLayer)
MapView.LayerChangeListenerlayerAdded in interface MapView.LayerChangeListenernewLayer - The new added layerpublic void layerRemoved(Layer oldLayer)
MapView.LayerChangeListenerlayerRemoved in interface MapView.LayerChangeListeneroldLayer - The old removed layer