javax.rad.model
Interface IDataRow

All Superinterfaces:
java.lang.Comparable<IDataRow>
All Known Subinterfaces:
IChangeableDataRow, IDataBook
All Known Implementing Classes:
ChangeableDataRow, DataRow, MemDataBook, RemoteDataBook, StorageDataBook

public interface IDataRow
extends java.lang.Comparable<IDataRow>

An IDataRow is a storage independent representation of one row of data. It contains the column definitions and the values for each column.

See Also:
IRowDefinition, IDataPage, IDataBook

Method Summary
 void addControl(IControl pControl)
          Adds the given IControl to this IDataRow as control.
 void cancelEditingControls()
          Informs all registered controls that they should cancel any pending editing operation and revert to the values in this IDataRow.
 int compareTo(IDataRow pDataRow, SortDefinition pSortDefinition)
          Compares this IDataRow with the given IDataRow, by considering the given SortDefinition and comparing the values of both rows according to the SortDefinition.
 IDataRow createDataRow(java.lang.String[] pColumnNames)
          Creates and returns a new IDataRow which only contains the specified columns and their values.
 IDataRow createEmptyDataRow(java.lang.String[] pColumnNames)
          Creates and returns a new empty IDataRow which only contains the specified columns without any values.
 IDataRow createEmptyRow(java.lang.String[] pColumnNames)
          Deprecated. since 2.5, use createEmptyDataRow(String[]) instead.
 boolean equals(IDataRow pDataRow, java.lang.String[] pColumnNames)
          Compares this IDataRow with the given IDataRow for equality, but only compares the values in the column whose names are given, ignoring all not given columns.
 DataRowHandler eventValuesChanged()
          Gets the DataRowHandler for the values changed event.
 DataRowHandler eventValuesChanged(java.lang.String pColumnName)
          Gets the DataRowHandler for the values changed event for the specified column.
 IControl[] getControls()
          Gets all registered IControls as array.
 IRowDefinition getRowDefinition()
          Gets the IRowDefinition that is used.
 java.lang.Object getValue(int pColumnIndex)
          Returns the value of the column by index.
 java.lang.Object getValue(java.lang.String pColumnName)
          Returns the value of the named column.
 java.lang.String getValueAsString(java.lang.String pColumnName)
          Returns the value of the named column converted to a String.
 java.lang.Object[] getValues(java.lang.String[] pColumnNames)
          Gets the values from all specified columns as an Object array.
 java.lang.String[] getValuesAsString(java.lang.String[] pColumnNames)
          Gets the values from all specified columns and converts them to a String array.
 void notifyRepaintControls()
          Informs all registered controls that there are new values and that they must redraw themselves.
 void removeControl(IControl pControl)
          Removes the given IControl to this IDataRow as control.
 void saveEditingControls()
          Informs all registered controls that they should save their values.
 void setValue(java.lang.String pColumnName, java.lang.Object pValue)
          Sets the value of the named column.
 void setValues(java.lang.String[] pColumnNames, java.lang.Object[] pValues)
          Sets all columns of the given names to the given values.
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

getRowDefinition

IRowDefinition getRowDefinition()
Gets the IRowDefinition that is used.

The IRowDefinition contains all the information about the columns.

Returns:
the IRowDefinition that is used.

getValue

java.lang.Object getValue(int pColumnIndex)
                          throws ModelException
Returns the value of the column by index.

Parameters:
pColumnIndex - the column index.
Returns:
the value of the column.
Throws:
ModelException - if the column index is out of bounds.
See Also:
getValue(String)

getValue

java.lang.Object getValue(java.lang.String pColumnName)
                          throws ModelException
Returns the value of the named column.

Parameters:
pColumnName - the name of the column.
Returns:
the value of the named column.
Throws:
ModelException - if there is no column with the given name.
See Also:
getValue(int)

getValueAsString

java.lang.String getValueAsString(java.lang.String pColumnName)
                                  throws ModelException
Returns the value of the named column converted to a String.

Parameters:
pColumnName - the name of the column.
Returns:
the value of the named column converted to a String.
Throws:
ModelException - if there is no column with the given name.
See Also:
getValue(int), getValue(String), IDataType.convertToString(Object)

setValue

void setValue(java.lang.String pColumnName,
              java.lang.Object pValue)
              throws ModelException
Sets the value of the named column.

After the value has changed the value changed event and value changed (by name) event are invoked and fired. Afterwards all registered IControls are notified of the change by invoking IControl.notifyRepaint().

Parameters:
pColumnName - the column name.
pValue - the new value for the named column.
Throws:
ModelException - if there is no column with the given name or the given value can not be converted to the IDataType of the column.
See Also:
eventValuesChanged(), eventValuesChanged(String), IDataType.convertToTypeClass(Object)

getValues

java.lang.Object[] getValues(java.lang.String[] pColumnNames)
                             throws ModelException
Gets the values from all specified columns as an Object array.

Note that the returned Object array does not represent an internal state of the IDataRow. Modifying the array does not change the IDataRow.

