public class FileContentManager extends Object implements ContentManager
ContentManager.ContentType
Constructor and Description |
---|
FileContentManager(UserPreferences preferences) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
confirmOverwrite(View parentView,
String path)
Displays a dialog that let user choose whether he wants to overwrite
file
path or not. |
Content |
getContent(String contentPath)
Returns a
URL content object that references
the given file path. |
String |
getDefaultFileExtension(ContentManager.ContentType contentType)
Returns the default file extension of a given content type.
|
protected String |
getFileDialogTitle(boolean save)
Returns default file dialog title.
|
protected String[] |
getFileExtensions(ContentManager.ContentType contentType)
Returns the supported file extensions for a given content type.
|
protected FileFilter[] |
getFileFilter(ContentManager.ContentType contentType)
Returns the file filters available for a given content type.
|
protected File |
getLastDirectory(ContentManager.ContentType contentType)
Returns the last directory used for the given content type.
|
String |
getPresentationName(String contentPath,
ContentManager.ContentType contentType)
Returns the file name of the file path in parameter.
|
boolean |
isAcceptable(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,
File directory)
Stores the last directory for the given content type.
|
String |
showOpenDialog(View parentView,
String dialogTitle,
ContentManager.ContentType contentType)
Returns the file path chosen by user with an open file dialog.
|
String |
showSaveDialog(View parentView,
String dialogTitle,
ContentManager.ContentType contentType,
String path)
Returns the file path chosen by user with a save file dialog.
|
public FileContentManager(UserPreferences preferences)
public Content getContent(String contentPath) throws RecorderException
URL content
object that references
the given file path.getContent
in interface ContentManager
RecorderException
public String getPresentationName(String contentPath, ContentManager.ContentType contentType)
getPresentationName
in interface ContentManager
protected FileFilter[] getFileFilter(ContentManager.ContentType contentType)
public 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 String[] getFileExtensions(ContentManager.ContentType contentType)
public boolean isAcceptable(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 String showOpenDialog(View parentView, String dialogTitle, ContentManager.ContentType contentType)
showOpenDialog
in interface ContentManager
null
if user canceled its choice.public String showSaveDialog(View parentView, String dialogTitle, ContentManager.ContentType contentType, String path)
showSaveDialog
in interface ContentManager
null
if user canceled its choice.protected 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, File directory)
protected String getFileDialogTitle(boolean save)
© Copyrights 2006-2017 Emmanuel PUYBARET / eTeks
Distributed under GNU General Public License