Sweet Home 3D 4.1

com.eteks.sweethome3d.viewcontroller
Class HomeController

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

public class HomeController
extends Object
implements Controller

A MVC controller for the home view.

Author:
Emmanuel Puybaret

Constructor Summary
HomeController(Home home, HomeApplication application, ViewFactory viewFactory)
          Creates the controller of home view.
HomeController(Home home, HomeApplication application, ViewFactory viewFactory, ContentManager contentManager)
          Creates the controller of home view.
HomeController(Home home, UserPreferences preferences, ViewFactory viewFactory)
          Creates the controller of home view.
HomeController(Home home, UserPreferences preferences, ViewFactory viewFactory, ContentManager contentManager)
          Creates the controller of home view.
 
Method Summary
 void about()
          Displays about dialog.
 void addHomeFurniture()
          Adds the selected furniture in catalog to home and selects it.
 void attachView(View view)
          Attaches the given view to home view.
 void checkUpdates(boolean displayOnlyIfNewUpdates)
          Checks if some application or libraries updates are available.
 void close()
          Manages home close operation.
protected  void close(Runnable postCloseTask)
          Manages home close operation.
 void createPhoto()
          Controls the creation of photo-realistic images.
 void createPhotos()
          Controls the creation of multiple photo-realistic images at the stored cameras locations.
 void createVideo()
          Controls the creation of 3D videos.
 void cut(List<? extends Selectable> items)
          Deletes items and post a cut operation to undo support.
 void delete()
          Deletes the selection in the focused component.
 void deleteBackgroundImage()
          Deletes home background image and posts and posts an undoable operation.
 void deleteCameras()
          Prompts stored cameras in home to be deleted and deletes the ones selected by the user.
 void deleteRecentHomes()
          Deletes the list of recent homes in user preferences.
 void detachView(View view)
          Detaches the given view from home view.
 void drop(List<? extends Selectable> items, float dx, float dy)
          Adds items to home, moves them of (dx, dy) and posts a drop operation to undo support.
 void drop(List<? extends Selectable> items, View destinationView, float dx, float dy)
          Adds items to home, moves them of (dx, dy) and posts a drop operation to undo support.
 void dropFiles(List<String> importableModels, float dx, float dy)
          Adds imported models to home, moves them of (dx, dy) and post a drop operation to undo support.
 void editPreferences()
          Edits preferences and changes them if user agrees.
protected  void enableActionsBoundToSelection()
          Enables or disables action bound to selection.
 void enablePasteAction()
          Enables clipboard paste action if clipboard isn't empty.
protected  void enableSelectAllAction()
          Enables select all action if home isn't empty.
 void exit()
          Controls application exit.
 void exportToCSV()
          Controls the export of the furniture list of current home to a CSV file.
 void exportToOBJ()
          Controls the export of the 3D view of current home to an OBJ file.
 void exportToSVG()
          Controls the export of the current home plan to a SVG file.
 void focusedViewChanged(View focusedView)
          Updates actions when focused view changed.
 ContentManager getContentManager()
          Returns the content manager of this controller.
 FurnitureCatalogController getFurnitureCatalogController()
          Returns the furniture catalog controller managed by this controller.
 FurnitureController getFurnitureController()
          Returns the furniture controller managed by this controller.
 HomeController3D getHomeController3D()
          Returns the controller of home 3D view.
 PlanController getPlanController()
          Returns the controller of home plan.
 List<String> getRecentHomes()
          Returns a list of displayable recent homes.
