Sweet Home 3D 3.4

com.eteks.sweethome3d.swing
Class FileContentManager

java.lang.Object
  extended by com.eteks.sweethome3d.swing.FileContentManager
All Implemented Interfaces:
ContentManager
Direct Known Subclasses:
AppletContentManager

public class FileContentManager
extends java.lang.Object
implements ContentManager

Content manager for files with Swing file choosers.

Author:
Emmanuel Puybaret

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.eteks.sweethome3d.viewcontroller.ContentManager
ContentManager.ContentType
 
Constructor Summary
FileContentManager(UserPreferences preferences)
           
 
Method Summary
protected  boolean confirmOverwrite(View parentView, java.lang.String fileName)
          Displays a dialog that let user choose whether he wants to overwrite file fileName or not.
 Content getContent(java.lang.String contentName)
          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  javax.swing.filechooser.FileFilter[] getFileFilter(ContentManager.ContentType contentType)
          Returns the file filters available for a given content type.
 java.lang.String getPresentationName(java.lang.String contentName, ContentManager.ContentType contentType)
          Returns the file name of the file path in parameter.
 boolean isAcceptable(java.lang.String contentName, ContentManager.ContentType contentType)
          Returns true if the file path in parameter is accepted for contentType.
 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 name)
          Returns the file path chosen by user with a save file dialog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileContentManager

public FileContentManager(UserPreferences preferences)
Method Detail

getContent

public Content getContent(java.lang.String contentName)
                   throws RecorderException
Returns a URL content object that references the given file path.

Specified by:
getContent in interface ContentManager
Throws:
RecorderException

getPresentationName

public java.lang.String getPresentationName(java.lang.String contentName,
                                            ContentManager.ContentType contentType)
Returns the file name of the file path in parameter.

Specified by:
getPresentationName in interface ContentManager

getFileFilter

protected javax.swing.filechooser.FileFilter[] getFileFilter(ContentManager.ContentType contentType)
Returns the file filters available for a given content type. This method may be overridden to add some file filters to existing content types or to define the filters of a user defined content type.


getDefaultFileExtension

public java.lang.String getDefaultFileExtension(ContentManager.ContentType contentType)
Returns the default file extension of a given content type. If not 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.


isAcceptable

public boolean isAcceptable(java.lang.String contentName,
                            ContentManager.ContentType contentType)
Returns true if the file path in parameter is accepted for contentType.

Specified by:
isAcceptable in interface ContentManager

showOpenDialog

public 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.

Specified by:
showOpenDialog in interface ContentManager
Returns:
the file path or null if user canceled its choice.

showSaveDialog

public java.lang.String showSaveDialog(View parentView,
                                       java.lang.String dialogTitle,
                                       ContentManager.ContentType contentType,
                                       java.lang.String name)
Returns the file path chosen by user with a save file dialog. If this file already exists, the user will be prompted whether he wants to overwrite this existing file.

Specified by:
showSaveDialog in interface ContentManager
Returns:
the chosen file path or null if user canceled its choice.

getFileDialogTitle

protected java.lang.String getFileDialogTitle(boolean save)
Returns default file dialog title.


confirmOverwrite

protected boolean confirmOverwrite(View parentView,
                                   java.lang.String fileName)
Displays a dialog that let user choose whether he wants to overwrite file fileName or not.

Returns:
true if user confirmed to overwrite.

Sweet Home 3D 3.4

? Copyrights 2006-2011 eTeks - All rights reserved
Distributed under GNU General Public License