public class FileContentManager extends java.lang.Object implements ContentManager
ContentManager.ContentType
Constructor and Description |
---|
FileContentManager(UserPreferences preferences) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
confirmOverwrite(View parentView,
java.lang.String path)
Displays a dialog that let user choose whether he wants to overwrite
file
path or not. |
Content |
getContent(java.lang.String contentPath)
Returns a
URL content object that references
the given file path. |
java.lang.String |
getDefaultFileExtension(ContentManager.ContentType contentType)
Returns the default file extension of a given content type.
|
protected java.lang.String |
getFileDialogTitle(boolean save)
Returns default file dialog title.
|
protected java.lang.String[] |
getFileExtensions(ContentManager.ContentType contentType)
Returns the supported file extensions for a given content type.
|
protected javax.swing.filechooser.FileFilter[] |
getFileFilter(ContentManager.ContentType contentType)
Returns the file filters available for a given content type.
|
protected java.io.File |
getLastDirectory(ContentManager.ContentType contentType)
Returns the last directory used for the given content type.
|
java.lang.String |
getPresentationName(java.lang.String contentPath,
ContentManager.ContentType contentType)
Returns the file name of the file path in parameter.
|
boolean |
isAcceptable(java.lang.String contentPath,
ContentManager.ContentType contentType)
Returns
true if the file path in parameter is accepted
for contentType . |
protected boolean |
isDirectory(ContentManager.ContentType contentType)
Returns
true if the given content type is for directories. |
protected void |
setLastDirectory(ContentManager.ContentType contentType,
java.io.File directory)
Stores the last directory for the given content type.
|
java.lang.String |
showOpenDialog(View parentView,
java.lang.String dialogTitle,
ContentManager.ContentType contentType)
Returns the file path chosen by user with an open file dialog.
|
java.lang.String |
showSaveDialog(View parentView,
java.lang.String dialogTitle,
ContentManager.ContentType contentType,
java.lang.String path)
Returns the file path chosen by user with a save file dialog.
|
public FileContentManager(UserPreferences preferences)
public Content getContent(java.lang.String contentPath) throws RecorderException
URL content
object that references
the given file path.getContent
in interface ContentManager
RecorderException
public java.lang.String getPresentationName(java.lang.String contentPath, ContentManager.ContentType contentType)
getPresentationName
in interface ContentManager
protected javax.swing.filechooser.FileFilter[] getFileFilter(ContentManager.ContentType contentType)
public java.lang.String getDefaultFileExtension(ContentManager.ContentType contentType)
null
this extension will be appended automatically
to the file name chosen by user in save dialog.
This method may be overridden to change the default file extension of an existing content type
or to define the default file extension of a user defined content type.protected java.lang.String[] getFileExtensions(ContentManager.ContentType contentType)
public boolean isAcceptable(java.lang.String contentPath, ContentManager.ContentType contentType)
true
if the file path in parameter is accepted
for contentType
.isAcceptable
in interface ContentManager
protected boolean isDirectory(ContentManager.ContentType contentType)
true
if the given content type is for directories.public java.lang.String showOpenDialog(View parentView, java.lang.String dialogTitle, ContentManager.ContentType contentType)
showOpenDialog
in interface ContentManager
null
if user canceled its choice.public java.lang.String showSaveDialog(View parentView, java.lang.String dialogTitle, ContentManager.ContentType contentType, java.lang.String path)
showSaveDialog
in interface ContentManager
null
if user canceled its choice.protected java.io.File getLastDirectory(ContentManager.ContentType contentType)
contentType
or the default last directory
if it's not set. If contentType
is null
, the
returned directory will be the default last one or null
if it's not set yet.protected void setLastDirectory(ContentManager.ContentType contentType, java.io.File directory)
protected java.lang.String getFileDialogTitle(boolean save)
protected boolean confirmOverwrite(View parentView, java.lang.String path)
path
or not.true
if user confirmed to overwrite.
© Copyright 2024 Space Mushrooms
Distributed under GNU General Public License