jsynoptic.data
Class DataSourceProvider
java.lang.Object
simtools.data.FileDataSourceProvider
jsynoptic.data.DataSourceProvider
- All Implemented Interfaces:
- DataSourceProvider
- Direct Known Subclasses:
- AsciiProvider
public abstract class DataSourceProvider
- extends FileDataSourceProvider
This extension of BasicDataSourceProvider is able to display graphical or batch user interfaces for file providing prosses
- Author:
- zxpletran007
Constructor Summary |
DataSourceProvider(javax.swing.filechooser.FileFilter filter,
java.lang.String marker)
|
Method Summary |
java.io.File |
chooseFile(java.lang.String fileName,
java.lang.String reason)
Provides a file, using the given fileName or not. |
int |
chooseUseCollection(DataSourceCollection existingDsc,
java.lang.String dscId,
java.lang.String id)
Chooses whether to use an already existing collection if it
contains the datasource to provide, instead of the collection
with the given id. |
protected int |
chooseUseCollectionIfMissingDs(java.lang.String dscId,
java.lang.String dsMissingId)
Chooses whether to use created collection even if required data source is missing
Default implementation says YES_OPTION. |
protected void |
initializeFileChooser()
Allow sub classes to initialise fileChooser |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
resources
public static BasicMessageWriter resources
fileChooser
protected javax.swing.JFileChooser fileChooser
DataSourceProvider
public DataSourceProvider(javax.swing.filechooser.FileFilter filter,
java.lang.String marker)
initializeFileChooser
protected void initializeFileChooser()
- Allow sub classes to initialise fileChooser
chooseUseCollection
public int chooseUseCollection(DataSourceCollection existingDsc,
java.lang.String dscId,
java.lang.String id)
- Description copied from class:
FileDataSourceProvider
- Chooses whether to use an already existing collection if it
contains the datasource to provide, instead of the collection
with the given id.
Default implementation says no.
- Overrides:
chooseUseCollection
in class FileDataSourceProvider
- Parameters:
existingDsc
- The existing collectiondscId
- The collection id to replace
- Returns:
- YES_OPTION to use the collection present in the pool, NO_OPTION to choose collection with given id,
chooseUseCollectionIfMissingDs
protected int chooseUseCollectionIfMissingDs(java.lang.String dscId,
java.lang.String dsMissingId)
- Description copied from class:
FileDataSourceProvider
- Chooses whether to use created collection even if required data source is missing
Default implementation says YES_OPTION.
- Overrides:
chooseUseCollectionIfMissingDs
in class FileDataSourceProvider
- Parameters:
dscId
- The created collection iddsMissingId
- The required data source id
- Returns:
- YES_OPTION to use the collection, NO_OPTION to choose another collection, CANCEL_OPTION to cancel opening process
chooseFile
public java.io.File chooseFile(java.lang.String fileName,
java.lang.String reason)
- Description copied from class:
FileDataSourceProvider
- Provides a file, using the given fileName or not.
Default implementation just checks if the fileName exists in the
current directory and returns it.
Subclasses should overload this function and ask the user for a file.
- Overrides:
chooseFile
in class FileDataSourceProvider
- Parameters:
fileName
- The default fileName.reason
- What to look for.
- Returns:
- A candidate File, or null if no File can be provided.