CubeTwister 2.0alpha142 2012-02-11

ch.randelshofer.cubetwister.doc
Class NotationMovesTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by ch.randelshofer.cubetwister.doc.NotationMovesTableModel
All Implemented Interfaces:
MutableTableModel, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.swing.table.TableModel

public class NotationMovesTableModel
extends javax.swing.table.AbstractTableModel
implements MutableTableModel, java.beans.PropertyChangeListener

NotationMovesTableModel.

Version:
1.1.2 2010-04-05 Removed dependencies to IBM Unicode normalizer.
1.1.1 2010-02-27 Fixed row change event in method importRowTransferable.
1.1 2009-01-24 Normalize tokens to Unicode NFKC.
1.0 April 15, 2006 Created.
Author:
Werner Randelshofer.
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
NotationMovesTableModel()
          Creates a new instance.
 
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.Class getColumnClass(int column)
           
 int getColumnCount()
           
 java.lang.String getColumnName(int column)
           
 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 getRowCount()
           
 java.lang.Object getValueAt(int row, int column)
           
 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 rowIndex, int columnIndex)
          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 propertyChange(java.beans.PropertyChangeEvent evt)
           
 void removeRow(int row)
          Removes an element from the model.
 void setModel(NotationModel newValue)
           
 void setValueAt(java.lang.Object value, int row, int column)
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
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, removeTableModelListener
 

Constructor Detail

NotationMovesTableModel

public NotationMovesTableModel()
Creates a new instance.

Method Detail

setModel

public void setModel(NotationModel newValue)

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
Specified by:
getValueAt in interface javax.swing.table.TableModel

setValueAt

public void setValueAt(java.lang.Object value,
                       int row,
                       int column)
Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface javax.swing.table.TableModel

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface javax.swing.table.TableModel

getColumnName

public java.lang.String getColumnName(int column)
Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel

getColumnClass

public java.lang.Class getColumnClass(int column)
Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Description copied from interface: MutableTableModel
Returns true if the specified cell may be edited.

Specified by:
isCellEditable in interface MutableTableModel
Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel
Parameters:
rowIndex - index of the row.
columnIndex - index of the column.

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

isRowImportable

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

Specified by:
isRowImportable in interface MutableTableModel
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

removeRow

public void removeRow(int row)
               throws java.lang.IllegalStateException
Description copied from interface: MutableTableModel
Removes an element from the model.

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

isRowRemovable

public boolean isRowRemovable(int row)
Description copied from interface: MutableTableModel
Returns true if the specified row can be removed.

Specified by:
isRowRemovable in interface MutableTableModel
Parameters:
row - index of the element. 0 <= index <= getSize()
See Also:
MutableTableModel.removeRow(int)

isRowAddable

public boolean isRowAddable(int row)
Description copied from interface: MutableTableModel
Returns true if a row can be added.

Specified by:
isRowAddable in interface MutableTableModel
Parameters:
row - index of the element. 0 <= index <= getSize()

getRowActions

public javax.swing.Action[] getRowActions(int[] rows)
Description copied from interface: MutableTableModel
Gets actions for the specified rows.

Specified by:
getRowActions in interface MutableTableModel
Parameters:
rows - The rows.

getCreatableRowTypes

public java.lang.Object[] getCreatableRowTypes(int row)
Description copied from interface: MutableTableModel
Returns the types of elements that can be created at the specified index of the list.

Specified by:
getCreatableRowTypes in interface MutableTableModel
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

public java.lang.Object getCreatableRowType(int row)
Description copied from interface: MutableTableModel
Returns the default type of elements that can be created at the specified index of the list.

Specified by:
getCreatableRowType in interface MutableTableModel
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.

exportRowTransferable

public java.awt.datatransfer.Transferable exportRowTransferable(int[] rows)
Description copied from interface: MutableTableModel
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.

Specified by:
exportRowTransferable in interface MutableTableModel
Parameters:
rows - Row indices.

createRow

public void createRow(int row,
                      java.lang.Object type)
               throws java.lang.IllegalStateException
Description copied from interface: MutableTableModel
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).

Specified by:
createRow in interface MutableTableModel
Parameters:
row - index at which the specified element is to be inserted.
type - element type to be inserted.
Throws:
java.lang.IllegalStateException

importRowTransferable

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

Specified by:
importRowTransferable in interface MutableTableModel
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.