Sweet Home 3D 4.0

com.eteks.sweethome3d.io
Class FileUserPreferences

java.lang.Object
  extended by com.eteks.sweethome3d.model.UserPreferences
      extended by com.eteks.sweethome3d.io.FileUserPreferences

public class FileUserPreferences
extends UserPreferences

User preferences initialized from default user preferences and stored in user preferences on local file system.

Author:
Emmanuel Puybaret

Nested Class Summary
 
Nested classes/interfaces inherited from class com.eteks.sweethome3d.model.UserPreferences
UserPreferences.Property
 
Field Summary
static String PLUGIN_LANGUAGE_LIBRARY_FAMILY
           
 
Fields inherited from class com.eteks.sweethome3d.model.UserPreferences
FURNITURE_LIBRARY_TYPE, LANGUAGE_LIBRARY_TYPE, TEXTURES_LIBRARY_TYPE
 
Constructor Summary
FileUserPreferences()
          Creates user preferences read from user preferences in file system, and from resource files.
FileUserPreferences(File preferencesFolder, File[] applicationFolders)
          Creates user preferences stored in the folders given in parameter.
FileUserPreferences(File preferencesFolder, File[] applicationFolders, Executor updater)
          Creates user preferences stored in the folders given in parameter.
 
Method Summary
 void addFurnitureLibrary(String furnitureLibraryPath)
          Adds the file furnitureLibraryPath to the first furniture libraries folder to make the furniture library available to catalog.
 void addLanguageLibrary(String languageLibraryPath)
          Adds languageLibraryPath to the first language libraries folder to make the language library it contains available to supported languages.
 void addTexturesLibrary(String texturesLibraryPath)
          Adds the file texturesLibraryPath to the first textures libraries folder to make the textures library available to catalog.
 void deleteLibraries(List<Library> libraries)
          Deletes the given file libraries and updates user preferences.
 boolean furnitureLibraryExists(String location)
          Returns true if the furniture library at the given location exists in the first furniture libraries folder.
 File getApplicationFolder()
          Returns the first Sweet Home 3D application folder.
 File[] getApplicationFolders()
          Returns Sweet Home 3D application folders.
 File[] getApplicationSubfolders(String subfolder)
          Returns subfolders of Sweet Home 3D application folders of a given name.
 List<Library> getLibraries()
          Returns the libraries available in user preferences.
protected  Preferences getPreferences()
          Returns default Java preferences for current system user.
 List<ClassLoader> getResourceClassLoaders()
          Returns the default class loader of user preferences and the class loaders that give access to resources in language libraries plugin folder.
 boolean isActionTipIgnored(String actionKey)
          Returns whether an action tip should be ignored or not.
 boolean isLibraryDeletable(Library library)
          Returns true if the given file library can be deleted.
 boolean languageLibraryExists(String location)
          Returns true if the language library at the given location exists in the first language libraries folder.
 void resetIgnoredActionTips()
          Resets the display flag of action tips.
 void setActionTipIgnored(String actionKey)
          Sets which action tip should be ignored.
 boolean texturesLibraryExists(String location)
          Returns true if the textures library at the given location exists in the first textures libraries folder.
 void write()
          Writes user preferences in current user preferences in system.
 
Methods inherited from class com.eteks.sweethome3d.model.UserPreferences
addAutoCompletionString, addPropertyChangeListener, getAutoCompletedProperties, getAutoCompletionStrings, getAutoSaveDelayForRecovery, getCurrency, getDefaultSupportedLanguages, getDefaultTextStyle, getFurnitureCatalog, getLanguage, getLengthUnit, getLocalizedString, getLocalizedString, getNewFloorThickness, getNewWallHeight, getNewWallPattern, getNewWallThickness, getPatternsCatalog, getRecentColors, getRecentHomes, getRecentHomesMaxCount, getSupportedLanguages, getTexturesCatalog, getUpdatesMinimumDate, getWallPattern, isAerialViewCenteredOnSelectionEnabled, isCheckUpdatesEnabled, isFurnitureCatalogViewedInTree, isFurnitureViewedFromTop, isGridVisible, isLanguageEditable, isMagnetismEnabled, isNavigationPanelVisible, isRoomFloorColoredOrTextured, isRulersVisible, removePropertyChangeListener, setAerialViewCenteredOnSelectionEnabled, setAutoCompletionStrings, setAutoSaveDelayForRecovery, setCheckUpdatesEnabled, setCurrency, setFloorColoredOrTextured, setFurnitureCatalog, setFurnitureCatalogViewedInTree, setFurnitureViewedFromTop, setGridVisible, setLanguage, setMagnetismEnabled, setNavigationPanelVisible, setNewFloorThickness, setNewWallHeight, setNewWallPattern, setNewWallThickness, setPatternsCatalog, setRecentColors, setRecentHomes, setRulersVisible, setSupportedLanguages, setTexturesCatalog, setUnit, setUpdatesMinimumDate, setWallPattern
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLUGIN_LANGUAGE_LIBRARY_FAMILY

public static final String PLUGIN_LANGUAGE_LIBRARY_FAMILY
See Also:
Constant Field Values
Constructor Detail

FileUserPreferences

public FileUserPreferences()
Creates user preferences read from user preferences in file system, and from resource files.


