Sweet Home 3D 3.4

com.eteks.sweethome3d.model
Class Home

java.lang.Object
  extended by com.eteks.sweethome3d.model.Home
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Home
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

The home managed by the application with its furniture and walls.

Author:
Emmanuel Puybaret
See Also:
Serialized Form

Nested Class Summary
static class Home.Property
          The properties of a home that may change.
 
Field Summary
static long CURRENT_VERSION
          The current version of this home.
 
Constructor Summary
Home()
          Creates a home with no furniture, no walls, and a height equal to 250 cm.
Home(float wallHeight)
          Creates a home with no furniture and no walls.
Home(java.util.List<HomePieceOfFurniture> furniture)
          Creates a home with the given furniture, no walls and a height equal to 250 cm.
 
Method Summary
 void addDimensionLine(DimensionLine dimensionLine)
          Adds the given dimension line to the set of dimension lines of this home.
 void addDimensionLinesListener(CollectionListener<DimensionLine> listener)
          Adds the dimension line listener in parameter to this home.
 void addFurnitureListener(CollectionListener<HomePieceOfFurniture> listener)
          Adds the furniture listener in parameter to this home.
 void addLabel(Label label)
          Adds the given label to the set of labels of this home.
 void addLabelsListener(CollectionListener<Label> listener)
          Adds the label listener in parameter to this home.
 void addLevel(Level level)
          Adds the given level to the list of levels of this home.
 void addLevelsListener(CollectionListener<Level> listener)
          Adds the level listener in parameter to this home.
 void addPieceOfFurniture(HomePieceOfFurniture piece)
          Adds the piece in parameter to this home.
 void addPieceOfFurniture(HomePieceOfFurniture piece, int index)
          Adds the piece in parameter at a given index.
 void addPropertyChangeListener(Home.Property property, java.beans.PropertyChangeListener listener)
          Adds the property change listener in parameter to this home.
 void addRoom(Room room)
          Adds the given room to the list of rooms of this home.
 void addRoom(Room room, int index)
          Adds the room in parameter at a given index.
 void addRoomsListener(CollectionListener<Room> listener)
          Adds the room listener in parameter to this home.
 void addSelectionListener(SelectionListener listener)
          Adds the selection listener in parameter to this home.
 void addWall(Wall wall)
          Adds the given wall to the set of walls of this home.
 void addWallsListener(CollectionListener<Wall> listener)
          Adds the wall listener in parameter to this home.
 Home clone()
          Returns a clone of this home and the objects it contains.
 void deleteDimensionLine(DimensionLine dimensionLine)
          Removes the given dimension line from the set of dimension lines of this home.
 void deleteLabel(Label label)
          Removes the given label from the set of labels of this home.
 void deleteLevel(Level level)
          Removes the given level from the set of levels of this home and all the furniture, walls, rooms, dimension lines and labels that belong to this level.
 void deletePieceOfFurniture(HomePieceOfFurniture piece)
          Deletes the piece in parameter from this home.
 void deleteRoom(Room room)
          Removes the given room from the set of rooms of this home.
 void deleteWall(Wall wall)
          Removes the given wall from the set of walls of this home.
 void deselectItem(Selectable item)
          Deselects item if it's selected and notifies listeners selection change.
static java.util.List<Selectable> duplicate(java.util.List<? extends Selectable> items)
          Returns a deep copy of home selectable items.
 BackgroundImage getBackgroundImage()
          Returns the plan background image of this home.
 Camera getCamera()
          Returns the camera used to display this home.
 Compass getCompass()
          Returns the compass associated to this home.
 java.util.Collection<DimensionLine> getDimensionLines()
          Returns an unmodifiable collection of the dimension lines of this home.
