Rogue Wave Views |
Rogue Wave Views Documentation Home |
Gadget class. More...
#include <ilviews/dataccess/gadgets/datasrc.h>
Public Member Functions | |
IliDataSource (IlvDisplay *display, const IlvPoint &at, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
The constructor initializes a data source. More... | |
void | addErrorMessage (const IliErrorMessage &msg) |
Forwards an error message to all the error sinks. More... | |
void | addErrorMessage (const char *msg) |
Forwards an application error message to all the error sinks. More... | |
void | addErrorSink (IliErrorSink *sink) |
Adds an error sink. More... | |
IlBoolean | applyQueryMode (IlBoolean interactive=IlFalse) |
Applies the query that the user specified while in query mode. More... | |
void | applyToFields (IliDataSourceFieldCallback cb, IlAny arg) |
Calls the callback function for each field managed by the data source. More... | |
void | cancel () |
Cancels any user input awaiting validation. More... | |
void | cancelQueryMode () |
Cancels query mode by restoring the original data source table. | |
void | clear () |
Calls the IliTable::clearRows member function on the table of the data source. More... | |
IlBoolean | deleteCurrentRow () |
Deletes the current row of the data source (as long as the current row is an actual row). More... | |
void | dontDeleteRow () |
Call this member function from the onPrepareDeleteRow virtual member function, or from the corresponding callback to cancel the row deletion. | |
void | dontValidateRow () |
Call this member function from one of the onValidateRow , onPrepareInsert , or onPrepareUpdate virtual member functions, or from one of their corresponding callbacks. | |
void | enableAutoRowLocking (IlBoolean f) |
Specifies whether auto-row-locking mode is enabled for the data source. More... | |
void | enableAutoSelect (IlBoolean autoSelect) |
Specifies whether auto-select mode is enabled for the data source. More... | |
void | enableInsert (IlBoolean enable) |
Specifies whether insertion is allowed. More... | |
virtual IlvBitmap * | getBitmap () const |
Returns the bitmap that is displayed during the design phase in Rogue Wave Views Data Access. More... | |
IlInt | getColumnsCount () const |
Returns the number of columns in the table. More... | |
IlInt | getCurrentRow () const |
Returns the position of the current row. More... | |
IlInt | getDeletedRow () const |
Returns the position of the row that is currently being deleted if called from the onDeleteRow member function, or returns the position of the row that is to be deleted if called from the onPrepareDeleteRow member function (or from the corresponding callback). More... | |
const IliTablePropertyManager * | getEffectiveTablePropertyManager () const |
Returns the effective table property manager used by the data source. More... | |
IliTablePropertyManager * | getEffectiveTablePropertyManager () |
Returns the effective table property manager used by the data source. More... | |
IliErrorReporter * | getErrorReporter () const |
Returns the error reporter that is used by the reportErrors member functions. More... | |
IlInt | getFetchedRow () const |
Returns the position of the row that is currently being fetched. More... | |
IlInt | getRowsCount () const |
Returns the number of rows in the table. More... | |
const IliTable * | getTable () const |
Returns the table of the data source. More... | |
IliTable * | getTable () |
Returns the table of the data source. More... | |
const char * | getTablePropertyManagerName () const |
Returns the name of the table property manager used by the data source or NULL if the default table property manager is used. Initially, this property is NULL . More... | |
const IliValue & | getValue (IlInt colno) const |
Returns the current value of one column. More... | |
const IliValue & | getValue (IliName colname) const |
Returns the current value of one column. More... | |
IlBoolean | gotoFirst () |
Changes the current row of the data source to the first row of the table after validating any pending user input. More... | |
IlBoolean | gotoLast () |
Changes the current row of the data source to the insert row, provided insertion is allowed, or to the last row if not. More... | |
IlBoolean | gotoNext () |
Changes the current row of the data source to the next row after validating any pending user input. More... | |
IlBoolean | gotoPrevious () |
Changes the current row of the data source to the previous row (as long as the current row is not the first row). More... | |
IlBoolean | gotoRow (IlInt rowno) |
Changes the current row of the data source to a row. More... | |
IlBoolean | isAutoRowLockingEnabled () const |
Returns IlTrue if the data source automatically calls refreshAndLockRow on the underlying table as soon as an attempt to modify an existing row is made. More... | |
IlBoolean | isAutoSelectEnabled () const |
Returns IlTrue if auto-select mode is enabled for the data source. More... | |
IlBoolean | isCurrentRowNull () const |
Returns IlTrue if all the columns of the current row have a null value. More... | |
IlBoolean | isEditable () const |
Returns IlTrue if the data source is not read-only, and if it is currently positioned on a valid row or on the insert row. More... | |
IlBoolean | isInputModified () const |
Returns IlTrue if the user has edited any of the fields managed by the data source. More... | |
IlBoolean | isInQueryMode () const |
Returns IlTrue if the data source is currently in query mode. More... | |
IlBoolean | isInsertEnabled () const |
Returns IlTrue if new rows can be inserted in the table through the data source. More... | |
IlBoolean | isOnInsertRow () const |
Returns IlTrue if the current row is the insert row. More... | |
IlBoolean | isQueryModeSupported () const |
Returns IlTrue if the query mode is supported. More... | |
IlBoolean | isReadOnly () const |
Returns IlTrue if the data source is read-only. More... | |
IlBoolean | isUsingTableProperties () const |
Returns IlTrue if the data source uses table properties. More... | |
virtual void | onCancelEdits () |
Called just after the current edits have been canceled. More... | |
virtual void | onDeleteRow () |
Called each time a row is about to be deleted from the data source table. More... | |
virtual void | onEnterInsertMode () |
Called when the data source enters insert mode. More... | |
virtual void | onEnterModifiedState () |
Called just after the data-source changes its state from "not-modified" to "modified". More... | |
virtual void | onEnterRow () |
Called whenever the data source enters a new row. More... | |
virtual void | onEnterUpdateMode () |
Called when the data source enters update mode. More... | |
virtual void | onFetchRow () |
Called when the data source table is a two-tier table, and each time a new row is fetched from the remote database and stored in the table cache. More... | |
virtual void | onPrepareDeleteRow () |
Called when the user attempts to delete a row through this data-source or when the deleteCurrentRow member function is called. More... | |
virtual void | onPrepareInsert () |
Called just before a row is inserted into the data source table. More... | |
virtual void | onPrepareUpdate () |
Called just before a row is updated in the data source table. More... | |
virtual void | onQuitInsertMode () |
Called just after a row has been inserted in the data source table. More... | |
virtual void | onQuitRow () |
Called just before leaving a row. More... | |
virtual void | onQuitUpdateMode () |
Called just after a row has been updated in the data source table. More... | |
virtual void | onValidateRow () |
Called by the validate member function before actually updating the data source table (for both update and insert rows). More... | |
IlBoolean | refreshAndLockCurrentRow (IlBoolean keepChanges=IlFalse) |
Refreshes and lock current row. More... | |
IlBoolean | refreshCurrentRow (IlBoolean keepChanges=IlFalse) |
Refreshes current row. More... | |
void | removeErrorSink (IliErrorSink *sink) |
Removes an error sink from this data source. More... | |
void | reportErrors (const IliErrorList &errorList) const |
Reports the errors that are contained in an error list. More... | |
IlBoolean | select () |
Calls the IliTable::select member function on the table of the data source and then moves to the first row of the table. More... | |
void | setErrorReporter (IliErrorReporter *reporter) |
Sets the error reporter. More... | |
virtual void | setGlobalScope (IlBoolean) |
Specifies whether the scope of the name of the data gem is local to the container in which it is located or globally visible. More... | |
void | setReadOnly (IlBoolean only) |
Specifies whether the data source is read-only. More... | |
virtual void | setTable (IliTable *table, IlBoolean owner=IlTrue) |
Sets the table of the data source. More... | |
void | setTablePropertyManagerName (const char *name) |
Sets the table property manager name. More... | |
IlBoolean | setValue (IlInt colno, const IliValue &value) |
Sets the data source value of one column. More... | |
IlBoolean | setValue (IliName colname, const IliValue &value) |
Sets the data source value of one column. More... | |
void | setValueModified (IlInt colno, IlBoolean flag) |
Sets the modified attribute of a value of one column. More... | |
void | setValueModified (IliName colname, IlBoolean flag) |
Changes the modified attribute of the value of one column. More... | |
IlBoolean | startInsert () |
Changes the current row of the data source to the insert row, provided insertion is allowed. More... | |
IlBoolean | switchToQueryMode () |
Switches to query mode. More... | |
void | useTableProperties (IlBoolean flag) |
Enables/Disables use table properties. More... | |
IlBoolean | validate (IlBoolean interactive=IlFalse) |
Validates the current row. More... | |
Public Member Functions inherited from IliDataGem | |
IlBoolean | hasGlobalScope () const |
Returns IlFalse if the scope of the name of the data gem is limited to the container in which it is located. More... | |
IlBoolean | isSystemUsage () const |
Returns IlTrue if the object is used by the system. More... | |
virtual void | usedBySystem (IlBoolean usage) |
Specifies if the object is a system object. More... | |
Static Public Member Functions | |
static IlvSymbol * | CancelEditsSymbol () |
Returns the callback name which is called by the corresponding virtual member function. More... | |
static IlvSymbol * | DeleteRowSymbol () |
Returns the callback name which is called by the corresponding virtual member function. More... | |
static IlvSymbol * | EnterInsertModeSymbol () |
Returns the callback name which is called by the corresponding virtual member function. More... | |
static IlvSymbol * | EnterModifiedStateSymbol () |
Returns the callback name which is called by the corresponding virtual member function. More... | |
static IlvSymbol * | EnterRowSymbol () |
Returns the callback name which is called by the corresponding virtual member function. More... | |
static IlvSymbol * | EnterUpdateModeSymbol () |
Returns the callback name which is called by the corresponding virtual member function. More... | |
static IlvSymbol * | FetchRowSymbol () |
Returns the callback name which is called by the corresponding virtual member function. More... | |
static IlvSymbol * | PrepareDeleteRowSymbol () |
Returns the callback name which is called by the corresponding virtual member function. More... | |
static IlvSymbol * | PrepareInsertSymbol () |
Returns the callback name which is called by the corresponding virtual member function. More... | |
static IlvSymbol * | PrepareUpdateSymbol () |
Returns the callback name which is called by the corresponding virtual member function. More... | |
static IlvSymbol * | QuitInsertModeSymbol () |
Returns the callback name which is called by the corresponding virtual member function. More... | |
static IlvSymbol * | QuitRowSymbol () |
Returns the callback name which is called by the corresponding virtual member function. More... | |
static IlvSymbol * | QuitUpdateModeSymbol () |
Returns the callback name which is called by the corresponding virtual member function. More... | |
static IlvSymbol * | ValidateRowSymbol () |
Returns the callback name which is called by the corresponding virtual member function. More... | |
Friends | |
class | IliFieldItf |
Additional Inherited Members | |
Protected Member Functions inherited from IliDataGem | |
IliDataGem (IlvDisplay *display, const IlvPoint &at, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
The constructor initializes a data gem. More... | |
Gadget class.
Library: dbgadget
The IliDataSource
class defines a gadget that holds an IliTable
and that can manage a set of field gadgets located in one or more containers. Each of these field gadgets is connected to a column of the table. In addition, the data source acts like a cursor in the table, because at any point in time it is positioned on a particular row of the table. Member functions are provided that enable the data source to move to the next row, previous row, and so on. A data source is characterized by the following properties:
IlvGraphic
class)-this name allows any field gadget to retrieve the data source and connect to it (see the IliRepository
class). getTable
and setTable
member functions). -1
. getValue
and setValue
member functions)-the row buffer is an ordered collection of values that have the same schema as the data source table. applyToFields
member function and the IliFieldItf
class). isInputModified
member function). Each time the current row index of a data source is changed to a new value, the data source row buffer is updated with a copy of the designated table row. If the new current row does not designate a valid row in the table, the data source row buffer is updated with null values. The data source input-modified
property is also cleared.
At this time, any fields that are connected to the data source are updated with a value from the row buffer. This value corresponds to the column which the field gadget is connected to. The user can then edit the values displayed in the fields or, alternatively, can call the setValue
member function. The data source input-modified
property is set to IlTrue
at this time. In addition, the data source calls either the onEnterInsertMode
or onEnterUpdateMode
virtual member functions, depending on whether the current row index points to the insert row or not. Any new values edited by the user in the field gadgets are copied to their corresponding position in the row buffer.
Later, the user can call the validate
member function. This will trigger some system-defined and some user-defined checks on the row buffer (see the onValidateRow
, onPrepareInsert
, and onPrepareUpdate
virtual member functions). If the checks succeed, either a new row is inserted into the table or the table row is updated from the data source row buffer (depending on whether the current row is the insert row or not). The input-modified property of the data source is set to IlFalse
.
As an alternative to the validate
method function, the user can call cancel
. In this case, the contents of the row buffer are dismissed, the row buffer is updated from the existing table row (or with null values if the current row does not designate a row in the table), and any field gadgets are updated with values from row buffer. The input-modified property is set to IlFalse
.
IliDataSource::IliDataSource | ( | IlvDisplay * | display, |
const IlvPoint & | at, | ||
IlUShort | thickness = IlvDefaultGadgetThickness , |
||
IlvPalette * | palette = 0 |
||
) |
The constructor initializes a data source.
display | The display. |
at | The location. |
thickness | The border thickness. |
palette | The palette. |
void IliDataSource::addErrorMessage | ( | const IliErrorMessage & | msg | ) |
Forwards an error message to all the error sinks.
This member function may be called by one of the onValidateRow
, onPrepareInsert
or onPrepareUpdate
virtual member functions, or by the corresponding callbacks.
msg | The message. |
void IliDataSource::addErrorMessage | ( | const char * | msg | ) |
Forwards an application error message to all the error sinks.
This member function may be called by one of the onValidateRow
, onPrepareInsert
, or onPrepareUpdate
virtual member functions, or by the corresponding callbacks.
msg | The message. |
void IliDataSource::addErrorSink | ( | IliErrorSink * | sink | ) |
Adds an error sink.
All errors that occur on the data source table, and all errors that are thrown by one of the addErrorMessage
member functions, will be forwarded to this error sink. Note that the data source will not delete the error sink at destruction time, so the same error sink may be safely shared among many data sources.
sink | The error sink. |
Applies the query that the user specified while in query mode.
The original data source table is restored and its select
member function is called. If the interactive parameter is IlTrue
, any errors that occur will be reported to the user by calling the reportErrors
member function.
interactive | The interactive flag. |
IlTrue
if successful. void IliDataSource::applyToFields | ( | IliDataSourceFieldCallback | cb, |
IlAny | arg | ||
) |
Calls the callback function for each field managed by the data source.
Repeatedly calls the callback function for each field managed by the data source using in the following:
The callback takes as its parameters the data source itself, the field, the position of the column to which the field is connected, and the arg parameter. Some fields, such as table gadgets, are not connected to a particular column. In this case, the colno parameter will be -1
.
cb | The callback. |
arg | The user data. |
IliDataSourceFieldCallback
. void IliDataSource::cancel | ( | ) |
Cancels any user input awaiting validation.
The input-modified property of the data source is cleared. This member function calls the onCancelEdits
virtual member function.
|
static |
Returns the callback name which is called by the corresponding virtual member function.
void IliDataSource::clear | ( | ) |
Calls the IliTable::clearRows
member function on the table of the data source.
If the table is a one-tier table, this deletes all rows. If the table is a two-tier table, the local row cache of the table is cleared. Any pending user input is canceled by this member function.
IlBoolean IliDataSource::deleteCurrentRow | ( | ) |
Deletes the current row of the data source (as long as the current row is an actual row).
IlTrue
if successful.
|
static |
Returns the callback name which is called by the corresponding virtual member function.
void IliDataSource::enableAutoRowLocking | ( | IlBoolean | f | ) |
Specifies whether auto-row-locking mode is enabled for the data source.
f | The auto-row-locking permission. |
void IliDataSource::enableAutoSelect | ( | IlBoolean | autoSelect | ) |
Specifies whether auto-select mode is enabled for the data source.
autoSelect | The auto-select mode flag. |
void IliDataSource::enableInsert | ( | IlBoolean | enable | ) |
Specifies whether insertion is allowed.
enable | The insertion flag. |
|
static |
Returns the callback name which is called by the corresponding virtual member function.
|
static |
Returns the callback name which is called by the corresponding virtual member function.
|
static |
Returns the callback name which is called by the corresponding virtual member function.
|
static |
Returns the callback name which is called by the corresponding virtual member function.
|
static |
Returns the callback name which is called by the corresponding virtual member function.
|
virtual |
Returns the bitmap that is displayed during the design phase in Rogue Wave Views Data Access.
Reimplemented from IliDataGem.
Reimplemented in IliMemoryDataSource, and IliSQLDataSource.
IlInt IliDataSource::getColumnsCount | ( | ) | const |
Returns the number of columns in the table.
IlInt IliDataSource::getCurrentRow | ( | ) | const |
Returns the position of the current row.
-1
if the data source is not positioned on a row or a value equal to getRowsCount()
if the data source is positioned on the insert row. IlInt IliDataSource::getDeletedRow | ( | ) | const |
Returns the position of the row that is currently being deleted if called from the onDeleteRow
member function, or returns the position of the row that is to be deleted if called from the onPrepareDeleteRow
member function (or from the corresponding callback).
const IliTablePropertyManager* IliDataSource::getEffectiveTablePropertyManager | ( | ) | const |
Returns the effective table property manager used by the data source.
It is obtained as follows:
useTableProperties
property is IlFalse
, this member function returns NULL
. tablePropertyManagerName
property is not NULL
, the table property manager with that name is returned. IliTablePropertyManager* IliDataSource::getEffectiveTablePropertyManager | ( | ) |
Returns the effective table property manager used by the data source.
IliErrorReporter* IliDataSource::getErrorReporter | ( | ) | const |
Returns the error reporter that is used by the reportErrors
member functions.
When this property is NULL
a default error reporter is used. Initially this property is NULL
.
IlInt IliDataSource::getFetchedRow | ( | ) | const |
Returns the position of the row that is currently being fetched.
This member function may be called from the onFetchRow
member function or from the corresponding callback.
IlInt IliDataSource::getRowsCount | ( | ) | const |
Returns the number of rows in the table.
const IliTable* IliDataSource::getTable | ( | ) | const |
Returns the table of the data source.
IliTable* IliDataSource::getTable | ( | ) |
Returns the table of the data source.
const char* IliDataSource::getTablePropertyManagerName | ( | ) | const |
Returns the name of the table property manager used by the data source or NULL
if the default table property manager is used. Initially, this property is NULL
.
Returns the current value of one column.
Note that this is the data source value for the column, as opposed to the underlying table value.
colno | The column position. |
Returns the current value of one column.
Note that this is the data source value for the column, as opposed to the underlying table value.
colname | The column name. |
IlBoolean IliDataSource::gotoFirst | ( | ) |
Changes the current row of the data source to the first row of the table after validating any pending user input.
IlTrue
if successful. IlBoolean IliDataSource::gotoLast | ( | ) |
Changes the current row of the data source to the insert row, provided insertion is allowed, or to the last row if not.
Any pending user input is first validated by this member function.
IlTrue
if successful. IlBoolean IliDataSource::gotoNext | ( | ) |
Changes the current row of the data source to the next row after validating any pending user input.
If the current row is the last row of the table and if insertion is allowed, the current row changes to the insert row.
IlTrue
if successful. IlBoolean IliDataSource::gotoPrevious | ( | ) |
Changes the current row of the data source to the previous row (as long as the current row is not the first row).
Any pending user input is first validated by this member function.
IlTrue
if successful. Changes the current row of the data source to a row.
Any pending user input is first validated by this member function.
rowno | The row position. If rowno equals -1 , the data source will not be positioned on any row. If rowno equals getRowsCount() , the current row will change to the insert row. |
IlTrue
if successful. IlBoolean IliDataSource::isAutoRowLockingEnabled | ( | ) | const |
Returns IlTrue
if the data source automatically calls refreshAndLockRow
on the underlying table as soon as an attempt to modify an existing row is made.
This is useful when using IliSQLTable
objects in order to implement the "pessimistic concurrency control policy". For more information, see the description of the IliSQLTable::getConcurrencyControl
member function. Initially, this property is set to IlFalse
.
IlBoolean IliDataSource::isAutoSelectEnabled | ( | ) | const |
Returns IlTrue
if auto-select mode is enabled for the data source.
When auto-select mode is enabled, the data source automatically calls the select
member function if an event occurs. The table of a data source may have parameters already defined. Some of these parameters may have been mapped onto other data sources. Therefore, we can say that a data source depends on another data source through its table parameters. Then, provided auto-select mode is enabled, the data source will call the select
member function whenever one of the data sources on which it depends undergoes a current row change. Initially, this property is set to IlFalse
.
IlBoolean IliDataSource::isCurrentRowNull | ( | ) | const |
Returns IlTrue
if all the columns of the current row have a null
value.
IlTrue
if the current row is null. IlBoolean IliDataSource::isEditable | ( | ) | const |
Returns IlTrue
if the data source is not read-only, and if it is currently positioned on a valid row or on the insert row.
IlBoolean IliDataSource::isInputModified | ( | ) | const |
Returns IlTrue
if the user has edited any of the fields managed by the data source.
IlTrue
if an editing has been done. IlBoolean IliDataSource::isInQueryMode | ( | ) | const |
Returns IlTrue
if the data source is currently in query mode.
IlBoolean IliDataSource::isInsertEnabled | ( | ) | const |
Returns IlTrue
if new rows can be inserted in the table through the data source.
Initially, this property is set to IlTrue
.
IlBoolean IliDataSource::isOnInsertRow | ( | ) | const |
Returns IlTrue
if the current row is the insert row.
IlTrue
if the data source is positioned on the insert row. IlBoolean IliDataSource::isQueryModeSupported | ( | ) | const |
Returns IlTrue
if the query mode is supported.
IlBoolean IliDataSource::isReadOnly | ( | ) | const |
Returns IlTrue
if the data source is read-only.
If the data source is read-only, the end-user cannot modify the table via the fields managed by the data source. Initially, this property is set to IlFalse
.
IlBoolean IliDataSource::isUsingTableProperties | ( | ) | const |
Returns IlTrue
if the data source uses table properties.
Initially, this property is IlTrue
.
|
virtual |
Called just after the current edits have been canceled.
The default implementation of this virtual member function calls the CancelEdits
callback.
|
virtual |
Called each time a row is about to be deleted from the data source table.
The index of the row can be obtained by the getDeleteRow
member function. The default implementation of this virtual member function is to call the DeleteRow
callback. The dontDeleteRow
member function can be used to cancel the row deletion.
|
virtual |
Called when the data source enters insert mode.
The default implementation of this virtual member function calls the EnterInsertMode
callback.
|
virtual |
Called just after the data-source changes its state from "not-modified" to "modified".
This typically happens when the end user starts modifying a field connected to the data-source or when the setValue
member function is called. This virtual member function can be overridden to do the following : check that it is possible to enter the modified state at this time and, if not, then call the cancel
member function.
The default implementation of this virtual member function calls the EnterModifiedState
callback.
onEnterUpdateMode
or onEnterInsertMode
virtual member functions for this purpose since they are called before the state of the data-source changes (and hence calling cancel would not have any effect in this case).
|
virtual |
Called whenever the data source enters a new row.
The default implementation of this virtual member function calls the EnterRow
callback.
|
virtual |
Called when the data source enters update mode.
The default implementation of this virtual member function calls the EnterUpdateMode
callback.
|
virtual |
Called when the data source table is a two-tier table, and each time a new row is fetched from the remote database and stored in the table cache.
The index of the row that has been fetched can be obtained by the getFetchedRow
member function. The default implementation of this virtual member function calls the FetchRow
callback.
|
virtual |
Called when the user attempts to delete a row through this data-source or when the deleteCurrentRow
member function is called.
The index of the row which is to be deleted can be obtained by calling the getDeletedRow
member function. This virtual member function can be overridden to do the following :
dontDeleteRow
should be called. In this case, deleteCurrentRow
will not delete the row. Instead, it will return a value of IlFalse
. addErrorMessage
member function can be called to describe the reason of the failure. The default implementation of this virtual member function calls the PrepareDeleteRow
callback.
|
virtual |
Called just before a row is inserted into the data source table.
This virtual member function may check that the row is correct, and it may also alter the row prior to inserting the table. In addition, it may decide that the row is invalid, and reject the table insert by calling the dontValidateRow
member function. In this case, it may call the addErrorMessage
member function to provide the user with an error message. The default implementation of this virtual member function calls the PrepareInsert
callback.
|
virtual |
Called just before a row is updated in the data source table.
This virtual member function may check that the row is correct and it may also alter the row prior to updating the table. In addition, it may decide that the row is invalid and reject the table update, by calling the dontValidateRow
member function. In this case, it may call the addErrorMessage
member function to provide the user with an error message. The default implementation of this virtual member function calls the PrepareUpdate
callback.
|
virtual |
Called just after a row has been inserted in the data source table.
The default implementation of this virtual member function calls the QuitInsertMode
callback.
|
virtual |
Called just before leaving a row.
The default implementation of this virtual member function calls the QuitRow
callback.
|
virtual |
Called just after a row has been updated in the data source table.
The default implementation of this virtual member function calls the QuitUpdateMode
callback.
|
virtual |
Called by the validate
member function before actually updating the data source table (for both update and insert rows).
This virtual member function can be overridden to do the following:
dontValidateRow
member function should be called. In this case validate
will not update the table. Instead it will return a value of IlFalse
and the data source will remain in the input-modified state. addErrorMessage
member function may be called to describe the reason for the failure. The default implementation of this virtual member function calls the ValidateRow
callback. For example, if you subclass the IliDataSource
class, you can override the onValidateRow
virtual member function with the following:
or, alternatively, if you do not subclass the IliDataSource
class, you may use a callback:
|
static |
Returns the callback name which is called by the corresponding virtual member function.
|
static |
Returns the callback name which is called by the corresponding virtual member function.
|
static |
Returns the callback name which is called by the corresponding virtual member function.
|
static |
Returns the callback name which is called by the corresponding virtual member function.
|
static |
Returns the callback name which is called by the corresponding virtual member function.
|
static |
Returns the callback name which is called by the corresponding virtual member function.
Refreshes and lock current row.
This member function does the same thing as the refreshCurrentRow
member function. In addition, if the remote database supports it, the remote row that corresponds to the current row is locked so that other users cannot modify or delete it as long as the lock is held. See the description of the IliTable::refreshAndLockRow
member function and the IliSQLTable
class for more information on row locking.
keepChanges | The "keepChanges" flag. |
IlTrue
if successful. Refreshes current row.
If the underlying table is a two-tier table, this member function re-reads the current row values from the remote database. If the optional keepChanges parameter is IlTrue
, any columns of the data source that contain changes awaiting validation will keep these changes pending. Only unchanged columns will be updated. If keepChanges is IlFalse
, all columns are updated without regard to the "modified" state. With a one-tier table, this member function does nothing.
keepChanges | The "keepChanges" flag. |
IlTrue
if successful. void IliDataSource::removeErrorSink | ( | IliErrorSink * | sink | ) |
Removes an error sink from this data source.
sink | The error sink. |
void IliDataSource::reportErrors | ( | const IliErrorList & | errorList | ) | const |
Reports the errors that are contained in an error list.
This member function makes use of the error reporter returned by getErrorReporter
if any, otherwise it uses a default error reporter.
Here is an example that shows how errors can be trapped:
errorList | The error list. |
IlBoolean IliDataSource::select | ( | ) |
Calls the IliTable::select
member function on the table of the data source and then moves to the first row of the table.
Any pending user input is canceled by this member function.
IlTrue
if successful. void IliDataSource::setErrorReporter | ( | IliErrorReporter * | reporter | ) |
Sets the error reporter.
Note that the data source will not delete the error reporter at destruction time, so the same error reporter may be safely shared among many data sources.
reporter | The error reporter. |
|
virtual |
Specifies whether the scope of the name of the data gem is local to the container in which it is located or globally visible.
global | The data source scope (IlTrue for global). |
Reimplemented from IliDataGem.
void IliDataSource::setReadOnly | ( | IlBoolean | only | ) |
Specifies whether the data source is read-only.
only | The read only flag. |
Sets the table of the data source.
table | The table. |
owner | To specify whether the data source becomes the owner of the table if IlTrue . |
void IliDataSource::setTablePropertyManagerName | ( | const char * | name | ) |
Sets the table property manager name.
name | The table property manager name. If NULL or an empty string, the default table property manager will be used. |
Sets the data source value of one column.
Consequently, all fields connected to the column are updated with the new value without the underlying table being affected. A side effect of calling this member function is that the data source input is modified.
colno | The column position. |
value | The value. |
IlTrue
if successful. Sets the data source value of one column.
Consequently, all fields connected to the column are updated with the new value without the underlying table being affected. A side effect of calling this member function is that the data source input is modified.
colname | The column name. |
value | The value. |
IlTrue
if successful. Sets the modified attribute of a value of one column.
Normally, the value of a column is considered unmodified when it is set by the data source (such as when an EnterRow
or CancelEdits
event occurs). Then it may become modified if the user edits this value or if it is changed by the setValue
member function. With the setValueModified
member function, it is possible to fool the data source and let it believe that that a column value has not been modified.
colno | The column position. |
flag | The modified flag. |
Changes the modified attribute of the value of one column.
colname | The column name. |
flag | The modified flag. |
IlBoolean IliDataSource::startInsert | ( | ) |
Changes the current row of the data source to the insert row, provided insertion is allowed.
Any pending user input is first validated by this member function.
IlTrue
if successful. IlBoolean IliDataSource::switchToQueryMode | ( | ) |
Switches to query mode.
If query mode is supported, this member function changes the data source table to a special memory table dedicated to contain query conditions.
IlTrue
if successful. void IliDataSource::useTableProperties | ( | IlBoolean | flag | ) |
Enables/Disables use table properties.
flag | If IlTrue , the data source will use table properties. |
Validates the current row.
Validation is carried out in the following way:
onValidateRow
virtual method is then called. It checks any application-defined constraints and if these are not satisfied, it calls the dontValidateRow
member function. In this case, validation fails. onPrepareInsert
or onPrepareUpdate
virtual member function is called (depending on whether the current row is the insert row or not). onQuitInsertMode
or onQuitUpdateMode
virtual member function is called and IlTrue
is returned. If successful, the row buffer of the data source becomes unmodified. If the interactive parameter is IlTrue
, any errors that may occur are automatically reported to the user by calling the reportErrors
member function. If the interactive parameter is IlFalse
, errors are not reported.
interactive | The interactive flag. |
IlTrue
if successful.
|
static |
Returns the callback name which is called by the corresponding virtual member function.
© Copyright 2015, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.