Sweet Home 3D 4.0

com.eteks.sweethome3d.swing
Class LocatedTransferHandler

java.lang.Object
  extended by javax.swing.TransferHandler
      extended by com.eteks.sweethome3d.swing.LocatedTransferHandler
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
FurnitureTransferHandler, PlanTransferHandler

public abstract class LocatedTransferHandler
extends TransferHandler

Transfer handler that stores the dropped location of mouse pointer.

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
LocatedTransferHandler()
           
 
Method Summary
 boolean canImport(JComponent destination, DataFlavor[] flavors)
          Adds a listener to the drop target of destination that will keep track of the current drop location and returns the value returned by canImportFlavor method.
protected abstract  boolean canImportFlavor(DataFlavor[] flavors)
          Returns true if flavors contains a flavor that can be imported by this transfer handler.
protected  void dragEntered(JComponent destination, Transferable transferable, int dragAction)
          Called once transferable data entered in destination component during a drag and drop operation.
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  Point getDropLocation()
          Returns the location where mouse pointer was dropped in screen coordinates.
protected  List<String> getModelContents(List<File> files, ContentManager contentManager)
          Returns the model contents among files.
protected  boolean isDrop()
          Returns true if current operation is a drag and drop.
 
Methods inherited from class javax.swing.TransferHandler
canImport, createTransferable, exportAsDrag, exportDone, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getSourceActions, getVisualRepresentation, importData, importData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocatedTransferHandler

public LocatedTransferHandler()
Method Detail

canImport

public final boolean canImport(JComponent destination,
                               DataFlavor[] flavors)
Adds a listener to the drop target of destination that will keep track of the current drop location and returns the value returned by canImportFlavor method. Once drop is finished the listener will be removed.

Overrides:
canImport in class TransferHandler

dragEntered

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

Parameters:
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.

Parameters:
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.


canImportFlavor

protected abstract boolean canImportFlavor(DataFlavor[] flavors)
Returns true if flavors contains a flavor that can be imported by this transfer handler. Subclasses should override this method to return which flavors it supports.


getDropLocation

protected Point getDropLocation()
Returns the location where mouse pointer was dropped in screen coordinates.

Throws:
IllegalStateException - if current operation isn't a drag and drop.

isDrop

protected boolean isDrop()
Returns true if current operation is a drag and drop.


getModelContents

protected List<String> getModelContents(List<File> files,
                                        ContentManager contentManager)
Returns the model contents among files.


Sweet Home 3D 4.0

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