static java.util.List<DimensionLine> getDimensionLinesSubList(java.util.List<? extends Selectable> items)
          Returns a sub list of items that contains only dimension lines.
 HomeEnvironment getEnvironment()
          Returns the environment attributes of this home.
 java.util.List<HomePieceOfFurniture> getFurniture()
          Returns an unmodifiable list of the furniture managed by this home.
 HomePieceOfFurniture.SortableProperty getFurnitureSortedProperty()
          Returns the furniture property on which home is sorted or null if home furniture isn't sorted.
static java.util.List<HomePieceOfFurniture> getFurnitureSubList(java.util.List<? extends Selectable> items)
          Returns a sub list of items that contains only home furniture.
 java.util.List<HomePieceOfFurniture.SortableProperty> getFurnitureVisibleProperties()
          Returns an unmodifiable list of the furniture properties that are visible.
 java.util.Collection<Label> getLabels()
          Returns an unmodifiable collection of the labels of this home.
static java.util.List<Label> getLabelsSubList(java.util.List<? extends Selectable> items)
          Returns a sub list of items that contains only labels.
 java.util.List<Level> getLevels()
          Returns an unmodifiable collection of the levels of this home.
static java.util.List<Level> getLevelsSubList(java.util.List<? extends Selectable> items)
          Returns a sub list of items that contains only levels.
 java.lang.String getName()
          Returns the name of this home.
 ObserverCamera getObserverCamera()
          Returns the camera used to display this home from an observer point of view.
 HomePrint getPrint()
          Returns the print attributes of this home.
 java.util.List<Room> getRooms()
          Returns an unmodifiable collection of the rooms of this home.
static java.util.List<Room> getRoomsSubList(java.util.List<? extends Selectable> items)
          Returns a sub list of items that contains only rooms.
 java.util.List<Selectable> getSelectedItems()
          Returns an unmodifiable list of the selected items in home.
 Level getSelectedLevel()
          Returns the selected level in home or null if home has no level.
 java.util.List<Camera> getStoredCameras()
          Returns an unmodifiable list of the cameras stored by this home.
static
<T> java.util.List<T>
getSubList(java.util.List<? extends Selectable> items, java.lang.Class<T> subListClass)
          Returns a sub list of items that contains only instances of subListClass.
 Camera getTopCamera()
          Returns the camera used to display this home from a top point of view.
 long getVersion()
          Returns the version of this home, the last time it was serialized or or CURRENT_VERSION if it is not serialized yet or was serialized with Sweet Home 3D 0.x.
 java.lang.Object getVisualProperty(java.lang.String propertyName)
          Returns the value of the visual property propertyName associated with this home.
 float getWallHeight()
          Returns the wall height of this home.
 java.util.Collection<Wall> getWalls()
          Returns an unmodifiable collection of the walls of this home.
