CH.ifa.draw.util
Class StorageFormatManager
- java.lang.Object
-
- CH.ifa.draw.util.StorageFormatManager
-
public class StorageFormatManager extends java.lang.ObjectThe StorageFormatManager is a contains StorageFormats. It is not a Singleton because it could be necessary to deal with different format managers, e.g. one for importing Drawings, one for exporting Drawings. If one StorageFormat matches the file extension of the Drawing file, then this StorageFormat can be used to store or restore the Drawing.- See Also:
StorageFormat
-
-
Constructor Summary
Constructors Constructor and Description StorageFormatManager()Create a new StorageFormatManager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddStorageFormat(StorageFormat newStorageFormat)Add a StorageFormat that should be supported by this StorageFormatManager.booleancontainsStorageFormat(StorageFormat checkStorageFormat)Test, whether a StorageFormat is supported by this StorageFormatStorageFormatfindStorageFormat(javax.swing.filechooser.FileFilter findFileFilter)Find a StorageFormat that can be used according to a FileFilter to store a Drawing in a file or restore it from a file respectively.StorageFormatgetDefaultStorageFormat()Return the StorageFormat which is used as selected file format in a javax.swing.JFileChooservoidregisterFileFilters(javax.swing.JFileChooser fileChooser)Register all FileFilters supported by StorageFormatsvoidremoveStorageFormat(StorageFormat oldStorageFormat)Remove a StorageFormat that should no longer be supported by this StorageFormatManager.voidsetDefaultStorageFormat(StorageFormat newDefaultStorageFormat)Set a StorageFormat as the default storage format which is selected in a javax.swing.JFileChooser.
-
-
-
Constructor Detail
-
StorageFormatManager
public StorageFormatManager()
Create a new StorageFormatManager.
-
-
Method Detail
-
addStorageFormat
public void addStorageFormat(StorageFormat newStorageFormat)
Add a StorageFormat that should be supported by this StorageFormatManager.- Parameters:
newStorageFormat- new StorageFormat to be supported
-
removeStorageFormat
public void removeStorageFormat(StorageFormat oldStorageFormat)
Remove a StorageFormat that should no longer be supported by this StorageFormatManager. The StorageFormat is excluded in when search for a StorageFormat.- Parameters:
oldStorageFormat- old StorageFormat no longer to be supported
-
containsStorageFormat
public boolean containsStorageFormat(StorageFormat checkStorageFormat)
Test, whether a StorageFormat is supported by this StorageFormat
-
setDefaultStorageFormat
public void setDefaultStorageFormat(StorageFormat newDefaultStorageFormat)
Set a StorageFormat as the default storage format which is selected in a javax.swing.JFileChooser. The default storage format must be already added with addStorageFormat. Setting the default storage format to null does not automatically remove the StorageFormat from the list of supported StorageFormats.- Parameters:
newDefaultStorageFormat- StorageFormat that should be selected in a JFileChooser
-
getDefaultStorageFormat
public StorageFormat getDefaultStorageFormat()
Return the StorageFormat which is used as selected file format in a javax.swing.JFileChooser- Returns:
- default storage format
-
registerFileFilters
public void registerFileFilters(javax.swing.JFileChooser fileChooser)
Register all FileFilters supported by StorageFormats- Parameters:
fileChooser- javax.swing.JFileChooser to which FileFilters are added
-
findStorageFormat
public StorageFormat findStorageFormat(javax.swing.filechooser.FileFilter findFileFilter)
Find a StorageFormat that can be used according to a FileFilter to store a Drawing in a file or restore it from a file respectively.- Parameters:
findFileFilter- FileFilter used to identify a StorageFormat- Returns:
- StorageFormat, if a matching file extension could be found, false otherwise
-
-
DataMelt 3.0 © DataMelt by jWork.ORG