|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sibvisions.rad.model.mem.DataRow
public class DataRow
An DataRow
is a list of table column's.
The DataRow
is also a storage independent row.
Example:
// construct a RowDefinition
RowDefinition rdRowDefinition = new RowDefinition();
// construct some ColumnDefinitions
ColumnDefinition cdId = new ColumnDefinition("id");
ColumnDefinition cdName = new ColumnDefinition("name");
rdRowDefinition.addColumnDefinition(cdId);
rdRowDefinition.addColumnDefinition(cdName);
// construct DataRow
DataRow drDataRow = new DataRow(rdRowDefinition);
drDataRow.setValue("id", new BigDecimal(1));
drDataRow.setValue("name", "The name");
IDataRow
,
RowDefinition
,
RemoteDataBook
,
MemDataPage
,
Serialized FormField Summary | |
---|---|
protected java.lang.Object[] |
oaStorage
The storage for this DataRow . |
protected IRowDefinition |
rdRowDefinition
The RowDefinition of this DataRow . |
Constructor Summary | |
---|---|
|
DataRow()
Constructs a DataRow without a new instance of IRowDefinition . |
|
DataRow(IRowDefinition pRowDefinition)
Constructs a DataRow with a given IRowDefinition . |
protected |
DataRow(IRowDefinition pRowDefinition,
java.lang.Object[] pData)
Constructs a DataRow with a given IRowDefinition
and initialize it a copy of the Object[] data. |
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)
|
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. |
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. |
boolean |
equals(java.lang.Object pObject)
|
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 IControl s 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. |
protected boolean |
hasControls()
Gets whether at least one control was added to this row. |
int |
hashCode()
|
protected void |
invokeCancelEditingControls()
It invokes for each IComponent the cancelEditing() method. |
protected void |
invokeRepaintListeners()
It invokes for each IComponent the notifyRepaint() method. |
protected void |
invokeSaveEditingControls()
It invokes for each IComponent the saveEditing() method. |
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 |
setDefaultValues()
Sets the Default Values from the RowDefinition to the DataRow. |
void |
setValue(java.lang.String pColumnName,
java.lang.Object pValue)
Sets the value of the named column. |
protected void |
setValueIntern(int pColumnIndex,
java.lang.Object pValue,
ColumnDefinition pColumnDefinition)
Sets the value of the named column in this IDataRow . |
void |
setValues(java.lang.String[] pColumnNames,
java.lang.Object[] pValues)
Sets all columns of the given names to the given values. |
protected void |
setValuesIntern(java.lang.String[] pColumnNames,
java.lang.Object[] pValues)
It sets the values without throwing an event. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected IRowDefinition rdRowDefinition
RowDefinition
of this DataRow
.
protected java.lang.Object[] oaStorage
DataRow
.
Constructor Detail |
---|
public DataRow()
DataRow
without a new instance of IRowDefinition
.
public DataRow(IRowDefinition pRowDefinition)
DataRow
with a given IRowDefinition
.
pRowDefinition
- the IRowDefinition
protected DataRow(IRowDefinition pRowDefinition, java.lang.Object[] pData)
DataRow
with a given IRowDefinition
and initialize it a copy of the Object[]
data.
pRowDefinition
- the IRowDefinition
pData
- the Object[]
with data of the DataRow
.Method Detail |
---|
public IRowDefinition getRowDefinition()
IRowDefinition
that is used.
The IRowDefinition
contains all the information about the
columns.
getRowDefinition
in interface IDataRow
IRowDefinition
that is used.public java.lang.Object getValue(int pColumnIndex) throws ModelException
getValue
in interface IDataRow
pColumnIndex
- the column index.
ModelException
- if the column index is out of bounds.IDataRow.getValue(String)
public java.lang.Object getValue(java.lang.String pColumnName) throws ModelException
getValue
in interface IDataRow
pColumnName
- the name of the column.
ModelException
- if there is no column with the given name.IDataRow.getValue(int)
public java.lang.String getValueAsString(java.lang.String pColumnName) throws ModelException
String
.
getValueAsString
in interface IDataRow
pColumnName
- the name of the column.
String
.
ModelException
- if there is no column with the given name.IDataRow.getValue(int)
,
IDataRow.getValue(String)
,
IDataType.convertToString(Object)
public void setValue(java.lang.String pColumnName, java.lang.Object pValue) throws ModelException
After the value has changed the value
changed event
and value changed (by
name) event
are invoked and fired. Afterwards all registered
IControl
s are notified of the change by invoking
IControl.notifyRepaint()
.
setValue
in interface IDataRow
pColumnName
- the column name.pValue
- the new value for the named column.
ModelException
- if there is no column with the given name or the
given value can not be converted to the IDataType
of
the column.IDataRow.eventValuesChanged()
,
IDataRow.eventValuesChanged(String)
,
IDataType.convertToTypeClass(Object)
public java.lang.Object[] getValues(java.lang.String[] pColumnNames) throws ModelException
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
.
getValues
in interface IDataRow
pColumnNames
- the names of the columns from which to get the
values. Can be null
for all columns (which is equal to
IRowDefinition.getColumnNames()
.
Object
array.
ModelException
- if there is no column with one of the specified
names.IDataRow.getValue(int)
,
IDataRow.getValue(String)
public java.lang.String[] getValuesAsString(java.lang.String[] pColumnNames) throws ModelException
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
.
getValuesAsString
in interface IDataRow
pColumnNames
- the names of the columns from which to get the
values. Can be null
for all columns.
String
array.
ModelException
- if there is no column with one of the specified
names.IDataRow.getValueAsString(String)
,
IDataRow.getValues(String[])
,
IDataType.convertToString(Object)
public void setValues(java.lang.String[] pColumnNames, java.lang.Object[] pValues) throws ModelException
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
IControl
s are notified of the change by invoking
IControl.notifyRepaint()
.
setValues
in interface IDataRow
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.
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.IDataRow.eventValuesChanged()
,
IDataRow.eventValuesChanged(String)
,
IDataRow.setValue(String, Object)
,
IDataType.convertToTypeClass(Object)
public IDataRow createDataRow(java.lang.String[] pColumnNames) throws ModelException
IDataRow
which only contains the
specified columns and their values.
createDataRow
in interface IDataRow
pColumnNames
- a String
array of column names. Can be
null
for all columns (which is equal to
IRowDefinition.getColumnNames()
.
IDataRow
which only contains the specified columns
and their values.
ModelException
- if new IDataRow
could not be constructed.@Deprecated public IDataRow createEmptyRow(java.lang.String[] pColumnNames) throws ModelException
IDataRow
which only contains the
specified columns without any values.
createEmptyRow
in interface IDataRow
pColumnNames
- a String
array of column names. Can be
null
for all columns (which is equal to
IRowDefinition.getColumnNames()
.
IDataRow
which only contains the specified
columns without any values.
ModelException
- if new IDataRow
could not be constructed.public IDataRow createEmptyDataRow(java.lang.String[] pColumnNames) throws ModelException
IDataRow
which only contains the
specified columns without any values.
createEmptyDataRow
in interface IDataRow
pColumnNames
- a String
array of column names. Can be
null
for all columns (which is equal to
IRowDefinition.getColumnNames()
.
IDataRow
which only contains the specified
columns without any values.
ModelException
- if new IDataRow
could not be constructed.public boolean equals(java.lang.Object pObject)
equals
in class java.lang.Object
public int compareTo(IDataRow pDataRow)
compareTo
in interface java.lang.Comparable<IDataRow>
public int compareTo(IDataRow pDataRow, SortDefinition pSortDefinition)
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.
compareTo
in interface IDataRow
pDataRow
- the @link DataRow} to compare with.pSortDefinition
- the SortDefinition
to us for the
comparison.
IDataRow
is less than, equal to, or greater than the
specified IDataRow
.public boolean equals(IDataRow pDataRow, java.lang.String[] pColumnNames)
IDataRow
with the given IDataRow
for
equality, but only compares the values in the column whose names are
given, ignoring all not given columns.
equals
in interface IDataRow
pDataRow
- the IDataRow
to compare with this IDataRow
pColumnNames
- a String
array of the names of the columns to
compare.
true
if they are found equal.public void addControl(IControl pControl)
IControl
to this IDataRow
as control.
The registered IControl
will be notified of changes in this
IDataRow
.
addControl
in interface IDataRow
pControl
- the IControl
to add.IDataRow.removeControl(IControl)
,
IDataRow.getControls()
public void removeControl(IControl pControl)
IControl
to this IDataRow
as control.
removeControl
in interface IDataRow
pControl
- the IControl
to remove.IDataRow.addControl(IControl)
,
IDataRow.getControls()
public IControl[] getControls()
IControl
s as array.
getControls
in interface IDataRow
IControl
s as array.public DataRowHandler eventValuesChanged()
DataRowHandler
for the values changed event.
The values changed event is fired every time a value changes in this
IDataRow
.
eventValuesChanged
in interface IDataRow
DataRowHandler
for the values changed event.IDataRow.eventValuesChanged(String)
,
IDataRow.setValue(String, Object)
,
IDataRow.setValues(String[], Object[])
public DataRowHandler eventValuesChanged(java.lang.String pColumnName)
DataRowHandler
for the values changed event for the
specified column.
The values changed event is fired every time a value changes in this
IDataRow
.
eventValuesChanged
in interface IDataRow
pColumnName
- the name of the column.
DataRowHandler
for the values changed event for
the specified column.IDataRow.eventValuesChanged()
,
IDataRow.setValue(String, Object)
,
IDataRow.setValues(String[], Object[])
public void notifyRepaintControls()
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
IControl
s.
notifyRepaintControls
in interface IDataRow
IControl.notifyRepaint()
public void saveEditingControls() throws ModelException
registered controls
that they should
save their values. For this purpose the IControl.saveEditing()
method is invoked on all registered IControl
s.
saveEditingControls
in interface IDataRow
ModelException
- if saving of any of the registered
IControl
s fails.IControl.notifyRepaint()
public void cancelEditingControls()
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 IControl
s.
cancelEditingControls
in interface IDataRow
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
protected void setValueIntern(int pColumnIndex, java.lang.Object pValue, ColumnDefinition pColumnDefinition) throws ModelException
IDataRow
.
pColumnIndex
- the column namepValue
- the new value for the column in this IDataRow
pColumnDefinition
- the ColumnDefinition
ModelException
- if the column name is not in this IDataRow
or the pValue is not convertible/too large to/for the IDataType
of the columnprotected void setValuesIntern(java.lang.String[] pColumnNames, java.lang.Object[] pValues) throws ModelException
pColumnNames
- the column names to use.pValues
- the values to use
ModelException
- if the value couldn't set into the memory.protected void invokeRepaintListeners()
IComponent
the notifyRepaint()
method.
protected void invokeSaveEditingControls() throws ModelException
IComponent
the saveEditing()
method.
ModelException
- if saving the editors fails.protected void invokeCancelEditingControls()
IComponent
the cancelEditing()
method.
public void setDefaultValues() throws ModelException
ModelException
- if the set value failsprotected boolean hasControls()
true
if this row has at least one control
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |