Sweet Home 3D 4.0

com.eteks.sweethome3d.viewcontroller
Class FurnitureController

java.lang.Object
  extended by com.eteks.sweethome3d.viewcontroller.FurnitureController
All Implemented Interfaces:
Controller
Direct Known Subclasses:
PlanController

public class FurnitureController
extends Object
implements Controller

A MVC controller for the home furniture table.

Author:
Emmanuel Puybaret

Constructor Summary
FurnitureController(Home home, UserPreferences preferences, ViewFactory viewFactory)
          Creates the controller of home furniture view.
FurnitureController(Home home, UserPreferences preferences, ViewFactory viewFactory, ContentManager contentManager, UndoableEditSupport undoSupport)
          Creates the controller of home furniture view with undo support.
 
Method Summary
 void addFurniture(List<HomePieceOfFurniture> furniture)
          Controls new furniture added to home.
 void alignSelectedFurnitureOnBackSide()
          Controls the alignment of selected furniture on the back side of the first selected piece.
 void alignSelectedFurnitureOnBottom()
          Controls the alignment of selected furniture on bottom of the first selected piece.
 void alignSelectedFurnitureOnFrontSide()
          Controls the alignment of selected furniture on the front side of the first selected piece.
 void alignSelectedFurnitureOnLeft()
          Controls the alignment of selected furniture on left of the first selected piece.
 void alignSelectedFurnitureOnLeftSide()
          Controls the alignment of selected furniture on the left side of the first selected piece.
 void alignSelectedFurnitureOnRight()
          Controls the alignment of selected furniture on right of the first selected piece.
 void alignSelectedFurnitureOnRightSide()
          Controls the alignment of selected furniture on the right side of the first selected piece.
 void alignSelectedFurnitureOnTop()
          Controls the alignment of selected furniture on top of the first selected piece.
 void alignSelectedFurnitureSideBySide()
          Controls the alignment of selected furniture on the sides of the first selected piece.
protected  HomeFurnitureGroup createHomeFurnitureGroup(List<HomePieceOfFurniture> furniture)
          Returns a new furniture group for the given furniture list.
 HomePieceOfFurniture createHomePieceOfFurniture(PieceOfFurniture piece)
          Returns a new home piece of furniture created from an other given piece of furniture.
 void deleteFurniture(List<HomePieceOfFurniture> deletedFurniture)
          Deletes the furniture of deletedFurniture from home.
 void deleteSelection()
          Controls the deletion of the current selected furniture in home.
 void distributeSelectedFurniture(boolean horizontal)
          Controls the distribution of the selected furniture along the axis orthogonal to the given one.
 void distributeSelectedFurnitureHorizontally()
          Controls the distribution of the selected furniture along horizontal axis.
 void distributeSelectedFurnitureVertically()
          Controls the distribution of the selected furniture along vertical axis.
 View getView()
          Returns the view associated with this controller.
 void groupSelectedFurniture()
          Groups the selected furniture as one piece of furniture.
 void importFurniture()
          Displays the wizard that helps to import furniture to home.
 void importFurniture(String modelName)
          Displays the wizard that helps to import furniture to home with a given model name.
protected  boolean isPieceOfFurnitureDeletable(HomePieceOfFurniture piece)
          Returns true if the given piece may be deleted.
protected  boolean isPieceOfFurnitureMovable(HomePieceOfFurniture piece)
          Returns true if the given piece may be moved.