Parameters:
pColumnNames - the names of the columns from which to get the values. Can be null for all columns (which is equal to IRowDefinition.getColumnNames().
Returns:
the values from all specified columns as an Object array.
Throws:
ModelException - if there is no column with one of the specified names.
See Also:
getValue(int), getValue(String)

getValuesAsString

java.lang.String[] getValuesAsString(java.lang.String[] pColumnNames)
                                     throws ModelException
Gets the values from all specified columns and converts them to a String array.

Note that the returned String array does not represent an internal state of the IDataRow. Modifying the array does not change the IDataRow.

Parameters:
pColumnNames - the names of the columns from which to get the values. Can be null for all columns.
Returns:
the values from all specified columns as a String array.
Throws:
ModelException - if there is no column with one of the specified names.
See Also:
getValueAsString(String), getValues(String[]), IDataType.convertToString(Object)

setValues

void setValues(java.lang.String[] pColumnNames,
               java.lang.Object[] pValues)
               throws ModelException
Sets all columns of the given names to the given values.

The String array which represents the column names is directly mapped to the Object array which holds the values. So they must be equal in length.

After the value has changed the value changed event and value changed (by name) event are invoked and fired. Afterwards all registered IControls are notified of the change by invoking IControl.notifyRepaint().

Parameters:
pColumnNames - a String array of the column names. Can be null for all columns (which is equal to IRowDefinition.getColumnNames().
pValues - a Object array of values to set in the corresponding columns.
Throws:
ModelException - if there is no column with one of the specified names or if any of the values could not be converted to the IDataType of the column.
See Also:
eventValuesChanged(), eventValuesChanged(String), setValue(String, Object), IDataType.convertToTypeClass(Object)

compareTo

int compareTo(IDataRow pDataRow,
              SortDefinition pSortDefinition)
Compares this IDataRow with the given IDataRow, by considering the given SortDefinition and comparing the values of both rows according to the SortDefinition.

It reacts for the most part like a "normal" compareTo would, except that it takes SortDefinition.isAscending() into consideration, and if it is false the result will be negated.

Parameters:
pDataRow - the @link DataRow} to compare with.
pSortDefinition - the SortDefinition to us for the comparison.
Returns:
a negative integer, zero, or a positive integer as this IDataRow is less than, equal to, or greater than the specified IDataRow.

equals

boolean equals(IDataRow pDataRow,
               java.lang.String[] pColumnNames)
Compares this IDataRow with the given IDataRow for equality, but only compares the values in the column whose names are given, ignoring all not given columns.

Parameters:
pDataRow - the IDataRow to compare with this IDataRow
pColumnNames - a String array of the names of the columns to compare.
Returns:
true if they are found equal.

createDataRow

IDataRow createDataRow(java.lang.String[] pColumnNames)
                       throws ModelException
Creates and returns a new IDataRow which only contains the specified columns and their values.

Parameters:
pColumnNames - a String array of column names. Can be null for all columns (which is equal to IRowDefinition.getColumnNames().
Returns:
a new IDataRow which only contains the specified columns and their values.
Throws:
ModelException - if new IDataRow could not be constructed.

createEmptyRow

@Deprecated
IDataRow createEmptyRow(java.lang.String[] pColumnNames)
                        throws ModelException
Deprecated. since 2.5, use createEmptyDataRow(String[]) instead.

Creates and returns a new empty IDataRow which only contains the specified columns without any values.

Parameters:
pColumnNames - a String array of column names. Can be null for all columns (which is equal to IRowDefinition.getColumnNames().
Returns:
a new empty IDataRow which only contains the specified columns without any values.
Throws:
ModelException - if new IDataRow could not be constructed.

createEmptyDataRow

IDataRow createEmptyDataRow(java.lang.String[] pColumnNames)
                            throws ModelException
Creates and returns a new empty IDataRow which only contains the specified columns without any values.

Parameters:
pColumnNames - a String array of column names. Can be null for all columns (which is equal to IRowDefinition.getColumnNames().
Returns:
a new empty IDataRow which only contains the specified columns without any values.
Throws:
ModelException - if new IDataRow could not be constructed.

addControl

void addControl(IControl pControl)
Adds the given IControl to this IDataRow as control.

The registered IControl will be notified of changes in this IDataRow.

Parameters:
pControl - the IControl to add.
See Also:
removeControl(IControl), getControls()

removeControl

void removeControl(IControl pControl)
Removes the given IControl to this IDataRow as control.

Parameters:
pControl - the IControl to remove.
See Also:
addControl(IControl), getControls()

getControls

IControl[] getControls()
Gets all registered IControls as array.

Returns:
all registered IControls as array.

eventValuesChanged

DataRowHandler eventValuesChanged()
Gets the DataRowHandler for the values changed event.

The values changed event is fired every time a value changes in this IDataRow.

Returns:
the DataRowHandler for the values changed event.
See Also:
eventValuesChanged(String), setValue(String, Object), setValues(String[], Object[])

eventValuesChanged

DataRowHandler eventValuesChanged(java.lang.String pColumnName)
Gets the DataRowHandler for the values changed event for the specified column.

The values changed event is fired every time a value changes in this IDataRow.

Parameters:
pColumnName - the name of the column.
Returns:
the DataRowHandler for the values changed event for the specified column.
See Also:
eventValuesChanged(), setValue(String, Object), setValues(String[], Object[])

notifyRepaintControls

void notifyRepaintControls()
Informs all registered controls that there are new values and that they must redraw themselves. For this purpose the IControl.notifyRepaint() method is invoked on all registered IControls.

See Also:
IControl.notifyRepaint()

saveEditingControls

void saveEditingControls()
                         throws ModelException
Informs all registered controls that they should save their values. For this purpose the IControl.saveEditing() method is invoked on all registered IControls.

Throws:
ModelException - if saving of any of the registered IControls fails.
See Also:
IControl.notifyRepaint()

cancelEditingControls

void cancelEditingControls()
Informs all registered controls that they should cancel any pending editing operation and revert to the values in this IDataRow. For this purpose the IControl.cancelEditing() method is invoked on all registered IControls.



Copyright © 2009 SIB Visions GmbH. All Rights Reserved.