CubeTwister 2.0alpha142 2012-02-11

ch.randelshofer.gui.table
Interface MutableTableModel

All Superinterfaces:
javax.swing.table.TableModel
All Known Implementing Classes:
CubeColorsTableModel, CubePartsTableModel, CubeStickersTableModel, DefaultMutableTableModel, NotationMacrosTableModel, NotationMovesTableModel, ScriptMacrosTableModel, TreeNodeTableModel

public interface MutableTableModel
extends javax.swing.table.TableModel

Specifies the requirements for a mutable table model.

The mutable table model adds the following operations to the javax.swing.table.TableModel interface:

Version:
3.0 2004-05-16 Revised.
2.3 2002-11-26 Interface streamlined. Support for Transferables added.
2.2 2001-08-28 Method for retrieving actions for rows added.
2.1 2001-07-27 Methods for duplication of rows added.
2.0 2001-07-18
Author:
Werner Randelshofer

Method Summary
 void createRow(int row, java.lang.Object type)
          Creates the specified element type at the specified position in this list Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
 java.awt.datatransfer.Transferable exportRowTransferable(int[] rows)
          Creates a Transferable to use as the source for a data transfer of the specified elements.
 java.lang.Object getCreatableRowType(int row)
          Returns the default type of elements that can be created at the specified index of the list.
 java.lang.Object[] getCreatableRowTypes(int row)
          Returns the types of elements that can be created at the specified index of the list.
 javax.swing.Action[] getRowActions(int[] rows)
          Gets actions for the specified rows.
 int importRowTransferable(java.awt.datatransfer.Transferable t, int action, int row, boolean asChild)
          Causes a transfer to the model from a clipboard or a DND drop operation.
 boolean isCellEditable(int row, int column)
          Returns true if the specified cell may be edited.
 boolean isRowAddable(int row)
          Returns true if a row can be added.
 boolean isRowImportable(java.awt.datatransfer.DataFlavor[] transferFlavors, int action, int row, boolean asChild)
          Indicates whether the model would accept an import of the given set of data flavors prior to actually attempting to import it.
 boolean isRowRemovable(int row)
          Returns true if the specified row can be removed.
 void removeRow(int row)
          Removes an element from the model.
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getColumnClass, getColumnCount, getColumnName, getRowCount, getValueAt, removeTableModelListener, setValueAt
 

Method Detail

getCreatableRowTypes

java.lang.Object[] getCreatableRowTypes(int row)
Returns the types of elements that can be created at the specified index of the list.

Parameters:
row - The insertion point. 0 <= index <= getRowCount()
Returns:
an array of Object's that specify element types that can be inserted at the insertion point. Returns an empty array if no elements can be inserted here. Never returns null. This array must include the type returned by operation getCreatableType.

getCreatableRowType

java.lang.Object getCreatableRowType(int row)
Returns the default type of elements that can be created at the specified index of the list.

Parameters:
row - The insertion point. 0 <= index <= getRowCount()
Returns:
an Object that specifies the default element type that can be inserted at the insertion point. Returns null if no elements can be inserted here. The value must be one of the types returned by operation getCreatableTypes.

createRow

void createRow(int row,
               java.lang.Object type)
               throws java.lang.IllegalStateException
Creates the specified element type at the specified position in this list Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

Parameters:
row - index at which the specified element is to be inserted.
type - element type to be inserted.
Throws:
java.lang.IllegalArgumentException - if the type is not contained in the array returned by getInsertableTypes(int).
java.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index > size()).
java.lang.IllegalStateException

isRowAddable

boolean isRowAddable(int row)
Returns true if a row can be added.

Parameters:
row - index of the element. 0 <= index <= getSize()

isRowRemovable

boolean isRowRemovable(int row)
Returns true if the specified row can be removed.

Parameters:
row - index of the element. 0 <= index <= getSize()
See Also:
removeRow(int)

removeRow

void removeRow(int row)
               throws java.lang.IllegalStateException
Removes an element from the model.

Parameters:
row - index of the element. 0 <= index <= getSize()
Throws:
java.lang.IllegalStateException - if the element may not be removed.
See Also:
isRowRemovable(int)

isCellEditable

boolean isCellEditable(int row,
                       int column)
Returns true if the specified cell may be edited.

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Parameters:
row - index of the row.
column - index of the column.

getRowActions

javax.swing.Action[] getRowActions(int[] rows)
Gets actions for the specified rows.

Parameters:
rows - The rows.

exportRowTransferable

java.awt.datatransfer.Transferable exportRowTransferable(int[] rows)
Creates a Transferable to use as the source for a data transfer of the specified elements. Returns the representation of the rows to be transferred, or null if transfer is not possible.

Parameters:
rows - Row indices.

isRowImportable

boolean isRowImportable(java.awt.datatransfer.DataFlavor[] transferFlavors,
                        int action,
                        int row,
                        boolean asChild)
Indicates whether the model would accept an import of the given set of data flavors prior to actually attempting to import it.

Parameters:
transferFlavors - the data formats available
action - The action DnDConstants.ACTION_COPY, .ACTION_MOVE or .ACTION_LINK.
row - The insertion point. 0 <= row <= getRowCount()
asChild - Indicates that the item is to be imported as a child of the list item rather than as an individual element / of the list.
Returns:
true if the data can be imported.
See Also:
DnDConstants

importRowTransferable

int importRowTransferable(java.awt.datatransfer.Transferable t,
                          int action,
                          int row,
                          boolean asChild)
                          throws java.awt.datatransfer.UnsupportedFlavorException,
                                 java.io.IOException
Causes a transfer to the model from a clipboard or a DND drop operation.

Parameters:
t - The transfer data.
action - The action DnDConstants.ACTION_COPY, .ACTION_MOVE or .ACTION_LINK.
row - The insertion point. 0 <= row <= getRowCount()
asChild - Indicates that the item is to be imported as a child of the list item rather than as an individual element of the list.
Returns:
The number of imported elements.
Throws:
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOException

(c) Werner Randelshofer.
All rights reserved.