dsto.dfc.swing.table
Class AbstractDfcTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by dsto.dfc.swing.table.AbstractDfcTableModel
All Implemented Interfaces:
DfcTableModel, Serializable, TableModel
Direct Known Subclasses:
DefaultDfcTableModel, MapTableModel, ProxyTableModel, StyleSheetTableModel

public abstract class AbstractDfcTableModel
extends AbstractTableModel
implements DfcTableModel

Base class for implementations of DfcTableModel. Provides default empty implementations of DfcTableModel methods.

Version:
$Revision$
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
AbstractDfcTableModel()
           
 
Method Summary
 boolean canCopyCells(int startRow, int endRow, int startColumn, int endColumn)
          Test if a copyCells () operation is permitted.
 boolean canCopyRows(int startRow, int endRow)
           
 boolean canDeleteCells(int startRow, int endRow, int startColumn, int endColumn)
          Test if a deleteCells () operation is permitted.
 boolean canDeleteColumns(int columnStart, int columnEnd)
          Test if a deleteColumns () operation is supported.
 boolean canDeleteRows(int rowStart, int rowEnd)
          Test if a deleteRows () operation is supported.
 boolean canInsertColumn(int columnIndex, String columnName, Class columnClass)
          Test if an insertColumn () operation is supported.
 boolean canInsertRows(int rowStart, int rowCount)
          Test if an insertRows () operation is supported.
 boolean canMoveRows(int startRow, int endRow, int newStartRow)
           
 boolean canPasteCells(Transferable transferable, int startRow, int endRow, int startColumn, int endColumn)
          Should return true if rows may be pasted from a given Transferable into a block of cells.
 boolean canPasteRows(Transferable transferable, int rowStart)
          Should return true if rows may be pasted from a given Transferable at the given row.
 Transferable copyCells(int startRow, int endRow, int startColumn, int endColumn)
          Copy a rectangular block of cells into an AWT Transferable.
 Transferable copyRows(int startRow, int endRow)
           
 void deleteCells(int startRow, int endRow, int startColumn, int endColumn)
          Delete a rectangular block of cells.
 void deleteColumns(int columnStart, int columnEnd)
          Delete columns.
 void deleteRows(int rowStart, int rowEnd)
          Delete rows.
 void insertColumn(int columnIndex, String columnName, Class columnClass)
          Insert a new column containing blank values.
 void insertRows(int rowStart, int rowCount)
          Insert empty rows.
 boolean moveRows(int startRow, int endRow, int newStartRow)
           
 void pasteCells(Transferable transferable, int startRow, int endRow, int startColumn, int endColumn)
           
 void pasteRows(Transferable transferable, int rowStart)
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getColumnClass, getColumnCount, getColumnName, getRowCount, getValueAt, isCellEditable, removeTableModelListener, setValueAt
 

Constructor Detail

AbstractDfcTableModel

public AbstractDfcTableModel()
Method Detail

insertRows

public void insertRows(int rowStart,
                       int rowCount)
Description copied from interface: DfcTableModel
Insert empty rows.

Specified by:
insertRows in interface DfcTableModel
Parameters:
rowStart - The row to begin inserting.
rowCount - The number of rows to insert.
See Also:
DfcTableModel.canInsertRows(int, int)

deleteRows

public void deleteRows(int rowStart,
                       int rowEnd)
                throws UnsupportedOperationException
Description copied from interface: DfcTableModel
Delete rows.

Specified by:
deleteRows in interface DfcTableModel
Parameters:
rowStart - The row to begin inserting.
rowEnd - The last row to delete.
Throws:
UnsupportedOperationException - if this is not supported.
See Also:
DfcTableModel.canDeleteRows(int, int)

canInsertRows

public boolean canInsertRows(int rowStart,
                             int rowCount)
Description copied from interface: DfcTableModel
Test if an insertRows () operation is supported.

Specified by:
canInsertRows in interface DfcTableModel
Parameters:
rowStart - The row to begin inserting.
rowCount - The number of rows to insert.
Returns:
True if the insert is possible.

canDeleteRows

public boolean canDeleteRows(int rowStart,
                             int rowEnd)
Description copied from interface: DfcTableModel
Test if a deleteRows () operation is supported.

Specified by:
canDeleteRows in interface DfcTableModel
Parameters:
rowStart - The row to begin inserting.
rowEnd - The last row to delete.
Returns:
True if the delete is possible.

canMoveRows

public boolean canMoveRows(int startRow,
                           int endRow,
                           int newStartRow)
Specified by:
canMoveRows in interface DfcTableModel

moveRows

public boolean moveRows(int startRow,
                        int endRow,
                        int newStartRow)
                 throws UnsupportedOperationException
Specified by:
moveRows in interface DfcTableModel
Throws:
UnsupportedOperationException

insertColumn

public void insertColumn(int columnIndex,
                         String columnName,
                         Class columnClass)
                  throws UnsupportedOperationException
Description copied from interface: DfcTableModel
Insert a new column containing blank values.

Specified by:
insertColumn in interface DfcTableModel
Parameters:
columnIndex - The index for the new column.
columnName - The name of the new column. May be null to indicate automatic name.
columnClass - The class of values in the column.
Throws:
UnsupportedOperationException
See Also:
DfcTableModel.canInsertColumn(int, java.lang.String, java.lang.Class)

deleteColumns

public void deleteColumns(int columnStart,
                          int columnEnd)
                   throws UnsupportedOperationException
Description copied from interface: DfcTableModel
Delete columns.

