Sweet Home 3D 4.0

com.eteks.sweethome3d.swing
Class HomePane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JRootPane
                  extended by com.eteks.sweethome3d.swing.HomePane
All Implemented Interfaces:
HomeView, View, ImageObserver, MenuContainer, Serializable, Accessible

public class HomePane
extends JRootPane
implements HomeView

The MVC view that edits a home.

Author:
Emmanuel Puybaret
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JRootPane
JRootPane.AccessibleJRootPane, JRootPane.RootLayout
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Nested classes/interfaces inherited from interface com.eteks.sweethome3d.viewcontroller.HomeView
HomeView.ActionType, HomeView.SaveAnswer
 
Field Summary
 
Fields inherited from class javax.swing.JRootPane
COLOR_CHOOSER_DIALOG, contentPane, defaultButton, defaultPressAction, defaultReleaseAction, ERROR_DIALOG, FILE_CHOOSER_DIALOG, FRAME, glassPane, INFORMATION_DIALOG, layeredPane, menuBar, NONE, PLAIN_DIALOG, QUESTION_DIALOG, WARNING_DIALOG
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
HomePane(Home home, UserPreferences preferences, HomeController controller)
          Creates home view associated with its controller.
 
Method Summary
 void attachView(View view)
          Attaches the given view to home view.
 boolean confirmDeleteCatalogSelection()
          Displays a dialog that let user choose whether he wants to delete the selected furniture from catalog or not.
 boolean confirmExit()
          Displays a dialog that let user choose whether he wants to exit application or not.
 boolean confirmReplaceFurnitureLibrary(String furnitureLibraryName)
          Displays a dialog that lets user choose whether he wants to overwrite an existing furniture library or not.
 boolean confirmReplaceLanguageLibrary(String languageLibraryName)
          Displays a dialog that lets user choose whether he wants to overwrite an existing language library or not.
 boolean confirmReplacePlugin(String pluginName)
          Displays a dialog that lets user choose whether he wants to overwrite an existing plug-in or not.
 boolean confirmReplaceTexturesLibrary(String texturesLibraryName)
          Displays a dialog that lets user choose whether he wants to overwrite an existing textures library or not.
 HomeView.SaveAnswer confirmSave(String homeName)
          Displays a dialog that lets user choose whether he wants to save the current home or not.
 boolean confirmSaveNewerHome(String homeName)
          Displays a dialog that let user choose whether he wants to save a home that was created with a newer version of Sweet Home 3D.
 void detachView(View view)
          Detaches the given view from home view.
 void exportToCSV(String csvFile)
          Exports furniture list to a given SVG file.
 void exportToOBJ(String objFile)
          Exports the objects of the 3D view to the given OBJ file.
 void exportToSVG(String svgFile)
          Exports the plan objects to a given SVG file.
 void invokeLater(Runnable runnable)
          Execute runnable asynchronously in the thread that manages toolkit events.
 boolean isClipboardEmpty()
          Returns true if clipboard contains data that components are able to handle.
 void printToPDF(String pdfFile)
          Prints a home to a given PDF file.
 void setEnabled(HomeView.ActionType actionType, boolean enabled)
          Enables or disables the action matching actionType.
 void setTransferEnabled(boolean enabled)
          Enables or disables transfer between components.
 void setUndoRedoName(String undoText, String redoText)
          Sets the NAME and SHORT_DESCRIPTION properties value of undo and redo actions.
 void showAboutDialog()
          Displays an about dialog.
 boolean showActionTipMessage(String actionTipKey)
          Displays the tip matching actionTipKey and returns true if the user chose not to display again the tip.
 List<Camera> showDeletedCamerasDialog()
          Displays a dialog showing the list of cameras stored in home and returns the ones selected by the user to be deleted.
 void showError(String message)
          Displays message in an error message box.
 String showExportToCSVDialog(String homeName)
          Shows a content chooser save dialog to export furniture list in a CSV file.
 String showExportToOBJDialog(String homeName)
          Shows a content chooser save dialog to export a 3D home in a OBJ file.
 String showExportToSVGDialog(String homeName)
          Shows a content chooser save dialog to export a home plan in a SVG file.
 String showImportFurnitureLibraryDialog()
          Displays a content chooser open dialog to choose a furniture library.
 String showImportLanguageLibraryDialog()
          Displays a content chooser open dialog to choose a language library.
 String showImportTexturesLibraryDialog()
          Displays a content chooser open dialog to choose a textures library.
 void showMessage(String message)
          Displays message in a message box.
 String showOpenDialog()
          Displays a content chooser open dialog to choose the name of a home.
 Callable<Void> showPrintDialog()
          Shows a print dialog to print the home displayed by this pane.
 String showPrintToPDFDialog(String homeName)
          Shows a content chooser save dialog to print a home in a PDF file.
 String showSaveDialog(String homeName)
          Displays a content chooser save dialog to choose the name of a home.
 String showStoreCameraDialog(String cameraName)
          Displays a dialog that lets the user choose a name for the current camera.
 boolean showUpdatesMessage(String updatesMessage, boolean showOnlyMessage)
          Displays the given message and returns false if the user doesn't want to be informed of the shown updates anymore.