protected  UndoableEditSupport getUndoableEditSupport()
          Returns the undoable edit support managed by this controller.
 String getVersion()
          Returns the version of the application for display purpose.
 HomeView getView()
          Returns the view associated with this controller.
 void help()
          Displays help window.
 void hideBackgroundImage()
          Hides the home background image.
 void importBackgroundImage()
          Displays the wizard that helps to import home background image.
 void importFurniture()
          Imports furniture to the catalog or home depending on the focused view.
 void importFurnitureLibrary()
          Imports a furniture library chosen by the user.
 void importFurnitureLibrary(String furnitureLibraryName)
          Imports a given furniture library.
 void importLanguageLibrary()
          Imports a language library chosen by the user.
 void importLanguageLibrary(String languageLibraryName)
          Imports a given language library.
 void importTexture()
          Imports a texture to the texture catalog.
 void importTexturesLibrary()
          Imports a textures library chosen by the user.
 void importTexturesLibrary(String texturesLibraryName)
          Imports a given textures library.
 void modifyBackgroundImage()
          Displays the wizard that helps to change home background image.
 void modifySelectedFurniture()
          Modifies the selected furniture of the focused view.
 void newHome()
          Creates a new home and adds it to application home list.
 void open()
          Opens a home.
 void open(String homeName)
          Opens a given homeNamehome.
 void paste(List<? extends Selectable> items)
          Adds items to home and posts a paste operation to undo support.
 void previewPrint()
          Controls the print preview.
 void print()
          Controls the print of this home.
 void printToPDF()
          Controls the print of this home in a PDF file.
 void redo()
          Redoes last undone operation.
 void save()
          Saves the home managed by this controller.
 void saveAndCompress()
          Saves the home managed by this controller and compresses it.
 void saveAs()
          Saves the home managed by this controller with a different name.
 void selectAll()
          Selects everything in the focused component.
 void setMode(PlanController.Mode mode)
          Displays a tip message dialog depending on the given mode and sets the active mode of the plan controller.
 void setupPage()
          Controls page setup.
 void setVisualProperty(String propertyName, Object propertyValue)
          Controls the change of value of a visual property in home.
 void showBackgroundImage()
          Shows the home background image.
 void storeCamera()
          Prompts a name for the current camera and stores it in home.
 void undo()
          Undoes last operation.
 void zoomIn()
          Zooms in in plan.
 void zoomOut()
          Zooms out in plan.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HomeController

public HomeController(Home home,
                      HomeApplication application,
                      ViewFactory viewFactory,
                      ContentManager contentManager)
Creates the controller of home view.

Parameters:
home - the home edited by this controller and its view.
application - the instance of current application.
viewFactory - a factory able to create views.
contentManager - the content manager of the application.

HomeController

public HomeController(Home home,
                      HomeApplication application,
                      ViewFactory viewFactory)
Creates the controller of home view.

Parameters:
home - the home edited by this controller and its view.
application - the instance of current application.
viewFactory - a factory able to create views.

HomeController

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

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

HomeController

public HomeController(Home home,
                      UserPreferences preferences,
                      ViewFactory viewFactory,
                      ContentManager contentManager)
Creates the controller of home view.

Parameters:
home - the home edited by this controller and its view.
preferences - the preferences of the application.
viewFactory - a factory able to create views.
contentManager - the content manager of the application.
Method Detail

getView

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

Specified by:
getView in interface Controller

getContentManager

public ContentManager getContentManager()
Returns the content manager of this controller.


getFurnitureCatalogController

public FurnitureCatalogController getFurnitureCatalogController()
Returns the furniture catalog controller managed by this controller.


getFurnitureController

public FurnitureController getFurnitureController()
Returns the furniture controller managed by this controller.


getPlanController

public PlanController getPlanController()
Returns the controller of home plan.


getHomeController3D

public HomeController3D getHomeController3D()
Returns the controller of home 3D view.


getUndoableEditSupport

protected final UndoableEditSupport getUndoableEditSupport()
Returns the undoable edit support managed by this controller.


enableActionsBoundToSelection

protected void enableActionsBoundToSelection()
Enables or disables action bound to selection. This method will be called when selection in plan or in catalog changes and when focused component or modification state in plan changes.


enablePasteAction

public void enablePasteAction()
Enables clipboard paste action if clipboard isn't empty.


enableSelectAllAction

protected void enableSelectAllAction()
Enables select all action if home isn't empty.


addHomeFurniture

public void addHomeFurniture()
Adds the selected furniture in catalog to home and selects it.


modifySelectedFurniture

public void modifySelectedFurniture()
Modifies the selected furniture of the focused view.


importLanguageLibrary

public void importLanguageLibrary()
Imports a language library chosen by the user.


importLanguageLibrary

public void importLanguageLibrary(String languageLibraryName)
Imports a given language library.


importFurniture

public void importFurniture()
Imports furniture to the catalog or home depending on the focused view.


importFurnitureLibrary

public void importFurnitureLibrary()
Imports a furniture library chosen by the user.


importFurnitureLibrary

public void importFurnitureLibrary(String furnitureLibraryName)
Imports a given furniture library.


importTexture

public void importTexture()
Imports a texture to the texture catalog.

Since:
4.0

importTexturesLibrary

public void importTexturesLibrary()
Imports a textures library chosen by the user.


importTexturesLibrary

public void importTexturesLibrary(String texturesLibraryName)
Imports a given textures library.


undo

public void undo()
Undoes last operation.


redo

public void redo()
Redoes last undone operation.


cut

public void cut(List<? extends Selectable> items)
Deletes items and post a cut operation to undo support.


paste

public void paste(List<? extends Selectable> items)
Adds items to home and posts a paste operation to undo support.