Specified by:
deleteColumns in interface DfcTableModel
Parameters:
columnStart - The index of the first column.
columnEnd - The index of the last column.
Throws:
UnsupportedOperationException
See Also:
DfcTableModel.canDeleteColumns(int, int)

canInsertColumn

public boolean canInsertColumn(int columnIndex,
                               String columnName,
                               Class columnClass)
Description copied from interface: DfcTableModel
Test if an insertColumn () operation is supported.

Specified by:
canInsertColumn in interface DfcTableModel
Parameters:
columnIndex - The index for the new column.
columnName - The name of the new column. May be null to indicate automatic name.
columnClass - The class of values in the column.
Returns:
True if the insert is possible.

canDeleteColumns

public boolean canDeleteColumns(int columnStart,
                                int columnEnd)
Description copied from interface: DfcTableModel
Test if a deleteColumns () operation is supported.

Specified by:
canDeleteColumns in interface DfcTableModel
Parameters:
columnStart - The index of the first column.
columnEnd - The index of the last column.
Returns:
True if the delete is possible.

canDeleteCells

public boolean canDeleteCells(int startRow,
                              int endRow,
                              int startColumn,
                              int endColumn)
Description copied from interface: DfcTableModel
Test if a deleteCells () operation is permitted.

Specified by:
canDeleteCells in interface DfcTableModel
Parameters:
startRow - The first row to delete.
endRow - The last row to delete.
startColumn - The first column to delete.
endColumn - The last column to delete.
Returns:
True if the operation is permitted.

deleteCells

public void deleteCells(int startRow,
                        int endRow,
                        int startColumn,
                        int endColumn)
                 throws UnsupportedOperationException
Description copied from interface: DfcTableModel
Delete a rectangular block of cells. The deleted cells should be reset to their default values.

Specified by:
deleteCells in interface DfcTableModel
Parameters:
startRow - The first row to delete.
endRow - The last row to delete.
startColumn - The first column to delete.
endColumn - The last column to delete.
Throws:
UnsupportedOperationException
See Also:
DfcTableModel.canDeleteCells(int, int, int, int)

canCopyRows

public boolean canCopyRows(int startRow,
                           int endRow)
Specified by:
canCopyRows in interface DfcTableModel

copyRows

public Transferable copyRows(int startRow,
                             int endRow)
                      throws UnsupportedOperationException,
                             CloneNotSupportedException
Specified by:
copyRows in interface DfcTableModel
Throws:
UnsupportedOperationException
CloneNotSupportedException

canPasteRows

public boolean canPasteRows(Transferable transferable,
                            int rowStart)
Description copied from interface: DfcTableModel
Should return true if rows may be pasted from a given Transferable at the given row. Note that the data in the transferable may not be accessible at this time (eg during a drap and drop operation): calling getTransferData () will result in an IOException.

Specified by:
canPasteRows in interface DfcTableModel
Parameters:
transferable - The transferable.
rowStart - The row to insert the transferable at.
Returns:
True if the transferable can be pasted at startRow.

pasteRows

public void pasteRows(Transferable transferable,
                      int rowStart)
               throws UnsupportedOperationException,
                      UnsupportedFlavorException,
                      CloneNotSupportedException,
                      IOException
Specified by:
pasteRows in interface DfcTableModel
Throws:
UnsupportedOperationException
UnsupportedFlavorException
CloneNotSupportedException
IOException

canCopyCells

public boolean canCopyCells(int startRow,
                            int endRow,
                            int startColumn,
                            int endColumn)
Description copied from interface: DfcTableModel
Test if a copyCells () operation is permitted.

Specified by:
canCopyCells in interface DfcTableModel
Parameters:
startRow - The first row to copy.
endRow - The last row to copy.
startColumn - The first column to copy.
endColumn - The last column to copy.
Returns:
True if the operation is permitted.

copyCells

public Transferable copyCells(int startRow,
                              int endRow,
                              int startColumn,
                              int endColumn)
                       throws UnsupportedOperationException,
                              CloneNotSupportedException
Description copied from interface: DfcTableModel
Copy a rectangular block of cells into an AWT Transferable. The flavors supported by the transferable may include TableModelTransferable.TABLE_MODEL_FLAVOR but this is not required.

Specified by:
copyCells in interface DfcTableModel
Parameters:
startRow - The first row to copy.
endRow - The last row to copy.
startColumn - The first column to copy.
endColumn - The last column to copy.
Throws:
CloneNotSupportedException - if a data item could not be cloned.
UnsupportedOperationException
See Also:
DfcTableModel.canCopyRows(int, int)

canPasteCells

public boolean canPasteCells(Transferable transferable,
                             int startRow,
                             int endRow,
                             int startColumn,
                             int endColumn)
Description copied from interface: DfcTableModel
Should return true if rows may be pasted from a given Transferable into a block of cells. Note that the data in the transferable may not be accessible at this time (eg during a drap and drop operation): calling getTransferData () will result in an IOException in this case.

Specified by:
canPasteCells in interface DfcTableModel
Parameters:
transferable - The transferable.
startRow - The row to insert the transferable at.
Returns:
True if the transferable can be pasted at startRow.

pasteCells

public void pasteCells(Transferable transferable,
                       int startRow,
                       int endRow,
                       int startColumn,
                       int endColumn)
                throws UnsupportedOperationException,
                       UnsupportedFlavorException,
                       CloneNotSupportedException,
                       IOException
Specified by:
pasteCells in interface DfcTableModel
Throws:
UnsupportedOperationException
UnsupportedFlavorException
CloneNotSupportedException
IOException


Copyright © 2008 Commonwealth of Australia