org.eclipse.datatools.sqltools.data.internal.core.editor
Class AbstractRowData

java.lang.Object
  extended by org.eclipse.datatools.sqltools.data.internal.core.editor.AbstractRowData
All Implemented Interfaces:
IRowData
Direct Known Subclasses:
RowDataImpl

public abstract class AbstractRowData
extends java.lang.Object
implements IRowData

This abstract implementation of IRowData keeps track of the old and new (unsaved) values for each row, And also handle the life cycle of the row (ORIGINAL, INSERTED, UPDATED, DELETED). Extendors should implement a save() method to commit the changes to the database.

Author:
groux

Field Summary
static int STATE_DELETED
           
static int STATE_INSERTED
           
static int STATE_ORIGINAL
           
static int STATE_UPDATED
           
 
Constructor Summary
AbstractRowData(int state, java.lang.Object[] data)
           
 
Method Summary
 int getState()
           
 java.lang.Object getValue(int col)
           
 void resetToOriginal()
          When the modifications have been saved to the database, this method is called on rows of type STATE_UPDATED or STATE_INSERTED to reflect the state of the databse.
 void revertToOriginal()
           
 void setState(int state)
           
 void updateValue(int col, java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.datatools.sqltools.data.internal.core.editor.IRowData
getTable
 

Field Detail

STATE_ORIGINAL

public static final int STATE_ORIGINAL
See Also:
Constant Field Values

STATE_UPDATED

public static final int STATE_UPDATED
See Also:
Constant Field Values

STATE_DELETED

public static final int STATE_DELETED
See Also:
Constant Field Values

STATE_INSERTED

public static final int STATE_INSERTED
See Also:
Constant Field Values
Constructor Detail

AbstractRowData

public AbstractRowData(int state,
                       java.lang.Object[] data)
Method Detail

getState

public int getState()

setState

public void setState(int state)

resetToOriginal

public void resetToOriginal()
When the modifications have been saved to the database, this method is called on rows of type STATE_UPDATED or STATE_INSERTED to reflect the state of the databse.


revertToOriginal

public void revertToOriginal()

getValue

public java.lang.Object getValue(int col)
Specified by:
getValue in interface IRowData

updateValue

public void updateValue(int col,
                        java.lang.Object value)
Specified by:
updateValue in interface IRowData