com.sibvisions.rad.model.mem
Class ChangeableDataRow

java.lang.Object
  extended by com.sibvisions.rad.model.mem.DataRow
      extended by com.sibvisions.rad.model.mem.ChangeableDataRow
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<IDataRow>, IChangeableDataRow, IDataRow
Direct Known Subclasses:
MemDataBook

public class ChangeableDataRow
extends DataRow
implements IChangeableDataRow, java.io.Serializable

An IChangeableDataRow extends the IDataRow with support for the change state of the row, some supporting methods and an unique ID column.

See Also:
IDataRow, IDataPage, IDataBook, Serialized Form

Field Summary
protected static java.lang.Integer DELETING
          Internal state for DELETING.
protected static java.lang.Integer DETAILS_CHANGED
          Internal state for changed detail rows.
protected  IDataPage dpDataPage
          The correspondingIDataPage of the IDataRow in the IDataBook.
protected static java.lang.Integer INSERTING
          Internal state for INSERTING.
protected static int INTERNAL_OFFSET
          Internal Offset in the AbstractStorage Array for the Inserting, etc.. states.
protected  int iRowIndex
          The row index of the IDataRow in the IDataBook.
protected static java.lang.Integer UPDATING
          Internal state for UPDATING.
protected static java.lang.Integer WRITABLE_COLUMN_CHANGED
          Internal state for UPDATING, if minimum one writeable column is involved.
 
Fields inherited from class com.sibvisions.rad.model.mem.DataRow
oaStorage, rdRowDefinition
 
Constructor Summary
protected ChangeableDataRow()
          Internal default constructor for the MemDataBook.
  ChangeableDataRow(IRowDefinition pRowDefinition)
          Constructs a DataRow with a given IRowDefinition.
protected ChangeableDataRow(IRowDefinition pRowDefinition, java.lang.Object[] pData, IDataPage pDataPage, int pRowIndex)
          Constructs a DataRow with a given IRowDefinition and initialize it a copy of the Object[] data.
 
Method Summary
 IDataPage getDataPage()
          Gets the parent IDataPage.
 IDataRow getOriginalDataRow()
          Gets the original IDataRow, before any changes were performed.
 IDataRow getOriginalRow()
          Deprecated. 
 int getRowIndex()
          Gets the row index within the parent IDataPage.
 java.lang.Object getUID()
          Gets the internal unique identifier for this IDataRow.
 boolean isDeleting()
          Gets if this row is currently being deleted, which means that it has been removed/deleted but this action has not yet been finalized.
 boolean isDetailChanged()
          Gets if any associated detail rows have been modified.
 boolean isInserting()
          Gets if this row is currently being inserted, which means that it has been created but has not yet been saved/finalized.
 boolean isUpdating()
          Gets if this row is currently being updated, which means that its values are changed but these changes have not yet been saved/finalized.
 boolean isWritableColumnChanged()
          Gets if there was a writeable column changed.
protected  void restore()
          It clears all changes in the ChangeableDataRow, and use the original values before the changes.
protected  void setDeleting()
          It marks this ChangeableDataRow as DELETING.
protected  void setDetailChanged(boolean bChanged)
          True, If under this row in the detail DataBook one or more changed (isInserting/Updating/Deleting() == true) detail rows existing.
protected  void setInserting()
          It marks this ChangeableDataRow as INSERTING.
protected  void setUID(java.lang.Object pUID)
          Sets the internal Unique Identifier for the ChangeableDataRow.
protected  void setUpdating()
          It marks this ChangeableDataRow as UPDATING.
protected  void setValueIntern(int pColumnIndex, java.lang.Object pValue, ColumnDefinition pColumnDefinition)
          Sets the value of the named column in this IDataRow.
protected  void store()
          It stores the changes in memory as stored.
 java.lang.String toString()
          
 
Methods inherited from class com.sibvisions.rad.model.mem.DataRow
addControl, cancelEditingControls, compareTo, compareTo, createDataRow, createEmptyDataRow, createEmptyRow, equals, equals, eventValuesChanged, eventValuesChanged, getControls, getRowDefinition, getValue, getValue, getValueAsString, getValues, getValuesAsString, hasControls, hashCode, invokeCancelEditingControls, invokeRepaintListeners, invokeSaveEditingControls, notifyRepaintControls, removeControl, saveEditingControls, setDefaultValues, setValue, setValues, setValuesIntern
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.rad.model.IDataRow
addControl, cancelEditingControls, compareTo, createDataRow, createEmptyDataRow, createEmptyRow, equals, eventValuesChanged, eventValuesChanged, getControls, getRowDefinition, getValue, getValue, getValueAsString, getValues, getValuesAsString, notifyRepaintControls, removeControl, saveEditingControls, setValue, setValues
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

INTERNAL_OFFSET

protected static final int INTERNAL_OFFSET
Internal Offset in the AbstractStorage Array for the Inserting, etc.. states.

See Also:
Constant Field Values

INSERTING

protected static final java.lang.Integer INSERTING
Internal state for INSERTING.


UPDATING

protected static final java.lang.Integer UPDATING
Internal state for UPDATING.


WRITABLE_COLUMN_CHANGED

protected static final java.lang.Integer WRITABLE_COLUMN_CHANGED
Internal state for UPDATING, if minimum one writeable column is involved.


DELETING

protected static final java.lang.Integer DELETING
Internal state for DELETING.


DETAILS_CHANGED

protected static final java.lang.Integer DETAILS_CHANGED
Internal state for changed detail rows.


dpDataPage

protected transient IDataPage dpDataPage
The correspondingIDataPage of the IDataRow in the IDataBook.


