Sweet Home 3D 3.4

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:
java.io.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
javax.swing.TransferHandler.DropLocation, javax.swing.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(javax.swing.JComponent destination, java.awt.datatransfer.DataFlavor[] flavors)
          Returns true if flavors contains DataFlavor.javaFileListFlavor flavor.
protected  java.awt.datatransfer.Transferable createTransferable(javax.swing.JComponent source)
          Returns a transferable object that contains a copy of the selected furniture in catalog.
 int getSourceActions(javax.swing.JComponent source)
          Returns COPY.
 javax.swing.Icon getVisualRepresentation(java.awt.datatransfer.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(javax.swing.JComponent destination, java.awt.datatransfer.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(javax.swing.JComponent source)
Returns COPY.

Overrides:
getSourceActions in class javax.swing.TransferHandler

getVisualRepresentation

public javax.swing.Icon getVisualRepresentation(java.awt.datatransfer.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 javax.swing.TransferHandler
Returns:
a 48 pixels high icon of null.

createTransferable

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

Overrides:
createTransferable in class javax.swing.TransferHandler

canImport

public boolean canImport(javax.swing.JComponent destination,
                         java.awt.datatransfer.DataFlavor[] flavors)
Returns true if flavors contains DataFlavor.javaFileListFlavor flavor.

Overrides:
canImport in class javax.swing.TransferHandler

importData

public boolean importData(javax.swing.JComponent destination,
                          java.awt.datatransfer.Transferable transferable)
Add to catalog the furniture contained in transferable.

Overrides:
importData in class javax.swing.TransferHandler

Sweet Home 3D 3.4

? Copyrights 2006-2011 eTeks - All rights reserved
Distributed under GNU General Public License