borland Packages Class Hierarchy dx.dataset Package
java.lang.Object +----com.borland.dx.dataset.ReadRow +----com.borland.dx.dataset.ReadWriteRow +----com.borland.dx.dataset.RowIterator
Properties Methods
Implements Serializable
RowIterator
provides lightweight (low memory usage and fast binding) iteration capabilities for any class that extends ReadRow
. RowIterator
s can also be used to ensure static type safe access to columns.
RowIterator
capabilities are dependent on what class it is bound to. It can provide:
ReadRow
.
ReadWriteRow
.
DataSet
.
A RowIterator
can be bound (using the bind
method) to any class that extends ReadRow
.
See the TwoTier sample project in the samples/DataExpress/TwoTier folder of your JBuilder installation for an example of how RowIterator
can be applied to provide type safe access.
RowIterator
bound to a DataSet
RowIterator
is bound to a DataSet
, the post()
method must be used to cause the changes to appear in the bound DataSet
. This allows multiple RowIterators
to be simultaneously editing different rows in the same DataSet
.
When bound to a ReadWriteRow
, setting columns takes immediate effect. You can force a DataSet
to be bound as a ReadWriteRow
by calling RowIterator.bind((ReadWriteRow)DataSet)
.
If you have bound a RowIterator
to a DataSet
, you must call RowIterator.unbind()
to free up allocated memory resources used by the RowIterator
. Note that this does not have to be done if the DataSet
was bound as a ReadWriteRow
.
You can extend RowIterator
or embed it in your own row object. With your own row object, you can add type safe accessor methods with descriptive names. Once established, tools like JBuilder can provide accessor choices inside the editor via Code Insight.
For example, in the case of a customer table, your application may set up an entity Object
that extends StorageDataSet
. The entity Object
contains the business logic for customers expressed as property and event settings with associated business logic. The entity Object
has a private jbInit()
method so it is designable using tools like JBuilder. The jbInit()
method contains the persistent columns, property and event settings for the entity Object
.
public final DataSet getDataSet()Read-only property that returns the
DataSet
this RowIterator
is bound to.
public final boolean isEditing()Read-only property that returns whether the
DataSet
is being edited or not.
public final boolean isEditingNewRow()Read-only property that returns whether data is being added to a new row in the
DataSet
or not.
public final long getInternalRow()Returns a unique identifier for the current row.
Will throw a DataSetException
if not bound to a DataSet
.
public final ReadRow getReadRow()Read-only property that returns the
ReadRow
this RowIterator
is bound to.
public final ReadWriteRow getReadWriteRow()Read-only property that returns the
ReadWriteRow
this RowIterator
is bound to.
public final int getRow()Returns the current row position.
Will throw a DataSetException
if not bound to a DataSet
.
public final boolean atFirst()Returns true if this
RowIterator
is at the first row visible by the DataSet
it is bound to.
public final boolean atLast()Returns true if this
RowIterator
is at the last row visible by the DataSet
it is bound to.
public void bind(DataSet dataSet)Binds to a
DataSet
.
unbind()
must be called when you are done with this iterator. Once the RowIterator
is bound, set/get operations are allowed on Columns
and row navigation is allowed.
Edited and inserted rows must call the post()
method to make the changes visible to the bound DataSet
.
public void bind(ReadRow readRow)Binds to a
ReadRow
. Once the RowIterator
is bound, get operations are allowed on Columns
.
public void bind(ReadWriteRow writeRow)Binds to a
ReadWriteRow
. Once the RowIterator
is bound, set/get operations are allowed on Columns
.
public void bind(RowIterator iterator)Binds to another
RowIterator
. If the iterator is bound to a DataSet
, unbind()
must be called when you are done with this iterator.
public final void cancel()Cancels edit mode and any edits made to the
RowIterator
.
Will throw a DataSetException
if not bound to a DataSet
.
public final void deleteRow()Deletes the row where the
RowIterator
is positioned.
Will throw a DataSetException
if not bound to a DataSet
.
public final void first()Moves to the first row visible by this
DataSet
.
This may cause inBounds()
to return true if more than one row exists.
public final boolean inBounds()Returns true if the most recent navigation was in bounds.
public final void insertRow()Associates the
RowIterator
with an unposted row containing default values. Columns that have no default values are initialized with Variant.UNASSIGNED_NULL
.
Will throw a DataSetException
if not bound to a DataSet
.
public final void last()Moves to the last row visible by this
DataSet
.
This may cause inBounds()
to return true if more than one row exists.
public final boolean locate(ReadRow rowLocate, int locateOptions)Positions the
RowIterator
to the row with values specified by rowLocate
.
This method behaves much the same as DataSet.locate()
.
Will throw a DataSetException
if not bound to a DataSet
.
public final boolean next()Moves to the next row visible by this
RowIterator
.
This will cause inBounds()
to return false if next()
is called when the iterator is positioned at the last visible row.
public final void post()Terminates edit mode for
RowIterator
and causes new or edited row changes to be posted to the bound DataSet
.
This method is most useful when bound to a DataSet
.
public final boolean prior()Moves to the prior row visible by this
RowIterator
.
This will cause inBounds()
to return false if prior()
is called when the iterator is positioned at the first visible row.
public final void unbind()This must be called to free up allocated resources when bound to a
DataSet
.
Note that if an iterator is bound to a different Object
than extends from ReadRow
, an implicit unbind()
call will be made for the previously bound object.