zinger.bsheet
Class TableModifier

java.lang.Object
  extended by zinger.bsheet.TableModifier
All Implemented Interfaces:
java.awt.datatransfer.ClipboardOwner, java.awt.event.ActionListener, java.util.EventListener

public class TableModifier
extends java.lang.Object
implements java.awt.event.ActionListener, java.awt.datatransfer.ClipboardOwner


Field Summary
protected  javax.swing.JTable table
           
 
Constructor Summary
TableModifier(javax.swing.JTable table)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ev)
           
 void copyRegion(int startRow, int startColumn, int endRow, int endColumn, boolean asObjects)
           
 void deleteRegion(int startRow, int startColumn, int endRow, int endColumn)
           
 boolean ensureColumnCount(int count)
           
 boolean ensureRowCount(int count)
           
 void flipRegion(int startRow, int startColumn, int endRow, int endColumn)
           
 java.awt.datatransfer.Transferable getContents(int row, int column, boolean asObjects)
          Creates a Transferable object representing contents and appearance of a cell.
 java.awt.datatransfer.Transferable getContents(int startRow, int startColumn, int endRow, int endColumn, boolean asObjects)
          Creates a Transferable object representing contents and appearance of a cell region.
protected  java.util.Map getContentsMap(java.awt.datatransfer.Transferable contents)
           
 java.awt.Point[] getSelectionCorners()
           
 void lostOwnership(java.awt.datatransfer.Clipboard clipboard, java.awt.datatransfer.Transferable contents)
           
 void paste(int startRow, int startColumn)
           
 void paste(int row1, int column1, int row2, int column2)
           
 void setContents(java.awt.datatransfer.Transferable contents, int startRow, int startColumn)
          Writes the contents of a Transferable object starting at the top left corner specified.
 void setContents(java.awt.datatransfer.Transferable contents, int startRow, int startColumn, int endRow, int endColumn)
          Writes the contents of a Transferable object starting at the top left corner specified.
 void swapCells(int row1, int column1, int row2, int column2, boolean asObjects)
          Swaps contents of two cells.
 void translateValueTo(int sourceRow, int sourceCol, int targetRowMin, int targetColMin, int targetRowMax, int targetColMax)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

table

protected final javax.swing.JTable table
Constructor Detail

TableModifier

public TableModifier(javax.swing.JTable table)
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ev)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

getSelectionCorners

public java.awt.Point[] getSelectionCorners()

copyRegion

public void copyRegion(int startRow,
                       int startColumn,
                       int endRow,
                       int endColumn,
                       boolean asObjects)

getContents

public java.awt.datatransfer.Transferable getContents(int startRow,
                                                      int startColumn,
                                                      int endRow,
                                                      int endColumn,
                                                      boolean asObjects)
Creates a Transferable object representing contents and appearance of a cell region.

Parameters:
startRow - table row index of top left region corner
startColumn - table column index of top left region corner
endRow - table row index of bottom right region corner
endColumn - table column index of bottom right region corner
asObjects - if true, result contains model value, otherwise formatted text value
Since:
0.9.1
See Also:
setContents(java.awt.datatransfer.Transferable, int, int), getContents(int, int, boolean)

getContents

public java.awt.datatransfer.Transferable getContents(int row,
                                                      int column,
                                                      boolean asObjects)
Creates a Transferable object representing contents and appearance of a cell. Calls getContents(row, column, row, column, asObjects).

Since:
0.9.1
See Also:
setContents(java.awt.datatransfer.Transferable, int, int), getContents(int, int, int, int, boolean)

deleteRegion

public void deleteRegion(int startRow,
                         int startColumn,
                         int endRow,
                         int endColumn)

flipRegion

public void flipRegion(int startRow,
                       int startColumn,
                       int endRow,
                       int endColumn)
Since:
0.9.1

swapCells

public void swapCells(int row1,
                      int column1,
                      int row2,
                      int column2,
                      boolean asObjects)
Swaps contents of two cells.

Since:
0.9.1

lostOwnership

public void lostOwnership(java.awt.datatransfer.Clipboard clipboard,
                          java.awt.datatransfer.Transferable contents)
Specified by:
lostOwnership in interface java.awt.datatransfer.ClipboardOwner

paste

public void paste(int startRow,
                  int startColumn)

paste

public void paste(int row1,
                  int column1,
                  int row2,
                  int column2)
Since:
1.0.3

getContentsMap

protected java.util.Map getContentsMap(java.awt.datatransfer.Transferable contents)
Since:
1.0.3

setContents

public void setContents(java.awt.datatransfer.Transferable contents,
                        int startRow,
                        int startColumn)
Writes the contents of a Transferable object starting at the top left corner specified.

Parameters:
contents - table (model) data to be written
startRow - table row index of top left corner of the region
startColumn - table column index of top left corner of the region
Since:
0.9.1
See Also:
setContents(java.awt.datatransfer.Transferable, int, int, int, int), getContents(int, int, int, int, boolean), getContents(int, int, boolean)

setContents

public void setContents(java.awt.datatransfer.Transferable contents,
                        int startRow,
                        int startColumn,
                        int endRow,
                        int endColumn)
Writes the contents of a Transferable object starting at the top left corner specified. Optionally fills the entire specified rectangle if endRow and endColumn are greater or equal to startRow and startColumn respectively. Filling is achieved by not going out of bounds of the rectangle and repeating the clipboard contents until the rectangle is filled.

Parameters:
contents - table (model) data to be written
startRow - table row index of top left corner of the region
startColumn - table column index of top left corner of the region
endRow - table row index of bottom right corner of the region (values < startRow signify no filling)
endColumn - table column index of bottom right corner of the region (values < startColumn signify no filling)
Since:
1.0.3
See Also:
getContents(int, int, int, int, boolean), getContents(int, int, boolean)

ensureColumnCount

public boolean ensureColumnCount(int count)

ensureRowCount

public boolean ensureRowCount(int count)

translateValueTo

public void translateValueTo(int sourceRow,
                             int sourceCol,
                             int targetRowMin,
                             int targetColMin,
                             int targetRowMax,
                             int targetColMax)