net.shredzone.ifish.gui
Class EntryTransferHandler

java.lang.Object
  extended by javax.swing.TransferHandler
      extended by net.shredzone.ifish.gui.EntryTransferHandler
All Implemented Interfaces:
Serializable

public class EntryTransferHandler
extends TransferHandler

A transfer handler that allows to order Entry objects by drag and drop.

Version:
$Id: EntryTransferHandler.java 291 2009-04-28 21:29:27Z shred $
See Also:
Serialized Form

Nested Class Summary
static class EntryTransferHandler.EntryContainer
          An EntryContainer holds a selected list of Entry objects.
static class EntryTransferHandler.EntryTransferable
          This is a Transferable that allows to transfer several Entry objects as Entry itself, as well as a list of Files and a plain string.
 
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
EntryTransferHandler(IFishPane fish)
          Create a new EntryTransferHandler
 
Method Summary
 boolean canImport(JComponent comp, DataFlavor[] transferFlavors)
          Check if this TransferHandler accepts one of the given flavors.
 Transferable createTransferable(JComponent comp)
          Create a Transferable.
 int getSourceActions(JComponent c)
          Get allowed source actions.
 boolean importData(JComponent comp, Transferable t)
          Import data after dropping them to the component.
 
Methods inherited from class javax.swing.TransferHandler
canImport, exportAsDrag, exportDone, 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

EntryTransferHandler

public EntryTransferHandler(IFishPane fish)
Create a new EntryTransferHandler

Parameters:
fish - Reference to IFishPane
Method Detail

getSourceActions

public int getSourceActions(JComponent c)
Get allowed source actions. This TransferHandler only supports MOVE since we want to sort JTable entries.

Overrides:
getSourceActions in class TransferHandler
Parameters:
c - JComponent that initiates the DnD action.
Returns:
Source action, MOVE here.

canImport

public boolean canImport(JComponent comp,
                         DataFlavor[] transferFlavors)
Check if this TransferHandler accepts one of the given flavors. Only EntryContainer.entryFlavor is accepted here.

Overrides:
canImport in class TransferHandler
Parameters:
comp - JComponent that is the target of the DnD action.
transferFlavors - DataFlavors to be checked
Returns:
true if this TransferHandler accepts one of the flavors.

createTransferable

public Transferable createTransferable(JComponent comp)
Create a Transferable. The Transferable will contain all Entry objects that have been selected.

Overrides:
createTransferable in class TransferHandler
Parameters:
comp - JComponent that is the source of the DnD action.
Returns:
Transferable containing the data.

importData

public boolean importData(JComponent comp,
                          Transferable t)
Import data after dropping them to the component.

Overrides:
importData in class TransferHandler
Parameters:
comp - JComponent that is the target of the DnD action.
t - Transferable containing the transported data.
Returns:
Always true.


Copyright © 2007-2011 shredzone.org. All Rights Reserved.