drop

public void drop(List<? extends Selectable> items,
                 float dx,
                 float dy)
Adds items to home, moves them of (dx, dy) and posts a drop operation to undo support.


drop

public void drop(List<? extends Selectable> items,
                 View destinationView,
                 float dx,
                 float dy)
Adds items to home, moves them of (dx, dy) and posts a drop operation to undo support.


dropFiles

public void dropFiles(List<String> importableModels,
                      float dx,
                      float dy)
Adds imported models to home, moves them of (dx, dy) and post a drop operation to undo support.


delete

public void delete()
Deletes the selection in the focused component.


focusedViewChanged

public void focusedViewChanged(View focusedView)
Updates actions when focused view changed.


selectAll

public void selectAll()
Selects everything in the focused component.


newHome

public void newHome()
Creates a new home and adds it to application home list.


open

public void open()
Opens a home. This method displays an open dialog in view, reads the home from the chosen name and adds it to application home list.


open

public void open(String homeName)
Opens a given homeNamehome.


getRecentHomes

public List<String> getRecentHomes()
Returns a list of displayable recent homes.


getVersion

public String getVersion()
Returns the version of the application for display purpose.


deleteRecentHomes

public void deleteRecentHomes()
Deletes the list of recent homes in user preferences.


close

public void close()
Manages home close operation. If the home managed by this controller is modified, this method will confirm in view whether home should be saved. Once home is actually saved, home is removed from application homes list.


close

protected void close(Runnable postCloseTask)
Manages home close operation. If the home managed by this controller is modified, this method will confirm in view whether home should be saved. Once home is actually saved, home is removed from application homes list and postCloseTask is called if it's not null.


save

public void save()
Saves the home managed by this controller. If home name doesn't exist, this method will act as saveAs method.


saveAs

public void saveAs()
Saves the home managed by this controller with a different name. This method displays a save dialog in view, and saves home with the chosen name if any.


saveAndCompress

public void saveAndCompress()
Saves the home managed by this controller and compresses it. If home name doesn't exist, this method will prompt user to choose a home name.


exportToCSV

public void exportToCSV()
Controls the export of the furniture list of current home to a CSV file.

Since:
4.0

exportToSVG

public void exportToSVG()
Controls the export of the current home plan to a SVG file.


exportToOBJ

public void exportToOBJ()
Controls the export of the 3D view of current home to an OBJ file.


createPhotos

public void createPhotos()
Controls the creation of multiple photo-realistic images at the stored cameras locations.


createPhoto

public void createPhoto()
Controls the creation of photo-realistic images.


createVideo

public void createVideo()
Controls the creation of 3D videos.


setupPage

public void setupPage()
Controls page setup.


previewPrint

public void previewPrint()
Controls the print preview.


print

public void print()
Controls the print of this home.


printToPDF

public void printToPDF()
Controls the print of this home in a PDF file.


exit

public void exit()
Controls application exit. If any home in application homes list is modified, the user will be prompted in view whether he wants to discard his modifications ot not.


editPreferences

public void editPreferences()
Edits preferences and changes them if user agrees.


setMode

public void setMode(PlanController.Mode mode)
Displays a tip message dialog depending on the given mode and sets the active mode of the plan controller.


importBackgroundImage

public void importBackgroundImage()
Displays the wizard that helps to import home background image.


modifyBackgroundImage

public void modifyBackgroundImage()
Displays the wizard that helps to change home background image.


hideBackgroundImage

public void hideBackgroundImage()
Hides the home background image.


showBackgroundImage

public void showBackgroundImage()
Shows the home background image.


deleteBackgroundImage

public void deleteBackgroundImage()
Deletes home background image and posts and posts an undoable operation.


zoomOut

public void zoomOut()
Zooms out in plan.


zoomIn

public void zoomIn()
Zooms in in plan.


storeCamera

public void storeCamera()
Prompts a name for the current camera and stores it in home.


deleteCameras

public void deleteCameras()
Prompts stored cameras in home to be deleted and deletes the ones selected by the user.


detachView

public void detachView(View view)
Detaches the given view from home view.


attachView

public void attachView(View view)
Attaches the given view to home view.


help

public void help()
Displays help window.


about

public void about()
Displays about dialog.


setVisualProperty

public void setVisualProperty(String propertyName,
                              Object propertyValue)
Controls the change of value of a visual property in home.


checkUpdates

public void checkUpdates(boolean displayOnlyIfNewUpdates)
Checks if some application or libraries updates are available.

Since:
4.0

Sweet Home 3D 4.1

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