Sweet Home 3D 4.0

com.eteks.sweethome3d.io
Class DefaultFurnitureCatalog

java.lang.Object
  extended by com.eteks.sweethome3d.model.FurnitureCatalog
      extended by com.eteks.sweethome3d.io.DefaultFurnitureCatalog

public class DefaultFurnitureCatalog
extends FurnitureCatalog

Furniture default catalog read from resources localized in .properties files.

Author:
Emmanuel Puybaret

Nested Class Summary
static class DefaultFurnitureCatalog.PropertyKey
          The keys of the properties values read in .properties files.
 
Field Summary
static String PLUGIN_FURNITURE_CATALOG_FAMILY
          The name of .properties family files in plugin furniture catalog files.
 
Constructor Summary
DefaultFurnitureCatalog()
          Creates a default furniture catalog read from resources in the package of this class.
DefaultFurnitureCatalog(File furniturePluginFolder)
          Creates a default furniture catalog read from resources and furniture plugin folder if furniturePluginFolder isn't null.
DefaultFurnitureCatalog(URL[] pluginFurnitureCatalogUrls)
          Creates a default furniture catalog read only from resources in the given URLs.
DefaultFurnitureCatalog(URL[] pluginFurnitureCatalogUrls, URL furnitureResourcesUrlBase)
          Creates a default furniture catalog read only from resources in the given URLs or in the classpath if the security manager doesn't allow to create class loaders.
DefaultFurnitureCatalog(UserPreferences preferences, File furniturePluginFolder)
          Creates a default furniture catalog read from resources and furniture plugin folder if furniturePluginFolder isn't null.
DefaultFurnitureCatalog(UserPreferences preferences, File[] furniturePluginFolders)
          Creates a default furniture catalog read from resources and furniture plugin folders if furniturePluginFolders isn't null.
 
Method Summary
 List<Library> getLibraries()
          Returns the furniture libraries at initialization.
protected  FurnitureCategory readFurnitureCategory(ResourceBundle resource, int index)
          Returns the furniture category of a piece at the given index of a localized resource bundle.
protected  CatalogPieceOfFurniture readPieceOfFurniture(ResourceBundle resource, int index, URL furnitureCatalogUrl, URL furnitureResourcesUrlBase)
          Returns the piece of furniture at the given index of a localized resource bundle.
 
Methods inherited from class com.eteks.sweethome3d.model.FurnitureCatalog
add, addFurnitureListener, delete, getCategories, getCategoriesCount, getCategory, removeFurnitureListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLUGIN_FURNITURE_CATALOG_FAMILY

public static final String PLUGIN_FURNITURE_CATALOG_FAMILY
The name of .properties family files in plugin furniture catalog files.

See Also:
Constant Field Values
Constructor Detail

DefaultFurnitureCatalog

public DefaultFurnitureCatalog()
Creates a default furniture catalog read from resources in the package of this class.


DefaultFurnitureCatalog

public DefaultFurnitureCatalog(File furniturePluginFolder)
Creates a default furniture catalog read from resources and furniture plugin folder if furniturePluginFolder isn't null.


DefaultFurnitureCatalog

public DefaultFurnitureCatalog(UserPreferences preferences,
                               File furniturePluginFolder)
Creates a default furniture catalog read from resources and furniture plugin folder if furniturePluginFolder isn't null.


DefaultFurnitureCatalog

public DefaultFurnitureCatalog(UserPreferences preferences,
                               File[] furniturePluginFolders)
Creates a default furniture catalog read from resources and furniture plugin folders if furniturePluginFolders isn't null.


DefaultFurnitureCatalog

public DefaultFurnitureCatalog(URL[] pluginFurnitureCatalogUrls)
Creates a default furniture catalog read only from resources in the given URLs.


DefaultFurnitureCatalog

public DefaultFurnitureCatalog(URL[] pluginFurnitureCatalogUrls,
                               URL furnitureResourcesUrlBase)
Creates a default furniture catalog read only from resources in the given URLs or in the classpath if the security manager doesn't allow to create class loaders. Model and icon URLs will built from furnitureResourcesUrlBase if it isn't null.

Method Detail

getLibraries

public List<Library> getLibraries()
Returns the furniture libraries at initialization.

Since:
4.0

readPieceOfFurniture

protected CatalogPieceOfFurniture readPieceOfFurniture(ResourceBundle resource,
                                                       int index,
                                                       URL furnitureCatalogUrl,
                                                       URL furnitureResourcesUrlBase)
Returns the piece of furniture at the given index of a localized resource bundle.

Parameters:
resource - a resource bundle
index - the index of the read piece
furnitureCatalogUrl - the URL from which piece resources will be loaded or null if it's read from current classpath.
furnitureResourcesUrlBase - the URL used as a base to build the URL to piece resources or null if it's read from current classpath or furnitureCatalogUrl
Returns:
the read piece of furniture or null if the piece at the given index doesn't exist.
Throws:
MissingResourceException - if mandatory keys are not defined.

readFurnitureCategory

protected FurnitureCategory readFurnitureCategory(ResourceBundle resource,
                                                  int index)
Returns the furniture category of a piece at the given index of a localized resource bundle.

Throws:
MissingResourceException - if mandatory keys are not defined.

Sweet Home 3D 4.0

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