public abstract class LocatedTransferHandler
extends javax.swing.TransferHandler
Constructor and Description |
---|
LocatedTransferHandler() |
Modifier and Type | Method and Description |
---|---|
boolean |
canImport(javax.swing.JComponent destination,
java.awt.datatransfer.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(java.awt.datatransfer.DataFlavor[] flavors)
Returns
true if flavors contains a flavor that
can be imported by this transfer handler. |
protected void |
dragEntered(javax.swing.JComponent destination,
java.awt.datatransfer.Transferable transferable,
int dragAction)
Called once
transferable data entered in destination component
during a drag and drop operation. |
protected void |
dragExited(javax.swing.JComponent destination)
Called once the cursor left
destination component during a drag and drop operation. |
protected void |
dragMoved(javax.swing.JComponent destination,
java.awt.datatransfer.Transferable transferable,
int dragAction)
Called when
transferable data moved in destination component
during a drag and drop operation. |
protected java.awt.Point |
getDropLocation()
Returns the location where mouse pointer was dropped in screen coordinates.
|
protected java.util.List<java.lang.String> |
getModelContents(java.util.List<java.io.File> files,
ContentManager contentManager)
Returns the model contents among files.
|
protected boolean |
isDrop()
Returns
true if current operation is a drag and drop. |
canImport, createTransferable, exportAsDrag, exportDone, exportToClipboard, getCopyAction, getCutAction, getDragImage, getDragImageOffset, getPasteAction, getSourceActions, getVisualRepresentation, importData, importData, setDragImage, setDragImageOffset
public final boolean canImport(javax.swing.JComponent destination, java.awt.datatransfer.DataFlavor[] flavors)
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.canImport
in class javax.swing.TransferHandler
protected void dragEntered(javax.swing.JComponent destination, java.awt.datatransfer.Transferable transferable, int dragAction)
transferable
data entered in destination
component
during a drag and drop operation. Subclasses should override this method if they are
interested by this event.dragAction
- the current drag action (TransferHandler.COPY
, TransferHandler.MOVE
or TransferHandler.LINK
)protected void dragMoved(javax.swing.JComponent destination, java.awt.datatransfer.Transferable transferable, int dragAction)
transferable
data moved in destination
component
during a drag and drop operation. Subclasses should override this method if they are
interested by this event.dragAction
- the current drag action (TransferHandler.COPY
, TransferHandler.MOVE
or TransferHandler.LINK
)protected void dragExited(javax.swing.JComponent destination)
destination
component during a drag and drop operation.
Subclasses should override this method if they are interested by this event.protected abstract boolean canImportFlavor(java.awt.datatransfer.DataFlavor[] flavors)
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.protected java.awt.Point getDropLocation()
java.lang.IllegalStateException
- if current operation isn't a drag and drop.protected boolean isDrop()
true
if current operation is a drag and drop.protected java.util.List<java.lang.String> getModelContents(java.util.List<java.io.File> files, ContentManager contentManager)
© Copyright 2024 Space Mushrooms
Distributed under GNU General Public License