protected  boolean isPieceOfFurniturePartOfBasePlan(HomePieceOfFurniture piece)
          Returns true if the given piece is movable.
 void modifySelectedFurniture()
          Controls the modification of selected furniture.
 void selectAll()
          Selects all furniture in home.
 void setFurnitureVisibleProperties(List<HomePieceOfFurniture.SortableProperty> furnitureVisibleProperties)
          Updates the furniture visible properties in home.
 void setSelectedFurniture(List<HomePieceOfFurniture> selectedFurniture)
          Updates the selected furniture in home.
 List<HomePieceOfFurniture> sortFurniture(com.eteks.sweethome3d.viewcontroller.FurnitureController.AlignedPieceOfFurniture[] furniture, HomePieceOfFurniture leadPiece, Line2D orthogonalAxis)
          Returns a list containing aligned furniture and lead piece sorted in the order of their distribution along a line orthogonal to the given axis.
 void sortFurniture(HomePieceOfFurniture.SortableProperty furnitureProperty)
          Controls the sort of the furniture in home.
 void toggleFurnitureSort(HomePieceOfFurniture.SortableProperty furnitureProperty)
          Uses furnitureProperty to sort home furniture or cancels home furniture sort if home is already sorted on furnitureProperty
 void toggleFurnitureSortOrder()
          Toggles home furniture sort order.
 void toggleFurnitureVisibleProperty(HomePieceOfFurniture.SortableProperty furnitureProperty)
          Toggles furniture property visibility in home.
 void toggleSelectedFurnitureVisibility()
          Controls the modification of the visibility of the selected piece of furniture.
 void ungroupSelectedFurniture()
          Ungroups the selected groups of furniture.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FurnitureController

public FurnitureController(Home home,
                           UserPreferences preferences,
                           ViewFactory viewFactory)
Creates the controller of home furniture view.

Parameters:
home - the home edited by this controller and its view
preferences - the preferences of the application
viewFactory - a factory able to create the furniture view managed by this controller

FurnitureController

public FurnitureController(Home home,
                           UserPreferences preferences,
                           ViewFactory viewFactory,
                           ContentManager contentManager,
                           UndoableEditSupport undoSupport)
Creates the controller of home furniture view with undo support.

Method Detail

getView

public View getView()
Returns the view associated with this controller.

Specified by:
getView in interface Controller

addFurniture

public void addFurniture(List<HomePieceOfFurniture> furniture)
Controls new furniture added to home. Once added the furniture will be selected in view and undo support will receive a new undoable edit.

Parameters:
furniture - the furniture to add.

deleteSelection

public void deleteSelection()
Controls the deletion of the current selected furniture in home. Once the selected furniture is deleted, undo support will receive a new undoable edit.


deleteFurniture

public void deleteFurniture(List<HomePieceOfFurniture> deletedFurniture)
Deletes the furniture of deletedFurniture from home. Once the selected furniture is deleted, undo support will receive a new undoable edit.


setSelectedFurniture

public void setSelectedFurniture(List<HomePieceOfFurniture> selectedFurniture)
Updates the selected furniture in home.


selectAll

public void selectAll()
Selects all furniture in home.


isPieceOfFurniturePartOfBasePlan

protected boolean isPieceOfFurniturePartOfBasePlan(HomePieceOfFurniture piece)
Returns true if the given piece is movable.


isPieceOfFurnitureMovable

protected boolean isPieceOfFurnitureMovable(HomePieceOfFurniture piece)
Returns true if the given piece may be moved. Default implementation always returns true.


isPieceOfFurnitureDeletable

protected boolean isPieceOfFurnitureDeletable(HomePieceOfFurniture piece)
Returns true if the given piece may be deleted. Default implementation always returns true.


createHomePieceOfFurniture

public HomePieceOfFurniture createHomePieceOfFurniture(PieceOfFurniture piece)
Returns a new home piece of furniture created from an other given piece of furniture.


toggleFurnitureSort

public void toggleFurnitureSort(HomePieceOfFurniture.SortableProperty furnitureProperty)
Uses furnitureProperty to sort home furniture or cancels home furniture sort if home is already sorted on furnitureProperty

Parameters:
furnitureProperty - a property of HomePieceOfFurniture class.

toggleFurnitureSortOrder

public void toggleFurnitureSortOrder()
Toggles home furniture sort order.


sortFurniture