static java.util.List<Wall> getWallsSubList(java.util.List<? extends Selectable> items)
          Returns a sub list of items that contains only walls.
 boolean isBasePlanLocked()
          Returns true if the home objects belonging to the base plan (generally walls, rooms, dimension lines and texts) are locked.
 boolean isEmpty()
          Returns true if this home doesn't contain any item i.e.
 boolean isFurnitureDescendingSorted()
          Returns whether furniture is sorted in ascending or descending order.
 boolean isModified()
          Returns whether the state of this home is modified or not.
 boolean isRecovered()
          Returns whether this home was recovered or not.
 void removeDimensionLinesListener(CollectionListener<DimensionLine> listener)
          Removes the dimension line listener in parameter from this home.
 void removeFurnitureListener(CollectionListener<HomePieceOfFurniture> listener)
          Removes the furniture listener in parameter from this home.
 void removeLabelsListener(CollectionListener<Label> listener)
          Removes the label listener in parameter from this home.
 void removeLevelsListener(CollectionListener<Level> listener)
          Removes the level listener in parameter from this home.
 void removePropertyChangeListener(Home.Property property, java.beans.PropertyChangeListener listener)
          Removes the property change listener in parameter from this home.
 void removeRoomsListener(CollectionListener<Room> listener)
          Removes the room listener in parameter from this home.
 void removeSelectionListener(SelectionListener listener)
          Removes the selection listener in parameter from this home.
 void removeWallsListener(CollectionListener<Wall> listener)
          Removes the wall listener in parameter from this home.
 void setBackgroundImage(BackgroundImage backgroundImage)
          Sets the plan background image of this home and fires a PropertyChangeEvent.
 void setBasePlanLocked(boolean basePlanLocked)
          Sets whether home objects belonging to the base plan (generally walls, rooms, dimension lines and texts) are locked and fires a PropertyChangeEvent.
 void setCamera(Camera camera)
          Sets the camera used to display this home and fires a PropertyChangeEvent.
 void setFurnitureDescendingSorted(boolean furnitureDescendingSorted)
          Sets the furniture sort order on which home should be sorted and fires a PropertyChangeEvent.
 void setFurnitureSortedProperty(HomePieceOfFurniture.SortableProperty furnitureSortedProperty)
          Sets the furniture property on which this home should be sorted and fires a PropertyChangeEvent.
 void setFurnitureVisibleProperties(java.util.List<HomePieceOfFurniture.SortableProperty> furnitureVisibleProperties)
          Sets the furniture properties that are visible and the order in which they are visible, then fires a PropertyChangeEvent.
 void setModified(boolean modified)
          Sets the modified state of this home and fires a PropertyChangeEvent.
 void setName(java.lang.String name)
          Sets the name of this home and fires a PropertyChangeEvent.
 void setPrint(HomePrint print)
          Sets the print attributes of this home and fires a PropertyChangeEvent.
 void setRecovered(boolean recovered)
          Sets whether this home was recovered or not and fires a PropertyChangeEvent.
 void setSelectedItems(java.util.List<? extends Selectable> selectedItems)
          Sets the selected items in home and notifies listeners selection change.
 void setSelectedLevel(Level selectedLevel)
          Sets the selected level in home and notifies listeners of the change.
 void setStoredCameras(java.util.List<Camera> storedCameras)
          Sets the cameras stored by this home and fires a PropertyChangeEvent.
 void setVisualProperty(java.lang.String propertyName, java.lang.Object propertyValue)
          Sets a visual property associated with this home.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CURRENT_VERSION

public static final long CURRENT_VERSION
The current version of this home. Each time the field list is changed in Home class or in one of the classes that it uses, this number is increased.

See Also:
Constant Field Values
Constructor Detail

Home

public Home()
Creates a home with no furniture, no walls, and a height equal to 250 cm.


Home

public Home(float wallHeight)
Creates a home with no furniture and no walls.


Home

public Home(java.util.List<HomePieceOfFurniture> furniture)
Creates a home with the given furniture, no walls and a height equal to 250 cm.

Method Detail

addLevelsListener

public void addLevelsListener(CollectionListener<Level> listener)
Adds the level listener in parameter to this home.

Since:
3.4

removeLevelsListener

public void removeLevelsListener(CollectionListener<Level> listener)
Removes the level listener in parameter from this home.

Since:
3.4

getLevels

public java.util.List<Level> getLevels()
Returns an unmodifiable collection of the levels of this home.

Since:
3.4

addLevel

public void addLevel(Level level)
Adds the given level to the list of levels of this home. Once the level is added, level listeners added to this home will receive a collectionChanged notification, with an event type equal to ADD.

Since:
3.4

deleteLevel

public void deleteLevel(Level level)
Removes the given level from the set of levels of this home and all the furniture, walls, rooms, dimension lines and labels that belong to this level. Once the level is removed, level listeners added to this home will receive a collectionChanged notification, with an event type equal to DELETE.

Since:
3.4

getSelectedLevel

public Level getSelectedLevel()
Returns the selected level in home or null if home has no level.

Since:
3.4

setSelectedLevel

public void setSelectedLevel(Level selectedLevel)
Sets the selected level in home and notifies listeners of the change.

Since:
3.4

addFurnitureListener

