Sweet Home 3D 4.1

com.eteks.sweethome3d.swing
Class FurnitureCatalogTransferHandler

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

public class FurnitureCatalogTransferHandler
extends VisualTransferHandler

Catalog 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
FurnitureCatalogTransferHandler(ContentManager contentManager, FurnitureCatalogController catalogController, FurnitureController furnitureController)
          Creates a handler able to transfer catalog selected furniture.
 
Method Summary
 boolean canImport(JComponent destination, DataFlavor[] flavors)
          Returns true if flavors contains DataFlavor.javaFileListFlavor flavor.
protected  Transferable createTransferable(JComponent source)
          Returns a transferable object that contains a copy of the selected furniture in catalog.
 int getSourceActions(JComponent source)
          Returns COPY.
 Icon getVisualRepresentation(Transferable transferable)
          Returns the icon of the piece of furniture of transferable for HOME_FLAVOR flavor if it contains only one piece of furniture.
 boolean importData(JComponent destination, Transferable transferable)
          Add to catalog the furniture contained in transferable.
 
Methods inherited from class com.eteks.sweethome3d.swing.VisualTransferHandler
exportAsDrag
 
Methods inherited from class javax.swing.TransferHandler
canImport, exportDone, exportToClipboard, getCopyAction, getCutAction, getPasteAction, importData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FurnitureCatalogTransferHandler

public FurnitureCatalogTransferHandler(ContentManager contentManager,
                                       FurnitureCatalogController catalogController,
                                       FurnitureController furnitureController)
Creates a handler able to transfer catalog selected furniture.

Method Detail

getSourceActions

public int getSourceActions(JComponent source)
Returns COPY.

Overrides:
getSourceActions in class TransferHandler

getVisualRepresentation

public Icon getVisualRepresentation(Transferable transferable)
Returns the icon of the piece of furniture of transferable for HOME_FLAVOR flavor if it contains only one piece of furniture.

Overrides:
getVisualRepresentation in class TransferHandler
Returns:
a 48 pixels high icon of null.

createTransferable

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

Overrides:
createTransferable in class TransferHandler

canImport

public boolean canImport(JComponent destination,
                         DataFlavor[] flavors)
Returns true if flavors contains DataFlavor.javaFileListFlavor flavor.

Overrides:
canImport in class TransferHandler

importData

public boolean importData(JComponent destination,
                          Transferable transferable)
Add to catalog 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