jsynoptic.data
Class DataSourceProvider

java.lang.Object
  extended by simtools.data.FileDataSourceProvider
      extended by 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

Field Summary
protected  javax.swing.JFileChooser fileChooser
           
static BasicMessageWriter resources
           
 
Fields inherited from class simtools.data.FileDataSourceProvider
CANCEL_OPTION, chooseAgain, filter, marker, NO_OPTION, YES_OPTION
 
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 simtools.data.FileDataSourceProvider
createCollection, createEmptyDatasource, getChooseFileAgain, getOptionalInformation, provide, setChooseFileAgain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resources

public static BasicMessageWriter resources

fileChooser

protected javax.swing.JFileChooser fileChooser
Constructor Detail

DataSourceProvider

public DataSourceProvider(javax.swing.filechooser.FileFilter filter,
                          java.lang.String marker)
Method Detail

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 collection
dscId - 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 id
dsMissingId - 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.