public void addFurnitureListener(CollectionListener<HomePieceOfFurniture> listener)
Adds the furniture listener in parameter to this home.


removeFurnitureListener

public void removeFurnitureListener(CollectionListener<HomePieceOfFurniture> listener)
Removes the furniture listener in parameter from this home.


getFurniture

public java.util.List<HomePieceOfFurniture> getFurniture()
Returns an unmodifiable list of the furniture managed by this home. This furniture in this list is always sorted in the index order they were added to home.


addPieceOfFurniture

public void addPieceOfFurniture(HomePieceOfFurniture piece)
Adds the piece in parameter to this home. Once the piece is added, furniture listeners added to this home will receive a collectionChanged notification.


addPieceOfFurniture

public void addPieceOfFurniture(HomePieceOfFurniture piece,
                                int index)
Adds the piece in parameter at a given index. Once the piece is added, furniture listeners added to this home will receive a collectionChanged notification.


deletePieceOfFurniture

public void deletePieceOfFurniture(HomePieceOfFurniture piece)
Deletes the piece in parameter from this home. Once the piece is deleted, furniture listeners added to this home will receive a collectionChanged notification.


addSelectionListener

public void addSelectionListener(SelectionListener listener)
Adds the selection listener in parameter to this home.


removeSelectionListener

public void removeSelectionListener(SelectionListener listener)
Removes the selection listener in parameter from this home.


getSelectedItems

public java.util.List<Selectable> getSelectedItems()
Returns an unmodifiable list of the selected items in home.


setSelectedItems

public void setSelectedItems(java.util.List<? extends Selectable> selectedItems)
Sets the selected items in home and notifies listeners selection change.


deselectItem

public void deselectItem(Selectable item)
Deselects item if it's selected and notifies listeners selection change.

Since:
2.2

addRoomsListener

public void addRoomsListener(CollectionListener<Room> listener)
Adds the room listener in parameter to this home.


removeRoomsListener

public void removeRoomsListener(CollectionListener<Room> listener)
Removes the room listener in parameter from this home.


getRooms

public java.util.List<Room> getRooms()
Returns an unmodifiable collection of the rooms of this home.


addRoom

public void addRoom(Room room)
Adds the given room to the list of rooms of this home. Once the room is added, room listeners added to this home will receive a collectionChanged notification, with an event type equal to ADD.


addRoom

public void addRoom(Room room,
                    int index)
Adds the room in parameter at a given index. Once the room is added, room listeners added to this home will receive a collectionChanged notification, with an event type equal to ADD.


deleteRoom

public void deleteRoom(Room room)
Removes the given room from the set of rooms of this home. Once the room is removed, room listeners added to this home will receive a collectionChanged notification, with an event type equal to DELETE.


addWallsListener

public void addWallsListener(CollectionListener<Wall> listener)
Adds the wall listener in parameter to this home.


removeWallsListener

public void removeWallsListener(CollectionListener<Wall> listener)
Removes the wall listener in parameter from this home.


getWalls

public java.util.Collection<Wall> getWalls()
Returns an unmodifiable collection of the walls of this home.


addWall

public void addWall(Wall wall)
Adds the given wall to the set of walls of this home. Once the wall is added, wall listeners added to this home will receive a collectionChanged notification, with an event type equal to ADD.


deleteWall

public void deleteWall(Wall wall)
Removes the given wall from the set of walls of this home. Once the wall is removed, wall listeners added to this home will receive a collectionChanged notification, with an event type equal to DELETE. If any wall is attached to wall they will be detached from it.


addDimensionLinesListener

public void addDimensionLinesListener(CollectionListener<DimensionLine> listener)
Adds the dimension line listener in parameter to this home.


removeDimensionLinesListener

public void removeDimensionLinesListener(CollectionListener<DimensionLine> listener)
Removes the dimension line listener in parameter from this home.


getDimensionLines

