com.cosylab.vdct.inspector
Class InspectorTableClipboardAdapter
java.lang.Object
javax.swing.TransferHandler
com.cosylab.vdct.inspector.InspectorTableClipboardAdapter
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.io.Serializable, java.util.EventListener
public class InspectorTableClipboardAdapter
- extends javax.swing.TransferHandler
- implements java.awt.event.ActionListener
TableClipboardAdapter enables Cut-Copy-Paste Clipboard functionality on JTables.
The clipboard data format used by the adapter is compatible with
the clipboard format used by Excel/OpenOffice Calc. This provides for clipboard
interoperability between enabled JTables and Excel/OpenOffice Calc.
- Version:
- $id$
- Author:
- Matej Sekoranja
- See Also:
- Serialized Form
Fields inherited from class javax.swing.TransferHandler |
COPY, COPY_OR_MOVE, MOVE, NONE |
Constructor Summary |
InspectorTableClipboardAdapter(java.lang.Object dsId,
javax.swing.JTable table)
The adapter is constructed with a JTable on which it enables
Cut-Copy-Paste and acts as a clipboard listener. |
Method Summary |
void |
actionPerformed(java.awt.event.ActionEvent e)
This method is activated on the keystrokes we are listening to in this
implementation. |
boolean |
canImport(javax.swing.JComponent c,
java.awt.datatransfer.DataFlavor[] flavors)
|
protected java.awt.datatransfer.Transferable |
createTransferable(javax.swing.JComponent c)
|
int |
getSourceActions(javax.swing.JComponent c)
|
javax.swing.JTable |
getTable()
Accessor to the table on which this adapter acts. |
boolean |
importData(javax.swing.JComponent c,
java.awt.datatransfer.Transferable t)
|
Methods inherited from class javax.swing.TransferHandler |
exportAsDrag, exportDone, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getVisualRepresentation |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InspectorTableClipboardAdapter
public InspectorTableClipboardAdapter(java.lang.Object dsId,
javax.swing.JTable table)
- The adapter is constructed with a JTable on which it enables
Cut-Copy-Paste and acts as a clipboard listener.
- Parameters:
table
- table on which to enable to Cut-Copy-Paste actions.
getTable
public javax.swing.JTable getTable()
- Accessor to the table on which this adapter acts.
- Returns:
- managed table
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
- This method is activated on the keystrokes we are listening to in this
implementation. Here it listens for Copy and Paste, and Cut commands.
- Specified by:
actionPerformed
in interface java.awt.event.ActionListener
- See Also:
ActionListener.actionPerformed(java.awt.event.ActionEvent)
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)
- Overrides:
getSourceActions
in class javax.swing.TransferHandler
importData
public boolean importData(javax.swing.JComponent c,
java.awt.datatransfer.Transferable t)
- Overrides:
importData
in class javax.swing.TransferHandler
canImport
public boolean canImport(javax.swing.JComponent c,
java.awt.datatransfer.DataFlavor[] flavors)
- Overrides:
canImport
in class javax.swing.TransferHandler