public class FileUserPreferences extends UserPreferences
default user preferences
and stored in user preferences on local file system.UserPreferences.Property
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PLUGIN_LANGUAGE_LIBRARY_FAMILY |
FURNITURE_LIBRARY_TYPE, LANGUAGE_LIBRARY_TYPE, TEXTURES_LIBRARY_TYPE
Constructor and Description |
---|
FileUserPreferences()
Creates user preferences read from user preferences in file system,
and from resource files.
|
FileUserPreferences(java.io.File preferencesFolder,
java.io.File[] applicationFolders)
Creates user preferences stored in the folders given in parameter.
|
FileUserPreferences(java.io.File preferencesFolder,
java.io.File[] applicationFolders,
java.util.concurrent.Executor updater)
Creates user preferences stored in the folders given in parameter.
|
Modifier and Type | Method and Description |
---|---|
void |
addFurnitureLibrary(java.lang.String furnitureLibraryPath)
Adds the file
furnitureLibraryPath to the first furniture libraries folder
to make the furniture library available to catalog. |
void |
addLanguageLibrary(java.lang.String languageLibraryPath)
Adds
languageLibraryPath to the first language libraries folder
to make the language library it contains available to supported languages. |
void |
addTexturesLibrary(java.lang.String texturesLibraryPath)
Adds the file
texturesLibraryPath to the first textures libraries folder
to make the textures library available to catalog. |
void |
deleteLibraries(java.util.List<Library> libraries)
Deletes the given
libraries and updates user preferences. |
boolean |
furnitureLibraryExists(java.lang.String location)
Returns
true if the furniture library at the given location exists
in the first furniture libraries folder. |
java.io.File |
getApplicationFolder()
Returns the first Sweet Home 3D application folder.
|
java.io.File[] |
getApplicationFolders()
Returns Sweet Home 3D application folders.
|
java.io.File[] |
getApplicationSubfolders(java.lang.String subfolder)
Returns subfolders of Sweet Home 3D application folders of a given name.
|
protected java.io.File[] |
getFurnitureLibrariesPluginFolders()
Returns the folders where furniture catalog files are placed
or
null if that folder can't be retrieved. |
protected java.io.File[] |
getLanguageLibrariesPluginFolders()
Returns the folders where language libraries files are placed
or
null if that folder can't be retrieved. |
java.util.List<Library> |
getLibraries()
Returns the libraries available in user preferences.
|
protected java.util.prefs.Preferences |
getPreferences()
Returns default Java preferences for current system user.
|
java.util.List<java.lang.ClassLoader> |
getResourceClassLoaders()
Returns the default class loader of user preferences and the class loaders that
give access to resources in language libraries plugin folder.
|
protected java.io.File[] |
getTexturesLibrariesPluginFolders()
Returns the folders where texture catalog files are placed
or
null if that folder can't be retrieved. |
boolean |
isActionTipIgnored(java.lang.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(java.lang.String location)
Returns
true if the language library at the given location exists
in the first language libraries folder. |
protected FurnitureCatalog |
readFurnitureCatalogFromResource(java.io.File[] furniturePluginFolders)
Returns the furniture catalog contained in resources of the application and in the given plug-in folders.
|
protected FurnitureCategory |
readModifiableFurnitureCategory(java.util.prefs.Preferences preferences,
int index)
Returns the furniture category of a piece at the given
index
read from preferences . |
protected CatalogPieceOfFurniture |
readModifiablePieceOfFurniture(java.util.prefs.Preferences preferences,
int index,
java.io.File preferencesFolder)
Returns the modifiable piece of furniture read from
preferences at the given index . |
protected CatalogTexture |
readModifiableTexture(java.util.prefs.Preferences preferences,
int index,
java.io.File preferencesFolder)
Returns the modifiable texture read from
preferences at the given index . |
protected TexturesCategory |
readModifiableTextureCategory(java.util.prefs.Preferences preferences,
int index)
Returns the category of a texture at the given
index
read from preferences . |
protected TexturesCatalog |
readTexturesCatalogFromResource(java.io.File[] texturesPluginFolders)
Returns the textures catalog contained in resources of the application and in the given plug-in folders.
|
void |
resetIgnoredActionTips()
Resets the display flag of action tips.
|
void |
setActionTipIgnored(java.lang.String actionKey)
Sets which action tip should be ignored.
|
boolean |
texturesLibraryExists(java.lang.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.
|
addAutoCompletionString, addPropertyChangeListener, addPropertyChangeListener, getAutoCompletedProperties, getAutoCompletionStrings, getAutoSaveDelayForRecovery, getCurrency, getDefaultFontName, getDefaultSupportedLanguages, getDefaultTextStyle, getDefaultValueAddedTaxPercentage, getFurnitureCatalog, getFurnitureModelIconSize, getHomeExamples, getLanguage, getLengthUnit, getLocalizedString, getLocalizedString, getLocalizedStringKeys, getNewFloorThickness, getNewRoomFloorColor, getNewWallBaseboardHeight, getNewWallBaseboardThickness, getNewWallHeight, getNewWallPattern, getNewWallThickness, getPatternsCatalog, getPhotoRenderer, getRecentColors, getRecentHomes, getRecentHomesMaxCount, getRecentTextures, getStoredCamerasMaxCount, getSupportedLanguages, getTexturesCatalog, getUpdatesMinimumDate, getWallPattern, isAerialViewCenteredOnSelectionEnabled, isCheckUpdatesEnabled, isDrawingModeEnabled, isEditingIn3DViewEnabled, isFurnitureCatalogViewedInTree, isFurnitureViewedFromTop, isGridVisible, isLanguageEditable, isMagnetismEnabled, isNavigationPanelVisible, isObserverCameraSelectedAtChange, isRoomFloorColoredOrTextured, isRulersVisible, isValueAddedTaxEnabled, removePropertyChangeListener, removePropertyChangeListener, setAerialViewCenteredOnSelectionEnabled, setAutoCompletionStrings, setAutoSaveDelayForRecovery, setCheckUpdatesEnabled, setCurrency, setDefaultFontName, setDefaultValueAddedTaxPercentage, setEditingIn3DViewEnabled, setFloorColoredOrTextured, setFurnitureCatalog, setFurnitureCatalogViewedInTree, setFurnitureModelIconSize, setFurnitureViewedFromTop, setGridVisible, setHomeExamples, setLanguage, setMagnetismEnabled, setNavigationPanelVisible, setNewFloorThickness, setNewRoomFloorColor, setNewWallBaseboardHeight, setNewWallBaseboardThickness, setNewWallHeight, setNewWallPattern, setNewWallThickness, setObserverCameraSelectedAtChange, setPatternsCatalog, setPhotoRenderer, setRecentColors, setRecentHomes, setRecentTextures, setRulersVisible, setSupportedLanguages, setTexturesCatalog, setUnit, setUpdatesMinimumDate, setValueAddedTaxEnabled, setWallPattern
public static final java.lang.String PLUGIN_LANGUAGE_LIBRARY_FAMILY
public FileUserPreferences()
public FileUserPreferences(java.io.File preferencesFolder, java.io.File[] applicationFolders)
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.public FileUserPreferences(java.io.File preferencesFolder, java.io.File[] applicationFolders, java.util.concurrent.Executor updater)
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.public java.util.List<java.lang.ClassLoader> getResourceClassLoaders()
getResourceClassLoaders
in class UserPreferences
protected FurnitureCatalog readFurnitureCatalogFromResource(java.io.File[] furniturePluginFolders)
protected TexturesCatalog readTexturesCatalogFromResource(java.io.File[] texturesPluginFolders)
protected CatalogPieceOfFurniture readModifiablePieceOfFurniture(java.util.prefs.Preferences preferences, int index, java.io.File preferencesFolder)
preferences
at the given index
.
Caution : This method can be called from constructor so overriding implementations
shouldn't be based on the state of their fields.preferences
- the preferences from which piece of furniture data can be readindex
- the index of the read piecepreferencesFolder
- the folder where piece resources can be storednull
if the piece at the given index doesn't exist.protected FurnitureCategory readModifiableFurnitureCategory(java.util.prefs.Preferences preferences, int index)
index
read from preferences
.
Caution : This method can be called from constructor so overriding implementations
shouldn't be based on the state of their fields.preferences
- the preferences from which piece of furniture data can be readindex
- the index of the read pieceprotected CatalogTexture readModifiableTexture(java.util.prefs.Preferences preferences, int index, java.io.File preferencesFolder)
preferences
at the given index
.
Caution : This method can be called from constructor so overriding implementations
shouldn't be based on the state of their fields.preferences
- the preferences from which texture data can be readindex
- the index of the read texturepreferencesFolder
- the folder where textures resources can be storednull
if the texture at the given index doesn't exist.protected TexturesCategory readModifiableTextureCategory(java.util.prefs.Preferences preferences, int index)
index
read from preferences
.
Caution : This method can be called from constructor so overriding implementations
shouldn't be based on the state of their fields.preferences
- the preferences from which texture data can be readindex
- the index of the read piecepublic void write() throws RecorderException
write
in class UserPreferences
RecorderException
- if user preferences couldn'y be saved.protected java.io.File[] getLanguageLibrariesPluginFolders()
null
if that folder can't be retrieved.
Caution : This method can be called from constructor so overriding implementations
shouldn't be based on the state of their fields.protected java.io.File[] getFurnitureLibrariesPluginFolders()
null
if that folder can't be retrieved.
Caution : This method can be called from constructor so overriding implementations
shouldn't be based on the state of their fields.protected java.io.File[] getTexturesLibrariesPluginFolders()
null
if that folder can't be retrieved.
Caution : This method can be called from constructor so overriding implementations
shouldn't be based on the state of their fields.public java.io.File getApplicationFolder() throws java.io.IOException
java.io.IOException
public java.io.File[] getApplicationFolders() throws java.io.IOException
java.io.IOException
public java.io.File[] getApplicationSubfolders(java.lang.String subfolder) throws java.io.IOException
java.io.IOException
protected java.util.prefs.Preferences getPreferences()
public void setActionTipIgnored(java.lang.String actionKey)
setActionTipIgnored
in class UserPreferences
public boolean isActionTipIgnored(java.lang.String actionKey)
isActionTipIgnored
in class UserPreferences
public void resetIgnoredActionTips()
resetIgnoredActionTips
in class UserPreferences
public boolean languageLibraryExists(java.lang.String location) throws RecorderException
true
if the language library at the given location exists
in the first language libraries folder.languageLibraryExists
in class UserPreferences
location
- the file path of the resource to checkRecorderException
public void addLanguageLibrary(java.lang.String languageLibraryPath) throws RecorderException
languageLibraryPath
to the first language libraries folder
to make the language library it contains available to supported languages.addLanguageLibrary
in class UserPreferences
languageLibraryPath
- the location where the library can be found.RecorderException
public boolean furnitureLibraryExists(java.lang.String location) throws RecorderException
true
if the furniture library at the given location
exists
in the first furniture libraries folder.furnitureLibraryExists
in class UserPreferences
location
- the file path of the resource to checkRecorderException
public void addFurnitureLibrary(java.lang.String furnitureLibraryPath) throws RecorderException
furnitureLibraryPath
to the first furniture libraries folder
to make the furniture library available to catalog.addFurnitureLibrary
in class UserPreferences
furnitureLibraryPath
- the location where the library can be found.RecorderException
public boolean texturesLibraryExists(java.lang.String location) throws RecorderException
true
if the textures library at the given location
exists
in the first textures libraries folder.texturesLibraryExists
in class UserPreferences
location
- the file path of the resource to checkRecorderException
public void addTexturesLibrary(java.lang.String texturesLibraryPath) throws RecorderException
texturesLibraryPath
to the first textures libraries folder
to make the textures library available to catalog.addTexturesLibrary
in class UserPreferences
texturesLibraryPath
- the location where the library can be found.RecorderException
public java.util.List<Library> getLibraries()
getLibraries
in class UserPreferences
public void deleteLibraries(java.util.List<Library> libraries) throws RecorderException
libraries
and updates user preferences.RecorderException
public boolean isLibraryDeletable(Library library)
true
if the given file library
can be deleted.
© Copyright 2024 Space Mushrooms
Distributed under GNU General Public License