protected  void updateOpenRecentHomeMenu(JMenu openRecentHomeMenu, HomeController controller)
          Updates openRecentHomeMenu from current recent homes in preferences.
 
Methods inherited from class javax.swing.JRootPane
addImpl, addNotify, createContentPane, createGlassPane, createLayeredPane, createRootLayout, getAccessibleContext, getContentPane, getDefaultButton, getGlassPane, getJMenuBar, getLayeredPane, getMenuBar, getUI, getUIClassID, getWindowDecorationStyle, isOptimizedDrawingEnabled, isValidateRoot, paramString, removeNotify, setContentPane, setDefaultButton, setDoubleBuffered, setGlassPane, setJMenuBar, setLayeredPane, setMenuBar, setUI, setWindowDecorationStyle, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HomePane

public HomePane(Home home,
                UserPreferences preferences,
                HomeController controller)
Creates home view associated with its controller.

Method Detail

updateOpenRecentHomeMenu

protected void updateOpenRecentHomeMenu(JMenu openRecentHomeMenu,
                                        HomeController controller)
Updates openRecentHomeMenu from current recent homes in preferences.


setEnabled

public void setEnabled(HomeView.ActionType actionType,
                       boolean enabled)
Enables or disables the action matching actionType.

Specified by:
setEnabled in interface HomeView

setUndoRedoName

public void setUndoRedoName(String undoText,
                            String redoText)
Sets the NAME and SHORT_DESCRIPTION properties value of undo and redo actions. If a parameter is null, the properties will be reset to their initial values.

Specified by:
setUndoRedoName in interface HomeView

setTransferEnabled

public void setTransferEnabled(boolean enabled)
Enables or disables transfer between components.

Specified by:
setTransferEnabled in interface HomeView

detachView

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

Specified by:
detachView in interface HomeView

attachView

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

Specified by:
attachView in interface HomeView

showOpenDialog

public String showOpenDialog()
Displays a content chooser open dialog to choose the name of a home.

Specified by:
showOpenDialog in interface HomeView

showImportLanguageLibraryDialog

public String showImportLanguageLibraryDialog()
Displays a content chooser open dialog to choose a language library.

Specified by:
showImportLanguageLibraryDialog in interface HomeView

confirmReplaceLanguageLibrary

public boolean confirmReplaceLanguageLibrary(String languageLibraryName)
Displays a dialog that lets user choose whether he wants to overwrite an existing language library or not.

Specified by:
confirmReplaceLanguageLibrary in interface HomeView

showImportFurnitureLibraryDialog

public String showImportFurnitureLibraryDialog()
Displays a content chooser open dialog to choose a furniture library.

Specified by:
showImportFurnitureLibraryDialog in interface HomeView

confirmReplaceFurnitureLibrary

public boolean confirmReplaceFurnitureLibrary(String furnitureLibraryName)
Displays a dialog that lets user choose whether he wants to overwrite an existing furniture library or not.

Specified by:
confirmReplaceFurnitureLibrary in interface HomeView

showImportTexturesLibraryDialog

public String showImportTexturesLibraryDialog()
Displays a content chooser open dialog to choose a textures library.

Specified by:
showImportTexturesLibraryDialog in interface HomeView

confirmReplaceTexturesLibrary

public boolean confirmReplaceTexturesLibrary(String texturesLibraryName)
Displays a dialog that lets user choose whether he wants to overwrite an existing textures library or not.

Specified by:
confirmReplaceTexturesLibrary in interface HomeView

confirmReplacePlugin

public boolean confirmReplacePlugin(String pluginName)
Displays a dialog that lets user choose whether he wants to overwrite an existing plug-in or not.

Specified by:
confirmReplacePlugin in interface HomeView

showSaveDialog

public String showSaveDialog(String homeName)
Displays a content chooser save dialog to choose the name of a home.

Specified by:
showSaveDialog in interface HomeView

showError

public void showError(String message)
Displays message in an error message box.

Specified by:
showError in interface HomeView

showMessage

public void showMessage(String message)
Displays message in a message box.

Specified by:
showMessage in interface HomeView

showActionTipMessage

public boolean showActionTipMessage(String actionTipKey)
Displays the tip matching actionTipKey and returns true if the user chose not to display again the tip.

Specified by:
showActionTipMessage in interface HomeView

confirmSave

