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:
Serializable, Comparable<IDataRow>, IChangeableDataRow, IDataRow
Direct Known Subclasses:
MemDataBook

public class ChangeableDataRow
extends DataRow
implements IChangeableDataRow, 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 Integer DELETING
          Internal state for DELETING.
protected static Integer DETAILS_CHANGED
          Internal state for changed detail rows.
protected static Integer INSERTING
          Internal state for INSERTING.
protected static int INTERNAL_OFFSET
          Internal Offset in the AbstractStorage Array for the Inserting, etc.. states.
protected static Integer UPDATING
          Internal state for UPDATING.
protected static 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, 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()
          Returns the correspondingIDataPage of the IDataRow.
 IDataRow getOriginalRow()
          Returns the original row, before the first change is made.
 int getRowIndex()
          Returns the row index of the IDataRows in the IDataPage.
 Object getUID()
          Returns the internal unique identifier for a IChangeableDataRow, which isInserting().
 boolean isDeleting()
          Returns if this row is deleted.
 boolean isDetailChanged()
          Returns true if under this row in the detail DataBook one or more changed (isInserting/Updating/Deleting() == true) detail rows existing.
 boolean isInserting()
          Returns if this row is new.
 boolean isUpdating()
          Returns if this row is changed.
 boolean isWritableColumnChanged()
          Returns true if one isWritableColumnChanged() column is 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(Object pUID)
          Sets the internal Unique Identifier for the ChangeableDataRow.
protected  void setUpdating()
          It marks this ChangeableDataRow as UPDATING.
protected  void setValueDRInternal(String pColumnName, Object pValue)
          Sets the value of the named column in this IDataRow.
protected  void store()
          It stores the changes in memory as stored.
 String toString()
          
 
Methods inherited from class com.sibvisions.rad.model.mem.DataRow
addControl, cancelEditingControls, compareTo, compareTo, createDataRow, createEmptyRow, equals, equals, eventValuesChanged, getControls, getRowDefinition, getValue, getValue, getValueAsString, getValues, getValuesAsString, hashCode, invokeCancelEditingControls, invokeRepaintListeners, invokeSaveEditingControls, notifyRepaintControls, removeControl, saveEditingControls, setDefaultValues, setValue, setValues
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.rad.model.IDataRow
addControl, compareTo, createDataRow, createEmptyRow, equals, eventValuesChanged, getControls, getRowDefinition, getValue, getValue, getValueAsString, getValues, getValuesAsString, removeControl, 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 Integer INSERTING
Internal state for INSERTING.


UPDATING

protected static final Integer UPDATING
Internal state for UPDATING.


WRITABLE_COLUMN_CHANGED

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


DELETING

protected static final Integer DELETING
Internal state for DELETING.


DETAILS_CHANGED

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

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,
                            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()
Returns the correspondingIDataPage of the IDataRow. That returns != null only if the IDataRow is from a IDataBook

Specified by:
getDataPage in interface IChangeableDataRow
Returns:
the correspondingIDataPage of the IDataRow.

getRowIndex

public int getRowIndex()
Returns the row index of the IDataRows in the IDataPage. That returns != -1 only if the IDataRow is from a IDataPage

Specified by:
getRowIndex in interface IChangeableDataRow
Returns:
the row index of the IDataRows in the IDataPage.

getUID

public Object getUID()
              throws ModelException
Returns the internal unique identifier for a IChangeableDataRow, which isInserting().

Specified by:
getUID in interface IChangeableDataRow
Returns:
the internal unique identifier for a IChangeableDataRow, which isInserting().
Throws:
ModelException - if UID couldn't determined

isInserting

public boolean isInserting()
                    throws ModelException
Returns if this row is new.

Specified by:
isInserting in interface IChangeableDataRow
Returns:
if this row is new.
Throws:
ModelException - if is inserting couldn't determined

isUpdating

public boolean isUpdating()
                   throws ModelException
Returns if this row is changed.

Specified by:
isUpdating in interface IChangeableDataRow
Returns:
if this row is changed.
Throws:
ModelException - if is updating couldn't determined

isDeleting

public boolean isDeleting()
                   throws ModelException
Returns if this row is deleted.

Specified by:
isDeleting in interface IChangeableDataRow
Returns:
if this row is deleted.
Throws:
ModelException - if is deleting couldn't determined

isDetailChanged

public boolean isDetailChanged()
                        throws ModelException
Returns true if under this row in the detail DataBook one or more changed (isInserting/Updating/Deleting() == true) detail rows existing.

Specified by:
isDetailChanged in interface IChangeableDataRow
Returns:
true if under this row in the detail DataBook one or more changed (isInserting/Updating/Deleting() == true) detail rows existing.
Throws:
ModelException - if is detail changed couldn't determined

getOriginalRow

public IDataRow getOriginalRow()
                        throws ModelException
Returns the original row, before the first change is made.

Specified by:
getOriginalRow in interface IChangeableDataRow
Returns:
the original row, before the first change is made.
Throws:
ModelException - if original row couldn't determined

isWritableColumnChanged

public boolean isWritableColumnChanged()
                                throws ModelException
Returns true if one isWritableColumnChanged() column is changed.

Specified by:
isWritableColumnChanged in interface IChangeableDataRow
Returns:
true if one isWritableColumnChanged() column is changed.
Throws:
ModelException - if writable column changed couldn't determined

toString

public String toString()

Overrides:
toString in class DataRow

setValueDRInternal

protected void setValueDRInternal(String pColumnName,
                                  Object pValue)
                           throws ModelException
Sets the value of the named column in this IDataRow.

Overrides:
setValueDRInternal in class DataRow
Parameters:
pColumnName - the column name
pValue - the new value for the column in this IDataRow
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(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.