public void sortFurniture(HomePieceOfFurniture.SortableProperty furnitureProperty)
Controls the sort of the furniture in home. If home furniture isn't sorted or is sorted on an other property, it will be sorted on the given furnitureProperty in ascending order. If home furniture is already sorted on the given furnitureProperty, it will be sorted in descending order, if the sort is in ascending order, otherwise it won't be sorted at all and home furniture will be listed in insertion order.

Parameters:
furnitureProperty - the furniture property on which the view wants to sort the furniture it displays.

setFurnitureVisibleProperties

public void setFurnitureVisibleProperties(List<HomePieceOfFurniture.SortableProperty> furnitureVisibleProperties)
Updates the furniture visible properties in home.


toggleFurnitureVisibleProperty

public void toggleFurnitureVisibleProperty(HomePieceOfFurniture.SortableProperty furnitureProperty)
Toggles furniture property visibility in home.


modifySelectedFurniture

public void modifySelectedFurniture()
Controls the modification of selected furniture.


toggleSelectedFurnitureVisibility

public void toggleSelectedFurnitureVisibility()
Controls the modification of the visibility of the selected piece of furniture.


groupSelectedFurniture

public void groupSelectedFurniture()
Groups the selected furniture as one piece of furniture.


createHomeFurnitureGroup

protected HomeFurnitureGroup createHomeFurnitureGroup(List<HomePieceOfFurniture> furniture)
Returns a new furniture group for the given furniture list.


ungroupSelectedFurniture

public void ungroupSelectedFurniture()
Ungroups the selected groups of furniture.


importFurniture

public void importFurniture()
Displays the wizard that helps to import furniture to home.


importFurniture

public void importFurniture(String modelName)
Displays the wizard that helps to import furniture to home with a given model name.


alignSelectedFurnitureOnTop

public void alignSelectedFurnitureOnTop()
Controls the alignment of selected furniture on top of the first selected piece.


alignSelectedFurnitureOnBottom

public void alignSelectedFurnitureOnBottom()
Controls the alignment of selected furniture on bottom of the first selected piece.


alignSelectedFurnitureOnLeft

public void alignSelectedFurnitureOnLeft()
Controls the alignment of selected furniture on left of the first selected piece.


alignSelectedFurnitureOnRight

public void alignSelectedFurnitureOnRight()
Controls the alignment of selected furniture on right of the first selected piece.


alignSelectedFurnitureOnFrontSide

public void alignSelectedFurnitureOnFrontSide()
Controls the alignment of selected furniture on the front side of the first selected piece.


alignSelectedFurnitureOnBackSide

public void alignSelectedFurnitureOnBackSide()
Controls the alignment of selected furniture on the back side of the first selected piece.


alignSelectedFurnitureOnLeftSide

public void alignSelectedFurnitureOnLeftSide()
Controls the alignment of selected furniture on the left side of the first selected piece.


alignSelectedFurnitureOnRightSide

public void alignSelectedFurnitureOnRightSide()
Controls the alignment of selected furniture on the right side of the first selected piece.


alignSelectedFurnitureSideBySide

public void alignSelectedFurnitureSideBySide()
Controls the alignment of selected furniture on the sides of the first selected piece.


sortFurniture

public List<HomePieceOfFurniture> sortFurniture(com.eteks.sweethome3d.viewcontroller.FurnitureController.AlignedPieceOfFurniture[] furniture,
                                                HomePieceOfFurniture leadPiece,
                                                Line2D orthogonalAxis)
Returns a list containing aligned furniture and lead piece sorted in the order of their distribution along a line orthogonal to the given axis.


distributeSelectedFurnitureHorizontally

public void distributeSelectedFurnitureHorizontally()
Controls the distribution of the selected furniture along horizontal axis.


distributeSelectedFurnitureVertically

public void distributeSelectedFurnitureVertically()
Controls the distribution of the selected furniture along vertical axis.


distributeSelectedFurniture

public void distributeSelectedFurniture(boolean horizontal)
Controls the distribution of the selected furniture along the axis orthogonal to the given one.


Sweet Home 3D 4.0

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