org.tbee.swing.table
Class JTableMultipleCellsCopyAdapter

java.lang.Object
  extended by org.tbee.swing.table.JTableMultipleCellsCopyAdapter
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class JTableMultipleCellsCopyAdapter
extends java.lang.Object
implements java.awt.event.ActionListener

JTableMultipleCellsCopyAdapter enables Copy-Paste Clipboard functionality on JTables. The clipboard data format used by the adapter is compatible with the clipboard format used by Excel. This provides for clipboard interoperability between enabled JTables and Excel. NOTE: this adapter copies and pastes String, so the get- and setValueAt must be able to process strings. SetValueAt is not that difficult; if a certain col receives a string instead of the expected type, it needs to be converted. However getValueAt does not know when to return a String and when to return the actual class. So org.tbee.swing.table.JTable has a getValueAtAsString

Version:
$Revision: 1.7 $
Author:
$Author: toeukpap $

Field Summary
static java.lang.String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Constructor Summary
JTableMultipleCellsCopyAdapter(javax.swing.JTable myJTable)
          The Excel Adapter is constructed with a JTable on which it enables 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.
static void copy(javax.swing.JTable table)
          Copy to system clipboard in Excel compatible format
static void cut(javax.swing.JTable table)
          Copy to system clipboard in Excel compatible format
 javax.swing.JTable getJTable()
          the wrapper table
static void paste(javax.swing.JTable table)
          Paste from system clipboard in Excel compatible format
 void setJTable(javax.swing.JTable value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOURCECODE_VERSION

public static final java.lang.String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values
Constructor Detail

JTableMultipleCellsCopyAdapter

public JTableMultipleCellsCopyAdapter(javax.swing.JTable myJTable)
The Excel Adapter is constructed with a JTable on which it enables Copy-Paste and acts as a Clipboard listener.

Method Detail

getJTable

public javax.swing.JTable getJTable()
the wrapper table


setJTable

public void setJTable(javax.swing.JTable value)

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 ActionCommands. Selections comprising non-adjacent cells result in invalid selection and then copy action cannot be performed. Paste is done by aligning the upper left corner of the selection with the 1st element in the current selection of the JTable.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

cut

public static void cut(javax.swing.JTable table)
Copy to system clipboard in Excel compatible format

Parameters:
table -

copy

public static void copy(javax.swing.JTable table)
Copy to system clipboard in Excel compatible format

Parameters:
table -

paste

public static void paste(javax.swing.JTable table)
Paste from system clipboard in Excel compatible format

Parameters:
table -


Copyright © 2010. All Rights Reserved.