org.akutan.blacklitterman.gui
Class StringTransferHandler
java.lang.Object
javax.swing.TransferHandler
org.akutan.blacklitterman.gui.StringTransferHandler
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- TableTransferHandler
public abstract class StringTransferHandler
- extends javax.swing.TransferHandler
Implements the DnD TransferHandler for managing cut/paste of objects via
the clipboard. Taken from the sun 1.4 ExtendedDnDDemo.java example.
- Since:
- 11 March 207
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from class javax.swing.TransferHandler |
javax.swing.TransferHandler.DropLocation, javax.swing.TransferHandler.TransferSupport |
| Fields inherited from class javax.swing.TransferHandler |
COPY, COPY_OR_MOVE, LINK, MOVE, NONE |
|
Method Summary |
boolean |
canImport(javax.swing.JComponent c,
java.awt.datatransfer.DataFlavor[] flavors)
Called to check whether the specified component can import data
in one of the specified DataFlavors. |
protected java.awt.datatransfer.Transferable |
createTransferable(javax.swing.JComponent c)
|
protected void |
exportDone(javax.swing.JComponent c,
java.awt.datatransfer.Transferable data,
int action)
Empty implementation of export |
protected abstract java.lang.String |
exportString(javax.swing.JComponent c)
|
int |
getSourceActions(javax.swing.JComponent c)
Returns a flag of available actions which can be applied to the source
of the drag'n'drop operation. |
boolean |
importData(javax.swing.JComponent c,
java.awt.datatransfer.Transferable t)
Imports data from the Transferable to the JComponent. |
protected abstract void |
importString(javax.swing.JComponent c,
java.lang.String str)
|
| 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 |
StringTransferHandler
public StringTransferHandler()
exportString
protected abstract java.lang.String exportString(javax.swing.JComponent c)
importString
protected abstract void importString(javax.swing.JComponent c,
java.lang.String str)
createTransferable
protected java.awt.datatransfer.Transferable createTransferable(javax.swing.JComponent c)
- Overrides:
createTransferable in class javax.swing.TransferHandler
getSourceActions
public int getSourceActions(javax.swing.JComponent c)
- Returns a flag of available actions which can be applied to the source
of the drag'n'drop operation.
- Overrides:
getSourceActions in class javax.swing.TransferHandler
- Parameters:
c - JComponent from which data is being cut
- Returns:
- Flag indicating which operatiosns are supported
importData
public boolean importData(javax.swing.JComponent c,
java.awt.datatransfer.Transferable t)
- Imports data from the Transferable to the JComponent.
- Overrides:
importData in class javax.swing.TransferHandler
- Parameters:
c - JComponent to which the data will be pastedt - Transferable from which the data will be read
- Returns:
- true if the operation succeeded
exportDone
protected void exportDone(javax.swing.JComponent c,
java.awt.datatransfer.Transferable data,
int action)
- Empty implementation of export
- Overrides:
exportDone in class javax.swing.TransferHandler
- Parameters:
c - Component from which to exportdata - Transferable into which to exportaction - Action to be performed
canImport
public boolean canImport(javax.swing.JComponent c,
java.awt.datatransfer.DataFlavor[] flavors)
- Called to check whether the specified component can import data
in one of the specified DataFlavors.
- Overrides:
canImport in class javax.swing.TransferHandler
- Parameters:
c - Component into which the data will be importedflavors - Array of flavors in which data can be transfered
- Returns:
- true if one of the flavors is allowed