Sweet Home 3D 4.1

com.eteks.sweethome3d.swing
Class FurnitureTransferHandler

java.lang.Object
  extended by javax.swing.TransferHandler
      extended by com.eteks.sweethome3d.swing.LocatedTransferHandler
          extended by com.eteks.sweethome3d.swing.FurnitureTransferHandler
All Implemented Interfaces:
Serializable

public class FurnitureTransferHandler
extends LocatedTransferHandler

Home furniture transfer handler.

Author:
Emmanuel Puybaret
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.TransferHandler
TransferHandler.DropLocation, TransferHandler.TransferSupport
 
Field Summary
 
Fields inherited from class javax.swing.TransferHandler
COPY, COPY_OR_MOVE, LINK, MOVE, NONE
 
Constructor Summary
FurnitureTransferHandler(Home home, ContentManager contentManager, HomeController homeController)
          Creates a handler able to transfer home furniture.
 
Method Summary
 boolean canImportFlavor(DataFlavor[] flavors)
          Returns true if flavors contains HOME_FLAVOR flavor or DataFlavor.javaFileListFlavor flavor.
protected  Transferable createTransferable(JComponent source)
          Returns a transferable object that contains a copy of the selected furniture in home.
protected  void exportDone(JComponent source, Transferable data, int action)
          Removes the copied element once moved.
 int getSourceActions(JComponent source)
          Returns COPY_OR_MOVE.
 boolean importData(JComponent destination, Transferable transferable)
          Add to home the furniture contained in transferable.
 
Methods inherited from class com.eteks.sweethome3d.swing.LocatedTransferHandler
canImport, dragEntered, dragExited, dragMoved, getDropLocation, getModelContents, isDrop
 
Methods inherited from class javax.swing.TransferHandler
canImport, exportAsDrag, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getVisualRepresentation, importData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FurnitureTransferHandler

public FurnitureTransferHandler(Home home,
                                ContentManager contentManager,
                                HomeController homeController)
Creates a handler able to transfer home furniture.

Method Detail

getSourceActions

public int getSourceActions(JComponent source)
Returns COPY_OR_MOVE.

Overrides:
getSourceActions in class TransferHandler

createTransferable

protected Transferable createTransferable(JComponent source)
Returns a transferable object that contains a copy of the selected furniture in home.

Overrides:
createTransferable in class TransferHandler

exportDone

protected void exportDone(JComponent source,
                          Transferable data,
                          int action)
Removes the copied element once moved.

Overrides:
exportDone in class TransferHandler

canImportFlavor

public boolean canImportFlavor(DataFlavor[] flavors)
Returns true if flavors contains HOME_FLAVOR flavor or DataFlavor.javaFileListFlavor flavor.

Specified by:
canImportFlavor in class LocatedTransferHandler

importData

public boolean importData(JComponent destination,
                          Transferable transferable)
Add to home the furniture contained in transferable.

Overrides:
importData in class TransferHandler

Sweet Home 3D 4.1

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