JAPI 0.9.0
Yet another Java API
API Documentation

net.sf.japi.swing.bookmarks
Class BookmarkTransferHandler

java.lang.Object
  extended by javax.swing.TransferHandler
      extended by net.sf.japi.swing.bookmarks.BookmarkTransferHandler
All Implemented Interfaces:
Serializable

public class BookmarkTransferHandler
extends TransferHandler

Class for DnD in Bookmarks displaying JTrees.

Author:
Christian Hujer
See Also:
Serialized Form
Todo:
improve implementation

Field Summary
 
Fields inherited from class javax.swing.TransferHandler
COPY, COPY_OR_MOVE, MOVE, NONE
 
Constructor Summary
BookmarkTransferHandler()
           
 
Method Summary
 boolean canImport(JComponent comp, DataFlavor[] transferFlavors)
          Indicates whether a component would accept an import of the given set of data flavors prior to actually attempting to import it.
 Transferable createTransferable(JComponent c)
          Creates a Transferable to use as the source for a data transfer.
 int getSourceActions(JComponent c)
          Returns the type of transfer actions supported by the source.
 
Methods inherited from class javax.swing.TransferHandler
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

BookmarkTransferHandler

public BookmarkTransferHandler()
Method Detail

createTransferable

public Transferable createTransferable(JComponent c)
Creates a Transferable to use as the source for a data transfer. Returns the representation of the data to be transferred, or null if the component's property is null

Overrides:
createTransferable in class TransferHandler
Parameters:
c - the component holding the data to be transferred; this argument is provided to enable sharing of TransferHandlers by multiple components
Returns:
the representation of the data to be transferred, or null if the property associated with c is null

canImport

public boolean canImport(JComponent comp,
                         DataFlavor[] transferFlavors)
Indicates whether a component would accept an import of the given set of data flavors prior to actually attempting to import it.

Overrides:
canImport in class TransferHandler
Parameters:
comp - the component to receive the transfer; this argument is provided to enable sharing of TransferHandlers by multiple components
transferFlavors - the data formats available
Returns:
true if the data can be inserted into the component, false otherwise
Todo:
correctly implement this

getSourceActions

public int getSourceActions(JComponent c)
Returns the type of transfer actions supported by the source. Some models are not mutable, so a transfer operation of COPY only should be advertised in that case.

Overrides:
getSourceActions in class TransferHandler
Parameters:
c - the component holding the data to be transferred; this argument is provided to enable sharing of TransferHandlers by multiple components.
Returns:
COPY if the transfer property can be found, otherwise returns NONE; a return value of of NONE disables any transfers out of the component

JAPI
Yet another Java API
API Documentation

© 2005-2006 Christian Hujer. All rights reserved. See copyright