FileUserPreferences

public FileUserPreferences(File preferencesFolder,
                           File[] applicationFolders)
Creates user preferences stored in the folders given in parameter.

Parameters:
preferencesFolder - the folder where preferences files are stored or null if this folder is the default one.
applicationFolders - the folders where application private files are stored or null if it's the default one. As the first application folder is used as the folder where plug-ins files are imported by the user, it should have write access otherwise the user won't be able to import them.

FileUserPreferences

public FileUserPreferences(File preferencesFolder,
                           File[] applicationFolders,
                           Executor updater)
Creates user preferences stored in the folders given in parameter.

Parameters:
preferencesFolder - the folder where preferences files are stored or null if this folder is the default one.
applicationFolders - the folders where application private files are stored or null if it's the default one. As the first application folder is used as the folder where plug-ins files are imported by the user, it should have write access otherwise the user won't be able to import them.
updater - an executor that will be used to update user preferences for lengthy operations. If null, then these operations and updates will be executed in the current thread.
Method Detail

getResourceClassLoaders

public List<ClassLoader> getResourceClassLoaders()
Returns the default class loader of user preferences and the class loaders that give access to resources in language libraries plugin folder.

Overrides:
getResourceClassLoaders in class UserPreferences

write

public void write()
           throws RecorderException
Writes user preferences in current user preferences in system.

Specified by:
write in class UserPreferences
Throws:
RecorderException - if user preferences couldn'y be saved.

getApplicationFolder

public File getApplicationFolder()
                          throws IOException
Returns the first Sweet Home 3D application folder.

Throws:
IOException

getApplicationFolders

public File[] getApplicationFolders()
                             throws IOException
Returns Sweet Home 3D application folders.

Throws:
IOException

getApplicationSubfolders

public File[] getApplicationSubfolders(String subfolder)
                                throws IOException
Returns subfolders of Sweet Home 3D application folders of a given name.

Throws:
IOException

getPreferences

protected Preferences getPreferences()
Returns default Java preferences for current system user. Caution : This method is called once in constructor so overriding implementations shouldn't be based on the state of their fields.


setActionTipIgnored

public void setActionTipIgnored(String actionKey)
Sets which action tip should be ignored.

Overrides:
setActionTipIgnored in class UserPreferences

isActionTipIgnored

public boolean isActionTipIgnored(String actionKey)
Returns whether an action tip should be ignored or not.

Overrides:
isActionTipIgnored in class UserPreferences

resetIgnoredActionTips

public void resetIgnoredActionTips()
Resets the display flag of action tips.

Overrides:
resetIgnoredActionTips in class UserPreferences

languageLibraryExists

public boolean languageLibraryExists(String location)
                              throws RecorderException
Returns true if the language library at the given location exists in the first language libraries folder.

Specified by:
languageLibraryExists in class UserPreferences
Parameters:
location - the file path of the resource to check
Throws:
RecorderException

addLanguageLibrary

public void addLanguageLibrary(String languageLibraryPath)
                        throws RecorderException
Adds languageLibraryPath to the first language libraries folder to make the language library it contains available to supported languages.

Specified by:
addLanguageLibrary in class UserPreferences
Parameters:
languageLibraryPath - the location where the library can be found.
Throws:
RecorderException

furnitureLibraryExists

public boolean furnitureLibraryExists(String location)
                               throws RecorderException
Returns true if the furniture library at the given location exists in the first furniture libraries folder.

Specified by:
furnitureLibraryExists in class UserPreferences
Parameters:
location - the file path of the resource to check
Throws:
RecorderException

addFurnitureLibrary

public void addFurnitureLibrary(String furnitureLibraryPath)
                         throws RecorderException
Adds the file furnitureLibraryPath to the first furniture libraries folder to make the furniture library available to catalog.

Specified by:
addFurnitureLibrary in class UserPreferences
Parameters:
furnitureLibraryPath - the location where the library can be found.
Throws:
RecorderException

texturesLibraryExists

public boolean texturesLibraryExists(String location)
                              throws RecorderException
Returns true if the textures library at the given location exists in the first textures libraries folder.

Specified by:
texturesLibraryExists in class UserPreferences
Parameters:
location - the file path of the resource to check
Throws:
RecorderException

addTexturesLibrary

public void addTexturesLibrary(String texturesLibraryPath)
                        throws RecorderException
Adds the file texturesLibraryPath to the first textures libraries folder to make the textures library available to catalog.

Specified by:
addTexturesLibrary in class UserPreferences
Parameters:
texturesLibraryPath - the location where the library can be found.
Throws:
RecorderException

getLibraries

public List<Library> getLibraries()
Returns the libraries available in user preferences.

Specified by:
getLibraries in class UserPreferences
Since:
4.0

deleteLibraries

public void deleteLibraries(List<Library> libraries)
                     throws RecorderException
Deletes the given file libraries and updates user preferences.

Throws:
RecorderException
Since:
4.0

isLibraryDeletable

public boolean isLibraryDeletable(Library library)
Returns true if the given file library can be deleted.

Since:
4.0

Sweet Home 3D 4.0

© Copyrights 2006-2013 eTeks - All rights reserved
Distributed under GNU General Public License