public java.util.Collection<DimensionLine> getDimensionLines()
Returns an unmodifiable collection of the dimension lines of this home.


addDimensionLine

public void addDimensionLine(DimensionLine dimensionLine)
Adds the given dimension line to the set of dimension lines of this home. Once dimensionLine is added, dimension line listeners added to this home will receive a collectionChanged notification, with an event type equal to ADD.


deleteDimensionLine

public void deleteDimensionLine(DimensionLine dimensionLine)
Removes the given dimension line from the set of dimension lines of this home. Once dimensionLine is removed, dimension line listeners added to this home will receive a collectionChanged notification, with an event type equal to DELETE.


addLabelsListener

public void addLabelsListener(CollectionListener<Label> listener)
Adds the label listener in parameter to this home.


removeLabelsListener

public void removeLabelsListener(CollectionListener<Label> listener)
Removes the label listener in parameter from this home.


getLabels

public java.util.Collection<Label> getLabels()
Returns an unmodifiable collection of the labels of this home.


addLabel

public void addLabel(Label label)
Adds the given label to the set of labels of this home. Once label is added, label listeners added to this home will receive a collectionChanged notification, with an event type equal to ADD.


deleteLabel

public void deleteLabel(Label label)
Removes the given label from the set of labels of this home. Once label is removed, label listeners added to this home will receive a collectionChanged notification, with an event type equal to DELETE.


isEmpty

public boolean isEmpty()
Returns true if this home doesn't contain any item i.e. no piece of furniture, no wall, no room, no dimension line and no label.

Since:
2.2

addPropertyChangeListener

public void addPropertyChangeListener(Home.Property property,
                                      java.beans.PropertyChangeListener listener)
Adds the property change listener in parameter to this home.


removePropertyChangeListener

public void removePropertyChangeListener(Home.Property property,
                                         java.beans.PropertyChangeListener listener)
Removes the property change listener in parameter from this home.


getWallHeight

public float getWallHeight()
Returns the wall height of this home.


getName

public java.lang.String getName()
Returns the name of this home.


setName

public void setName(java.lang.String name)
Sets the name of this home and fires a PropertyChangeEvent.


isModified

public boolean isModified()
Returns whether the state of this home is modified or not.


setModified

public void setModified(boolean modified)
Sets the modified state of this home and fires a PropertyChangeEvent.


isRecovered

public boolean isRecovered()
Returns whether this home was recovered or not.

Since:
3.0

setRecovered

public void setRecovered(boolean recovered)
Sets whether this home was recovered or not and fires a PropertyChangeEvent.

Since:
3.0

getFurnitureSortedProperty

public HomePieceOfFurniture.SortableProperty getFurnitureSortedProperty()
Returns the furniture property on which home is sorted or null if home furniture isn't sorted.


setFurnitureSortedProperty

public void setFurnitureSortedProperty(HomePieceOfFurniture.SortableProperty furnitureSortedProperty)
Sets the furniture property on which this home should be sorted and fires a PropertyChangeEvent.


isFurnitureDescendingSorted

public boolean isFurnitureDescendingSorted()
Returns whether furniture is sorted in ascending or descending order.


setFurnitureDescendingSorted

public void setFurnitureDescendingSorted(boolean furnitureDescendingSorted)
Sets the furniture sort order on which home should be sorted and fires a PropertyChangeEvent.


getFurnitureVisibleProperties

public java.util.List<HomePieceOfFurniture.SortableProperty> getFurnitureVisibleProperties()
Returns an unmodifiable list of the furniture properties that are visible.


setFurnitureVisibleProperties

public void setFurnitureVisibleProperties(java.util.List<HomePieceOfFurniture.SortableProperty> furnitureVisibleProperties)
Sets the furniture properties that are visible and the order in which they are visible, then fires a PropertyChangeEvent.


getBackgroundImage

public BackgroundImage getBackgroundImage()
Returns the plan background image of this home.


setBackgroundImage

