public class FurnitureController extends java.lang.Object implements Controller
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
void |
addFurniture(java.util.List<HomePieceOfFurniture> furniture)
Controls new furniture added to home.
|
void |
addFurniture(java.util.List<HomePieceOfFurniture> furniture,
HomePieceOfFurniture beforePiece)
Controls new furniture added to home.
|
void |
addFurnitureToGroup(java.util.List<HomePieceOfFurniture> furniture,
HomeFurnitureGroup group)
Controls new furniture added to the given group.
|
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(java.util.List<HomePieceOfFurniture> furniture)
Returns a new furniture group for the given furniture list.
|
protected HomeFurnitureGroup |
createHomeFurnitureGroup(java.util.List<HomePieceOfFurniture> furniture,
HomePieceOfFurniture leadingPiece)
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.
|
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.
|
protected java.util.List<HomePieceOfFurniture> |
getFurnitureInSameGroup(HomePieceOfFurniture piece)
Returns the furniture list of the given
piece which belongs to same group
or home furniture if it doesn't belong to home furniture. |
protected HomePieceOfFurniture |
getHighestSurroundingPieceOfFurniture(HomePieceOfFurniture piece)
Returns the highest piece of furniture that includes the given
piece
with a margin error of 5% of the smallest side length. |
protected java.util.List<HomePieceOfFurniture> |
getSurroundingFurniture(HomePieceOfFurniture piece)
Returns the shelf units which include the given
piece
with a margin error of 20% of the smallest side length. |
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 isn't movable. |
protected boolean |
isPieceOfFurnitureVisibleAtSelectedLevel(HomePieceOfFurniture piece)
Returns
true if the given piece is viewable and
its height and elevation make it viewable at the selected level in home. |
void |
modifySelectedFurniture()
Controls the modification of selected furniture.
|
void |
moveSelectedFurnitureBefore(HomePieceOfFurniture beforePiece)
Reorders the selected furniture in home to place it before the given piece.
|
void |
resetFurnitureElevation()
Resets the elevation of the selected furniture to its default elevation.
|
void |
selectAll()
Selects all furniture in home.
|
void |
setFurnitureVisibleProperties(java.util.List<HomePieceOfFurniture.SortableProperty> furnitureVisibleProperties)
Deprecated.
#setFurnitureVisibleProperties(List
should be replaced by calls to #setFurnitureVisiblePropertyNames(List
to allow displaying additional properties. |
void |
setFurnitureVisiblePropertyNames(java.util.List<java.lang.String> furnitureVisiblePropertyNames)
Updates the furniture visible properties in home.
|
void |
setHomeProperty(java.lang.String propertyName,
java.lang.String propertyValue)
Controls the change of value of a property in home.
|
void |
setSelectedFurniture(java.util.List<HomePieceOfFurniture> selectedFurniture)
Updates the selected furniture in home.
|
void |
setSelectedFurniture(java.util.List<HomePieceOfFurniture> selectedFurniture,
boolean resetSelection)
Updates the selected furniture in home, unselecting all other kinds of selected objects
when
resetSelection is true . |
void |
setVisualProperty(java.lang.String propertyName,
java.lang.Object propertyValue)
Deprecated.
setVisualProperty should be replaced by a call to
setHomeProperty(String, String) to ensure the property can be easily saved and read. |
void |
sortFurniture(HomePieceOfFurniture.SortableProperty furnitureProperty)
Deprecated.
sortFurniture(HomePieceOfFurniture.SortableProperty)
should be replaced by calls to sortFurniture(String)
to allow displaying additional properties. |
void |
sortFurniture(java.lang.String furniturePropertyName)
Controls the sort of the furniture in home.
|
void |
toggleFurnitureSort(HomePieceOfFurniture.SortableProperty furnitureProperty)
Deprecated.
toggleFurnitureSort(HomePieceOfFurniture.SortableProperty)
should be replaced by calls to toggleFurnitureSort(String)
to allow displaying additional properties. |
void |
toggleFurnitureSort(java.lang.String furniturePropertyName)
Uses
furniturePropertyName 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)
Deprecated.
toggleFurnitureVisibleProperty(HomePieceOfFurniture.SortableProperty)
should be replaced by calls to toggleFurnitureVisibleProperty(String)
to allow displaying additional properties. |
void |
toggleFurnitureVisibleProperty(java.lang.String furniturePropertyName)
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.
|
public FurnitureController(Home home, UserPreferences preferences, ViewFactory viewFactory)
home
- the home edited by this controller and its viewpreferences
- the preferences of the applicationviewFactory
- a factory able to create the furniture view managed by this controllerpublic FurnitureController(Home home, UserPreferences preferences, ViewFactory viewFactory, ContentManager contentManager, javax.swing.undo.UndoableEditSupport undoSupport)
public View getView()
getView
in interface Controller
public void addFurniture(java.util.List<HomePieceOfFurniture> furniture)
furniture
- the furniture to add.public void addFurniture(java.util.List<HomePieceOfFurniture> furniture, HomePieceOfFurniture beforePiece)
furniture
- the furniture to add.beforePiece
- the piece before which the furniture will be addedpublic void addFurnitureToGroup(java.util.List<HomePieceOfFurniture> furniture, HomeFurnitureGroup group)
furniture
- the furniture to add.group
- the group to which furniture will be added.public void deleteSelection()
public void deleteFurniture(java.util.List<HomePieceOfFurniture> deletedFurniture)
deletedFurniture
from home.
Once the selected furniture is deleted, undo support will receive a new undoable edit.public void moveSelectedFurnitureBefore(HomePieceOfFurniture beforePiece)
public void setSelectedFurniture(java.util.List<HomePieceOfFurniture> selectedFurniture)
public void setSelectedFurniture(java.util.List<HomePieceOfFurniture> selectedFurniture, boolean resetSelection)
resetSelection
is true
.public void selectAll()
protected boolean isPieceOfFurniturePartOfBasePlan(HomePieceOfFurniture piece)
true
if the given piece
isn't movable.protected boolean isPieceOfFurnitureMovable(HomePieceOfFurniture piece)
true
if the given piece
may be moved.
Default implementation always returns true
.protected boolean isPieceOfFurnitureDeletable(HomePieceOfFurniture piece)
true
if the given piece
may be deleted.
Default implementation always returns true
.public HomePieceOfFurniture createHomePieceOfFurniture(PieceOfFurniture piece)
piece
of furniture.public void toggleFurnitureSort(java.lang.String furniturePropertyName)
furniturePropertyName
to sort home furniture
or cancels home furniture sort if home is already sorted on furnitureProperty
furniturePropertyName
- a property of HomePieceOfFurniture
class.public void toggleFurnitureSort(HomePieceOfFurniture.SortableProperty furnitureProperty)
toggleFurnitureSort(HomePieceOfFurniture.SortableProperty)
should be replaced by calls to toggleFurnitureSort(String)
to allow displaying additional properties.furnitureProperty
to sort home furniture
or cancels home furniture sort if home is already sorted on furnitureProperty
furnitureProperty
- a property of HomePieceOfFurniture
class.public void toggleFurnitureSortOrder()
public void sortFurniture(java.lang.String furniturePropertyName)
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.furniturePropertyName
- the furniture property on which the view wants
to sort the furniture it displays.public void sortFurniture(HomePieceOfFurniture.SortableProperty furnitureProperty)
sortFurniture(HomePieceOfFurniture.SortableProperty)
should be replaced by calls to sortFurniture(String)
to allow displaying additional properties.furnitureProperty
- the furniture property on which the view wants
to sort the furniture it displays.public void setFurnitureVisiblePropertyNames(java.util.List<java.lang.String> furnitureVisiblePropertyNames)
public void setFurnitureVisibleProperties(java.util.List<HomePieceOfFurniture.SortableProperty> furnitureVisibleProperties)
#setFurnitureVisibleProperties(List)
should be replaced by calls to #setFurnitureVisiblePropertyNames(List)
to allow displaying additional properties.public void toggleFurnitureVisibleProperty(java.lang.String furniturePropertyName)
public void toggleFurnitureVisibleProperty(HomePieceOfFurniture.SortableProperty furnitureProperty)
toggleFurnitureVisibleProperty(HomePieceOfFurniture.SortableProperty)
should be replaced by calls to toggleFurnitureVisibleProperty(String)
to allow displaying additional properties.public void modifySelectedFurniture()
public void toggleSelectedFurnitureVisibility()
public void groupSelectedFurniture()
protected HomeFurnitureGroup createHomeFurnitureGroup(java.util.List<HomePieceOfFurniture> furniture)
protected HomeFurnitureGroup createHomeFurnitureGroup(java.util.List<HomePieceOfFurniture> furniture, HomePieceOfFurniture leadingPiece)
public void ungroupSelectedFurniture()
public void importFurniture()
public void importFurniture(java.lang.String modelName)
public void alignSelectedFurnitureOnTop()
public void alignSelectedFurnitureOnBottom()
public void alignSelectedFurnitureOnLeft()
public void alignSelectedFurnitureOnRight()
public void alignSelectedFurnitureOnFrontSide()
public void alignSelectedFurnitureOnBackSide()
public void alignSelectedFurnitureOnLeftSide()
public void alignSelectedFurnitureOnRightSide()
public void alignSelectedFurnitureSideBySide()
public void distributeSelectedFurnitureHorizontally()
public void distributeSelectedFurnitureVertically()
public void distributeSelectedFurniture(boolean horizontal)
public void resetFurnitureElevation()
protected HomePieceOfFurniture getHighestSurroundingPieceOfFurniture(HomePieceOfFurniture piece)
piece
with a margin error of 5% of the smallest side length.protected java.util.List<HomePieceOfFurniture> getSurroundingFurniture(HomePieceOfFurniture piece)
piece
with a margin error of 20% of the smallest side length.protected java.util.List<HomePieceOfFurniture> getFurnitureInSameGroup(HomePieceOfFurniture piece)
piece
which belongs to same group
or home furniture if it doesn't belong to home furniture.protected boolean isPieceOfFurnitureVisibleAtSelectedLevel(HomePieceOfFurniture piece)
true
if the given piece is viewable and
its height and elevation make it viewable at the selected level in home.public void setVisualProperty(java.lang.String propertyName, java.lang.Object propertyValue)
setVisualProperty
should be replaced by a call to
setHomeProperty(String, String)
to ensure the property can be easily saved and read.public void setHomeProperty(java.lang.String propertyName, java.lang.String propertyValue)
© Copyright 2024 Space Mushrooms
Distributed under GNU General Public License