org.zaval.data.event
Class MatrixEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--org.zaval.util.event.EvObject
              |
              +--org.zaval.data.event.MatrixEvent
All Implemented Interfaces:
java.io.Serializable

public class MatrixEvent
extends EvObject

This class describes event that is performed by MatrixModel interface implementation. Using the event class the matrix model implementation notifies listeners about the data changes.

See Also:
Serialized Form

Field Summary
static int CELL_MODIFIED
          The matrix cell modified event type.
static int MATRIX_RESIZED
          The matrix dimension modified event type.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
MatrixEvent(java.lang.Object target, int prevRows, int prevCols)
          Constructs a new matrix event class with the given source, previous number of rows and columns.
MatrixEvent(java.lang.Object target, int row, int col, java.lang.Object prevValue)
          Constructs a new matrix event class with the given source, row, column and previous value.
 
Method Summary
protected  boolean checkID(int id)
          The method returns true if the specified id is valid for the event, otherwise returns false.
 java.awt.Point getModifiedCell()
          Returns the row and column of the modified cell.
 java.awt.Dimension getPrevSize()
          Returns the previous dimension of the matrix model.
 java.lang.Object getPrevValue()
          Returns the previous value of the modified cell.
 
Methods inherited from class org.zaval.util.event.EvObject
getID
 
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
 

Field Detail

CELL_MODIFIED

public static final int CELL_MODIFIED
The matrix cell modified event type.

MATRIX_RESIZED

public static final int MATRIX_RESIZED
The matrix dimension modified event type.
Constructor Detail

MatrixEvent

public MatrixEvent(java.lang.Object target,
                   int prevRows,
                   int prevCols)
Constructs a new matrix event class with the given source, previous number of rows and columns. The contructor sets event id to MATRIX_RESIZED value. The type of event (created by the contructor) is used to notify that the matrix number of columns or number of rows has been changed.
Parameters:
target - the source of the event.
prevRows - the previous number of rows.
prevCols - the previous number of columns.

MatrixEvent

public MatrixEvent(java.lang.Object target,
                   int row,
                   int col,
                   java.lang.Object prevValue)
Constructs a new matrix event class with the given source, row, column and previous value. The contructor sets event id to CELL_MODIFIED value. The type of event (created by the contructor) is used to notify that the value of the matrix cell has been changed.
Parameters:
target - the source of the event.
row - the row of the modified cell.
col - the column of the modified cell.
prevValue - the previous value of the modified cell.
Method Detail

getPrevSize

public java.awt.Dimension getPrevSize()
Returns the previous dimension of the matrix model. Use the method if the event id is MATRIX_RESIZED. The returned value is presented with java.awt.Dimension class where width field correspond to previous number of rows and height field correspond to previous number of columns.
Returns:
a previous dimension of the matrix model.

getModifiedCell

public java.awt.Point getModifiedCell()
Returns the row and column of the modified cell. Use the method if the event id is CELL_MODIFIED. The returned value is presented with java.awt.Point class where x field correspond to the row and y field correspond to the column.
Returns:
a row and column of the modified cell.

getPrevValue

public java.lang.Object getPrevValue()
Returns the previous value of the modified cell. Use the method if the event id is CELL_MODIFIED.
Returns:
a previous value of the modified cell.

checkID

protected boolean checkID(int id)
Description copied from class: EvObject
The method returns true if the specified id is valid for the event, otherwise returns false. The method is called with the event constructor to test if the event id is valid and if the event is not valid the IllegalArgumentException will be thrown.
Overrides:
checkID in class EvObject
Following copied from class: org.zaval.util.event.EvObject
Parameters:
id - the specified id.


Copyright © Zaval Creative Engineering Group, 2000-2005.
http://www.zaval.org