JIDE 3.5.15

com.jidesoft.grid
Class UndoableTableModelEvent

java.lang.Object
  extended by java.util.EventObject
      extended by javax.swing.event.TableModelEvent
          extended by com.jidesoft.grid.UndoableTableModelEvent
All Implemented Interfaces:
Serializable, UndoableEdit

public class UndoableTableModelEvent
extends TableModelEvent
implements UndoableEdit

A special TableModelEvent that contains the information of UndoableEdit.

Since:
3.3.4
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.event.TableModelEvent
ALL_COLUMNS, column, DELETE, firstRow, HEADER_ROW, INSERT, lastRow, type, UPDATE
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
UndoableTableModelEvent(TableModel source)
          The constructor.
UndoableTableModelEvent(TableModel source, int row)
          The constructor.
UndoableTableModelEvent(TableModel source, int firstRow, int lastRow)
          The constructor.
UndoableTableModelEvent(TableModel source, int firstRow, int lastRow, int column)
          The constructor.
UndoableTableModelEvent(TableModel source, int firstRow, int lastRow, int column, int type)
          The constructor.
 
Method Summary
 void addEdit(int rowIndex, int columnIndex, Object oldCellData, Object newCellData)
          Adds a new cell edit into the UndoableEdit.
 void addEdit(int rowIndex, Vector<Object> oldRowData, Vector<Object> newRowData)
          Adds a new row edit into the UndoableEdit.
 boolean addEdit(UndoableEdit anEdit)
           
 boolean canRedo()
           
 boolean canUndo()
           
 void die()
           
static void fireTableModelEvent(AbstractTableModel tableModel, TableModelEvent e)
          Helper method to fire an UndoableTableModelEvent.
 com.jidesoft.grid.UndoableTableModelEvent.TableModelEdit[] getEdits()
          Gets all the TableModelEdit instance in array.
 String getPresentationName()
           
 String getRedoPresentationName()
           
 String getUndoPresentationName()
           
 boolean isSignificant()
           
 boolean isUndoRedo()
          Gets the flag indicating if this event is triggered by an undo/redo activity or not.
 void redo()
           
 boolean replaceEdit(UndoableEdit anEdit)
           
 void setColumn(int column)
          Sets the column of this event.
 void setFirstRow(int firstRow)
          Sets the first row of this event.
 void setLastRow(int lastRow)
          Sets the last row of this event.
 void setType(int type)
          Sets the event type of this event.
 void setUndoRedo(boolean undoRedo)
          Sets the flag indicating if this event is triggered by an undo/redo activity or not.
 void undo()
           
 
Methods inherited from class javax.swing.event.TableModelEvent
getColumn, getFirstRow, getLastRow, getType
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UndoableTableModelEvent

public UndoableTableModelEvent(TableModel source)
The constructor.

Parameters:
source - the table model

UndoableTableModelEvent

public UndoableTableModelEvent(TableModel source,
                               int row)
The constructor.

Parameters:
source - the table model
row - the row index

UndoableTableModelEvent

public UndoableTableModelEvent(TableModel source,
                               int firstRow,
                               int lastRow)
The constructor.

Parameters:
source - the table model
firstRow - the first row index
lastRow - the last row index

UndoableTableModelEvent

public UndoableTableModelEvent(TableModel source,
                               int firstRow,
                               int lastRow,
                               int column)
The constructor.

Parameters:
source - the table model
firstRow - the first row index
lastRow - the last row index
column - the column index

UndoableTableModelEvent

public UndoableTableModelEvent(TableModel source,
                               int firstRow,
                               int lastRow,
                               int column,
                               int type)
The constructor.

Parameters:
source - the table model
firstRow - the first row index
lastRow - the last row index
column - the column index
type - the event type
Method Detail

addEdit

public void addEdit(int rowIndex,
                    Vector<Object> oldRowData,
                    Vector<Object> newRowData)
Adds a new row edit into the UndoableEdit.

Parameters:
rowIndex - the row index
oldRowData - the old row data. null when it's an insertion activity.
newRowData - the new row data. null when it's a deletion activity.

addEdit

public void addEdit(int rowIndex,
                    int columnIndex,
                    Object oldCellData,
                    Object newCellData)
Adds a new cell edit into the UndoableEdit.

Parameters:
rowIndex - the row index
columnIndex - the column index
oldCellData - the old cell data
newCellData - the new cell data

die

public void die()
Specified by:
die in interface UndoableEdit

undo

public void undo()
          throws CannotUndoException
Specified by:
undo in interface UndoableEdit
Throws:
CannotUndoException

canUndo

public boolean canUndo()
Specified by:
canUndo in interface UndoableEdit

redo

public void redo()
          throws CannotRedoException
Specified by:
redo in interface UndoableEdit
Throws:
CannotRedoException

canRedo

public boolean canRedo()
Specified by:
canRedo in interface UndoableEdit

addEdit

public boolean addEdit(UndoableEdit anEdit)
Specified by:
addEdit in interface UndoableEdit

replaceEdit

public boolean replaceEdit(UndoableEdit anEdit)
Specified by:
replaceEdit in interface UndoableEdit

isSignificant

public boolean isSignificant()
Specified by:
isSignificant in interface UndoableEdit

getPresentationName

public String getPresentationName()
Specified by:
getPresentationName in interface UndoableEdit

getUndoPresentationName

public String getUndoPresentationName()
Specified by:
getUndoPresentationName in interface UndoableEdit

getRedoPresentationName

public String getRedoPresentationName()
Specified by:
getRedoPresentationName in interface UndoableEdit

setUndoRedo

public void setUndoRedo(boolean undoRedo)
Sets the flag indicating if this event is triggered by an undo/redo activity or not.

Parameters:
undoRedo - the flag

isUndoRedo

public boolean isUndoRedo()
Gets the flag indicating if this event is triggered by an undo/redo activity or not.

Returns:
true if this event is triggered by an undo/redo activity. Otherwise false.

getEdits

public com.jidesoft.grid.UndoableTableModelEvent.TableModelEdit[] getEdits()
Gets all the TableModelEdit instance in array.

Returns:
the TableModelEdit array. An empty array if no edit is found inside this event.

setType

public void setType(int type)
Sets the event type of this event.

Parameters:
type - tye type.

setFirstRow

public void setFirstRow(int firstRow)
Sets the first row of this event.

Parameters:
firstRow - the first row

setLastRow

public void setLastRow(int lastRow)
Sets the last row of this event.

Parameters:
lastRow - the last row

setColumn

public void setColumn(int column)
Sets the column of this event.

Parameters:
column - the column

fireTableModelEvent

public static void fireTableModelEvent(AbstractTableModel tableModel,
                                       TableModelEvent e)
Helper method to fire an UndoableTableModelEvent.

Parameters:
tableModel - the table model
e - the event to fire

JIDE 3.5.15