Sweet Home 3D 4.1

com.eteks.sweethome3d.swing
Class PlanTransferHandler

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

public class PlanTransferHandler
extends LocatedTransferHandler

Plan 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
PlanTransferHandler(Home home, ContentManager contentManager, HomeController homeController)
          Creates a handler able to transfer furniture and walls in plan.
 
Method Summary
protected  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 items in home and an image of the selected items.
protected  void dragEntered(JComponent destination, Transferable transferable, int dragAction)
          Notifies home controller that a drag operation started if transferable data contains HOME_FLAVOR flavor and destination is a plan.
protected  void dragExited(JComponent destination)
          Called once the cursor left destination component during a drag and drop operation.
protected  void dragMoved(JComponent destination, Transferable transferable, int dragAction)
          Called when transferable data moved in destination component during a drag and drop operation.
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)
          Adds items contained in transferable to home.
 
Methods inherited from class com.eteks.sweethome3d.swing.LocatedTransferHandler
canImport, 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

PlanTransferHandler

public PlanTransferHandler(Home home,
                           ContentManager contentManager,
                           HomeController homeController)
Creates a handler able to transfer furniture and walls in plan.

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 items in home and an image of the selected items.

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

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

Specified by:
canImportFlavor in class LocatedTransferHandler

dragEntered

protected void dragEntered(JComponent destination,
                           Transferable transferable,
                           int dragAction)
Notifies home controller that a drag operation started if transferable data contains HOME_FLAVOR flavor and destination is a plan.

Overrides:
dragEntered in class LocatedTransferHandler
dragAction - the current drag action (TransferHandler.COPY, TransferHandler.MOVE or TransferHandler.LINK)

dragMoved

protected void dragMoved(JComponent destination,
                         Transferable transferable,
                         int dragAction)
Called when transferable data moved in destination component during a drag and drop operation. Subclasses should override this method if they are interested by this event.

Overrides:
dragMoved in class LocatedTransferHandler
dragAction - the current drag action (TransferHandler.COPY, TransferHandler.MOVE or TransferHandler.LINK)

dragExited

protected void dragExited(JComponent destination)
Called once the cursor left destination component during a drag and drop operation. Subclasses should override this method if they are interested by this event.

Overrides:
dragExited in class LocatedTransferHandler

importData

public boolean importData(JComponent destination,
                          Transferable transferable)
Adds items contained in transferable to home.

Overrides:
importData in class TransferHandler

Sweet Home 3D 4.1

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