public HomeView.SaveAnswer confirmSave(String homeName)
Displays a dialog that lets user choose whether he wants to save the current home or not.

Specified by:
confirmSave in interface HomeView
Returns:
HomeView.SaveAnswer.SAVE if the user chose to save home, HomeView.SaveAnswer.DO_NOT_SAVE if he doesn't want to save home, or HomeView.SaveAnswer.CANCEL if he doesn't want to continue current operation.

confirmSaveNewerHome

public boolean confirmSaveNewerHome(String homeName)
Displays a dialog that let user choose whether he wants to save a home that was created with a newer version of Sweet Home 3D.

Specified by:
confirmSaveNewerHome in interface HomeView
Returns:
true if user confirmed to save.

confirmExit

public boolean confirmExit()
Displays a dialog that let user choose whether he wants to exit application or not.

Specified by:
confirmExit in interface HomeView
Returns:
true if user confirmed to exit.

showAboutDialog

public void showAboutDialog()
Displays an about dialog.

Specified by:
showAboutDialog in interface HomeView

showUpdatesMessage

public boolean showUpdatesMessage(String updatesMessage,
                                  boolean showOnlyMessage)
Displays the given message and returns false if the user doesn't want to be informed of the shown updates anymore.

Specified by:
showUpdatesMessage in interface HomeView
Parameters:
updatesMessage - the message to display
showOnlyMessage - if false a check box proposing not to display again shown updates will be shown.

showPrintDialog

public Callable<Void> showPrintDialog()
Shows a print dialog to print the home displayed by this pane.

Specified by:
showPrintDialog in interface HomeView
Returns:
a print task to execute or null if the user canceled print. The call method of the returned task may throw a RecorderException exception if print failed or an InterruptedRecorderException exception if it was interrupted.

showPrintToPDFDialog

public String showPrintToPDFDialog(String homeName)
Shows a content chooser save dialog to print a home in a PDF file.

Specified by:
showPrintToPDFDialog in interface HomeView

printToPDF

public void printToPDF(String pdfFile)
                throws RecorderException
Prints a home to a given PDF file. This method may be overridden to write to another kind of output stream. Caution !!! This method may be called from an other thread than EDT.

Specified by:
printToPDF in interface HomeView
Throws:
RecorderException

showExportToCSVDialog

public String showExportToCSVDialog(String homeName)
Shows a content chooser save dialog to export furniture list in a CSV file.

Specified by:
showExportToCSVDialog in interface HomeView

exportToCSV

public void exportToCSV(String csvFile)
                 throws RecorderException
Exports furniture list to a given SVG file. Caution !!! This method may be called from an other thread than EDT.

Specified by:
exportToCSV in interface HomeView
Throws:
RecorderException

showExportToSVGDialog

public String showExportToSVGDialog(String homeName)
Shows a content chooser save dialog to export a home plan in a SVG file.

Specified by:
showExportToSVGDialog in interface HomeView

exportToSVG

public void exportToSVG(String svgFile)
                 throws RecorderException
Exports the plan objects to a given SVG file. Caution !!! This method may be called from an other thread than EDT.

Specified by:
exportToSVG in interface HomeView
Throws:
RecorderException

showExportToOBJDialog

public String showExportToOBJDialog(String homeName)
Shows a content chooser save dialog to export a 3D home in a OBJ file.

Specified by:
showExportToOBJDialog in interface HomeView

exportToOBJ

public void exportToOBJ(String objFile)
                 throws RecorderException
Exports the objects of the 3D view to the given OBJ file. Caution !!! This method may be called from an other thread than EDT.

Specified by:
exportToOBJ in interface HomeView
Throws:
RecorderException

confirmDeleteCatalogSelection

public boolean confirmDeleteCatalogSelection()
Displays a dialog that let user choose whether he wants to delete the selected furniture from catalog or not.

Specified by:
confirmDeleteCatalogSelection in interface HomeView
Returns:
true if user confirmed to delete.

showStoreCameraDialog

public String showStoreCameraDialog(String cameraName)
Displays a dialog that lets the user choose a name for the current camera.

Specified by:
showStoreCameraDialog in interface HomeView
Returns:
the chosen name or null if the user canceled.

showDeletedCamerasDialog

public List<Camera> showDeletedCamerasDialog()
Displays a dialog showing the list of cameras stored in home and returns the ones selected by the user to be deleted.

Specified by:
showDeletedCamerasDialog in interface HomeView

isClipboardEmpty

public boolean isClipboardEmpty()
Returns true if clipboard contains data that components are able to handle.

Specified by:
isClipboardEmpty in interface HomeView

invokeLater

public void invokeLater(Runnable runnable)
Execute runnable asynchronously in the thread that manages toolkit events.

Specified by:
invokeLater in interface HomeView

Sweet Home 3D 4.0

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