public void setBackgroundImage(BackgroundImage backgroundImage)
Sets the plan background image of this home and fires a PropertyChangeEvent.


getTopCamera

public Camera getTopCamera()
Returns the camera used to display this home from a top point of view.


getObserverCamera

public ObserverCamera getObserverCamera()
Returns the camera used to display this home from an observer point of view.


setCamera

public void setCamera(Camera camera)
Sets the camera used to display this home and fires a PropertyChangeEvent.


getCamera

public Camera getCamera()
Returns the camera used to display this home.


setStoredCameras

public void setStoredCameras(java.util.List<Camera> storedCameras)
Sets the cameras stored by this home and fires a PropertyChangeEvent. The list given as parameter is cloned but not the camera instances it contains.

Since:
3.0

getStoredCameras

public java.util.List<Camera> getStoredCameras()
Returns an unmodifiable list of the cameras stored by this home.

Since:
3.0

getEnvironment

public HomeEnvironment getEnvironment()
Returns the environment attributes of this home.


getCompass

public Compass getCompass()
Returns the compass associated to this home.

Since:
3.0

getPrint

public HomePrint getPrint()
Returns the print attributes of this home.


setPrint

public void setPrint(HomePrint print)
Sets the print attributes of this home and fires a PropertyChangeEvent.


getVisualProperty

public java.lang.Object getVisualProperty(java.lang.String propertyName)
Returns the value of the visual property propertyName associated with this home.


setVisualProperty

public void setVisualProperty(java.lang.String propertyName,
                              java.lang.Object propertyValue)
Sets a visual property associated with this home.


isBasePlanLocked

public boolean isBasePlanLocked()
Returns true if the home objects belonging to the base plan (generally walls, rooms, dimension lines and texts) are locked.

Since:
1.8

setBasePlanLocked

public void setBasePlanLocked(boolean basePlanLocked)
Sets whether home objects belonging to the base plan (generally walls, rooms, dimension lines and texts) are locked and fires a PropertyChangeEvent.

Since:
1.8

getVersion

public long getVersion()
Returns the version of this home, the last time it was serialized or or CURRENT_VERSION if it is not serialized yet or was serialized with Sweet Home 3D 0.x. Version is useful to know with which Sweet Home 3D version this home was saved and warn user that he may lose information if he saves with current application a home created by a more recent version.


clone

public Home clone()
Returns a clone of this home and the objects it contains. Listeners bound to this home aren't added to the returned home.

Overrides:
clone in class java.lang.Object
Since:
2.3

duplicate

public static java.util.List<Selectable> duplicate(java.util.List<? extends Selectable> items)
Returns a deep copy of home selectable items.


getFurnitureSubList

public static java.util.List<HomePieceOfFurniture> getFurnitureSubList(java.util.List<? extends Selectable> items)
Returns a sub list of items that contains only home furniture.


getWallsSubList

public static java.util.List<Wall> getWallsSubList(java.util.List<? extends Selectable> items)
Returns a sub list of items that contains only walls.


getRoomsSubList

public static java.util.List<Room> getRoomsSubList(java.util.List<? extends Selectable> items)
Returns a sub list of items that contains only rooms.


getDimensionLinesSubList

public static java.util.List<DimensionLine> getDimensionLinesSubList(java.util.List<? extends Selectable> items)
Returns a sub list of items that contains only dimension lines.


getLabelsSubList

public static java.util.List<Label> getLabelsSubList(java.util.List<? extends Selectable> items)
Returns a sub list of items that contains only labels.


getLevelsSubList

public static java.util.List<Level> getLevelsSubList(java.util.List<? extends Selectable> items)
Returns a sub list of items that contains only levels.

Since:
3.4

getSubList

public static <T> java.util.List<T> getSubList(java.util.List<? extends Selectable> items,
                                               java.lang.Class<T> subListClass)
Returns a sub list of items that contains only instances of subListClass.

Since:
2.2

Sweet Home 3D 3.4

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