Sweet Home 3D 3.4

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 java.lang.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, javax.swing.undo.UndoableEditSupport undoSupport)
          Creates the controller of home furniture view with undo support.
 
Method Summary
 void addFurniture(java.util.List<HomePieceOfFurniture> furniture)
          Controls new furniture added to home.
 void alignSelectedFurnitureOnBottom()
          Controls the alignment of selected furniture on bottom of the first selected piece.
 void alignSelectedFurnitureOnLeft()
          Controls the alignment of selected furniture on left of the first selected piece.
 void alignSelectedFurnitureOnRight()
          Controls the alignment of selected furniture on right of the first selected piece.
 void alignSelectedFurnitureOnTop()
          Controls the alignment of selected furniture on top of the first selected piece.
protected  HomeFurnitureGroup createHomeFurnitureGroup(java.util.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(java.util.List<HomePieceOfFurniture> deletedFurniture)
          Deletes the furniture of deletedFurniture from home.
 void deleteSelection()
          Controls the deletion of the current selected furniture in home.
 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(java.lang.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(java.util.List<HomePieceOfFurniture.SortableProperty> furnitureVisibleProperties)
          Updates the furniture visible properties in home.
 void setSelectedFurniture(java.util.List<HomePieceOfFurniture> selectedFurniture)
          Updates the selected furniture in home.
 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,
                           javax.swing.undo.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(java.util.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(java.util.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(java.util.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(java.util.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(java.util.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(java.lang.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.


Sweet Home 3D 3.4

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