iRowIndex

protected transient int iRowIndex
The row index of the IDataRow in the IDataBook.

Constructor Detail

ChangeableDataRow

protected ChangeableDataRow()
Internal default constructor for the MemDataBook.


ChangeableDataRow

public ChangeableDataRow(IRowDefinition pRowDefinition)
Constructs a DataRow with a given IRowDefinition.

Parameters:
pRowDefinition - the IRowDefinition

ChangeableDataRow

protected ChangeableDataRow(IRowDefinition pRowDefinition,
                            java.lang.Object[] pData,
                            IDataPage pDataPage,
                            int pRowIndex)
Constructs a DataRow with a given IRowDefinition and initialize it a copy of the Object[] data.

Parameters:
pRowDefinition - the IRowDefinition
pData - the Object[] with data of the DataRow.
pDataPage - the correspondingIDataPage of the IDataRow in the IDataBook
pRowIndex - the row index of the IDataRow in the IDataBook
Method Detail

getDataPage

public IDataPage getDataPage()
Gets the parent IDataPage.

Specified by:
getDataPage in interface IChangeableDataRow
Returns:
the the parent IDataPage, can null if there is no parent IDataPage.

getRowIndex

public int getRowIndex()
Gets the row index within the parent IDataPage.

Specified by:
getRowIndex in interface IChangeableDataRow
Returns:
the row index inside the parent IDataPage, can be -1 if there is no parent IDataPage.

getUID

public java.lang.Object getUID()
                        throws ModelException
Gets the internal unique identifier for this IDataRow.

Specified by:
getUID in interface IChangeableDataRow
Returns:
the internal unique identifier for this IDataRow.
Throws:
ModelException - if the unique identifier could not be determined.

isInserting

public boolean isInserting()
                    throws ModelException
Gets if this row is currently being inserted, which means that it has been created but has not yet been saved/finalized.

Specified by:
isInserting in interface IChangeableDataRow
Returns:
true if this row is currently being inserted.
Throws:
ModelException - if the state could not be determined.

isUpdating

public boolean isUpdating()
                   throws ModelException
Gets if this row is currently being updated, which means that its values are changed but these changes have not yet been saved/finalized.

Specified by:
isUpdating in interface IChangeableDataRow
Returns:
true if this row is currently being changed.
Throws:
ModelException - if the state could not be determined.

isDeleting

public boolean isDeleting()
                   throws ModelException
Gets if this row is currently being deleted, which means that it has been removed/deleted but this action has not yet been finalized.

Specified by:
isDeleting in interface IChangeableDataRow
Returns:
if this row is currently being deleted.
Throws:
ModelException - if the state could not be determined.

isDetailChanged

public boolean isDetailChanged()
                        throws ModelException
Gets if any associated detail rows have been modified. A modified row has either been updated, deleted or was inserted.

Specified by:
isDetailChanged in interface IChangeableDataRow
Returns:
true if any associated detail rows have been modified.
Throws:
ModelException - if the state of the detail rows could not be determined.

getOriginalRow

@Deprecated
public IDataRow getOriginalRow()
                        throws ModelException
Deprecated. 

Gets the original IDataRow, before any changes were performed.

Specified by:
getOriginalRow in interface IChangeableDataRow
Returns:
the original IDataRow, before any changes were performed.
Throws:
ModelException - if the original IDataRow could not be got.

getOriginalDataRow

public IDataRow getOriginalDataRow()
                            throws ModelException
Gets the original IDataRow, before any changes were performed.

Specified by:
getOriginalDataRow in interface IChangeableDataRow
Returns:
the original IDataRow, before any changes were performed.
Throws:
ModelException - if the original IDataRow could not be got.

isWritableColumnChanged

public boolean isWritableColumnChanged()
                                throws ModelException
Gets if there was a writeable column changed. A writeable column is a column which can be written to/saved.

Specified by:
isWritableColumnChanged in interface IChangeableDataRow
Returns:
true if there was a writeable column changed.
Throws:
ModelException - if the state could not be determined.

toString

public java.lang.String toString()

Overrides:
toString in class DataRow

setValueIntern

protected void setValueIntern(int pColumnIndex,
                              java.lang.Object pValue,
                              ColumnDefinition pColumnDefinition)
                       throws ModelException
Sets the value of the named column in this IDataRow.

Overrides:
setValueIntern in class DataRow
Parameters:
pColumnIndex - the column name
pValue - the new value for the column in this IDataRow
pColumnDefinition - the ColumnDefinition
Throws:
ModelException - if the column name is not in this IDataRow or the pValue is not convertible/too large to/for the IDataType of the column

setUID

protected void setUID(java.lang.Object pUID)
Sets the internal Unique Identifier for the ChangeableDataRow.

Parameters:
pUID - the new Unique Identifier

setInserting

protected void setInserting()
It marks this ChangeableDataRow as INSERTING.


setUpdating

protected void setUpdating()
It marks this ChangeableDataRow as UPDATING.


setDeleting

protected void setDeleting()
It marks this ChangeableDataRow as DELETING.


restore

protected void restore()
                throws ModelException
It clears all changes in the ChangeableDataRow, and use the original values before the changes.

Throws:
ModelException - if isUpdate() couldn't correct determined.

store

protected void store()
              throws ModelException
It stores the changes in memory as stored. That means the changes will be made and the change state will be removed.

Throws:
ModelException - that the override methods could throw an exception

setDetailChanged

protected void setDetailChanged(boolean bChanged)
True, If under this row in the detail DataBook one or more changed (isInserting/Updating/Deleting() == true) detail rows existing.

Parameters:
bChanged - true if changed detail rows exists


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.