Proxy to hold modifications for any DataModel, providing the DataModel interface itself. More...
Public Member Functions | |
virtual | ~DataProxy () |
GdaDataProxy* | gobj () |
Provides access to the underlying C GObject. | |
const GdaDataProxy* | gobj () const |
Provides access to the underlying C GObject. | |
GdaDataProxy* | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
Glib::RefPtr< DataModel > | get_proxied_model () |
Fetch the Gda::DataModel which proxy does proxy. | |
Glib::RefPtr< const DataModel > | get_proxied_model () const |
Fetch the Gda::DataModel which proxy does proxy. | |
int | get_proxied_model_n_cols () const |
Get the number of columns in the proxied data model. | |
int | get_proxied_model_n_rows () const |
Get the number of rows in the proxied data model. | |
bool | is_read_only () const |
ValueSList | get_values (int proxy_row, const Glib::ArrayHandle< int >& cols_index) const |
Retrieve a whole list of values from the proxy data model. | |
ValueAttribute | get_value_attributes (int proxy_row, int col) const |
Get the attributes of the value stored at (proxy_row, col) in proxy, which is an ORed value of Gda::ValueAttribute flags. | |
void | alter_value_attributes (int proxy_row, int col, ValueAttribute alter_flags) |
Alters the attributes of the value stored at (proxy_row, col) in proxy. | |
int | get_proxied_model_row (int proxy_row) const |
Get the proxy's proxied model row corresponding to proxy_row. | |
void | erase (int proxy_row) |
Marks the row proxy_row to be deleted. | |
void | unerase (int proxy_row) |
Remove the "to be deleted" mark at the row proxy_row, if it existed. | |
bool | row_is_deleted (int proxy_row) const |
Tells if the row number proxy_row is marked to be deleted. | |
bool | row_is_inserted (int proxy_row) const |
Tells if the row number proxy_row is a row which has been inserted in proxy (and is thus not in the proxied data model). | |
void | cancel_row_changes (int proxy_row, int col) |
Resets data at the corresponding row and column. | |
void | apply_row_changes (int proxy_row) |
Commits the modified data in the proxy back into the Gda::DataModel. | |
bool | has_changed () const |
Tells if proxy contains any modifications not applied to the proxied data model. | |
bool | row_has_changed (int proxy_row) const |
Tells if the row number proxy_row has changed. | |
int | get_n_new_rows () const |
Get the number of rows which have been added to proxy and which are not part of the proxied data model. | |
int | get_n_modified_rows () const |
Get the number of rows which have been modified in the proxy (the sum of rows existing in the proxied data model which have been modified, and new rows). | |
void | set_sample_size (int sample_size) |
Sets the size of each chunk of data to display: the maximum number of rows which can be "displayed" at a time (the maximum number of rows which proxy pretends to have). | |
int | get_sample_size () const |
Get the size of each chunk of data displayed at a time. | |
void | set_sample_start (int sample_start) |
Sets the number of the first row to be available in proxy (in reference to the proxied data model) | |
int | get_sample_start () const |
Get the number of the first row to be available in proxy (in reference to the proxied data model) | |
int | get_sample_end () const |
Get the number of the last row to be available in proxy (in reference to the proxied data model) | |
bool | apply_all_changes () |
Apply all the changes stored in the proxy to the proxied data model. | |
bool | cancel_all_changes () |
Cancel all the changes stored in the proxy (the proxy will be reset to its state as it was just after creation). | |
int | get_filtered_n_rows () |
Get the total number of filtered rows in proxy if a filter has been applied. | |
Glib::ustring | get_filter_expr () |
Get the current filter expression used by proxy. | |
void | get_filter_expr (const Glib::ustring& filter_expr) |
Sets a filter among the rows presented by proxy. | |
void | set_ordering_column (int col) |
Orders by the col column. | |
Glib::PropertyProxy < Glib::RefPtr< DataModel > > | property_model () |
Proxied data model. | |
Glib::PropertyProxy_ReadOnly < Glib::RefPtr< DataModel > > | property_model () const |
Proxied data model. | |
Glib::PropertyProxy< bool > | property_prepend_null_entry () |
Tells if a row composed of NULL values is inserted as the proxy's first row. | |
Glib::PropertyProxy_ReadOnly < bool > | property_prepend_null_entry () const |
Tells if a row composed of NULL values is inserted as the proxy's first row. | |
Glib::PropertyProxy< bool > | property_defer_sync () |
Tells if changes to the sample of rows displayed is done in background in several steps or if it's done in one step. | |
Glib::PropertyProxy_ReadOnly < bool > | property_defer_sync () const |
Tells if changes to the sample of rows displayed is done in background in several steps or if it's done in one step. | |
Glib::PropertyProxy< int > | property_sample_size () |
Number of rows which the proxy will contain at any time, like a sliding window on the proxied data model. | |
Glib::PropertyProxy_ReadOnly< int > | property_sample_size () const |
Number of rows which the proxy will contain at any time, like a sliding window on the proxied data model. | |
Glib::SignalProxy2< void, int, bool > | signal_row_delete_changed () |
Glib::SignalProxy2< void, int, int > | signal_sample_changed () |
Glib::SignalProxy1< void, int > | signal_sample_size_changed () |
Glib::SignalProxy0< void > | signal_filter_changed () |
Glib::SignalProxy2 < Glib::Error, int, int > | signal_validate_row_changes () |
Glib::SignalProxy2< void, int, int > | signal_row_changes_applied () |
Static Public Member Functions | |
static Glib::RefPtr< DataProxy > | create (const Glib::RefPtr< DataModel >& model) |
Protected Member Functions | |
DataProxy (const Glib::RefPtr< DataModel >& model) | |
virtual void | on_row_delete_changed (int row, bool to_be_deleted) |
virtual void | on_sample_changed (int sample_start, int sample_end) |
virtual void | on_sample_size_changed (int sample_size) |
virtual void | on_row_changes_applied (int row, int proxied_row) |
Related Functions | |
(Note that these are not member functions.) | |
Glib::RefPtr < Gnome::Gda::DataProxy > | wrap (GdaDataProxy* object, bool take_copy=false) |
A Glib::wrap() method for this object. |
Proxy to hold modifications for any DataModel, providing the DataModel interface itself.
This object stores modifications made to a DataModel object which is proxied until asked to make the changes inside the DataModel. It also filters the proxied data model to show only a sample (a defined number of continuous rows) of it.
Specifically, for a proxied data model having nb_cols columns and nb_rows rows, the DataProxy object has the following attributes:
Note that unless explicitely mentioned, the columns are read-only.
virtual Gnome::Gda::DataProxy::~DataProxy | ( | ) | [virtual] |
Gnome::Gda::DataProxy::DataProxy | ( | const Glib::RefPtr< DataModel >& | model ) | [explicit, protected] |
void Gnome::Gda::DataProxy::alter_value_attributes | ( | int | proxy_row, |
int | col, | ||
ValueAttribute | alter_flags | ||
) |
Alters the attributes of the value stored at (proxy_row, col) in proxy.
the alter_flags can only contain the GDA_VALUE_ATTR_IS_0
, GDA_VALUE_ATTR_IS_DEFAULT and GDA_VALUE_ATTR_IS_UNCHANGED flags (other flags are ignored).
proxy_row | A proxy row number. |
col | A valid column number. |
alter_flags | Flags to alter the attributes. |
bool Gnome::Gda::DataProxy::apply_all_changes | ( | ) |
Apply all the changes stored in the proxy to the proxied data model.
The changes are done row after row, and if an error occurs, then it is possible that not all the changes to all the rows have been applied.
true
if no error occurred. void Gnome::Gda::DataProxy::apply_row_changes | ( | int | proxy_row ) |
Commits the modified data in the proxy back into the Gda::DataModel.
proxy_row | The row number to commit. |
true
if no error occurred. bool Gnome::Gda::DataProxy::cancel_all_changes | ( | ) |
Cancel all the changes stored in the proxy (the proxy will be reset to its state as it was just after creation).
true
if no error occurred. void Gnome::Gda::DataProxy::cancel_row_changes | ( | int | proxy_row, |
int | col | ||
) |
Resets data at the corresponding row and column.
If proxy_row corresponds to a new row, then that new row is deleted from proxy.
proxy_row | The row to cancel changes. |
col | The column to cancel changes, or less than 0 to cancel any change on the row row. |
static Glib::RefPtr<DataProxy> Gnome::Gda::DataProxy::create | ( | const Glib::RefPtr< DataModel >& | model ) | [static] |
void Gnome::Gda::DataProxy::erase | ( | int | proxy_row ) |
Marks the row proxy_row to be deleted.
proxy_row | A proxy row number. |
Glib::ustring Gnome::Gda::DataProxy::get_filter_expr | ( | ) |
Get the current filter expression used by proxy.
0
if no filter has been set. void Gnome::Gda::DataProxy::get_filter_expr | ( | const Glib::ustring & | filter_expr ) |
Sets a filter among the rows presented by proxy.
The filter is defined by a filter expression which can be any SQL valid expression using proxy's columns. For instance if proxy has the "id" and "name" columns, then a filter can be "length(name) < 5" to filter only the rows where the length of the name is strictly inferior to 5, or "id >= 1000 and id < 2000 order by name limit 50" to filter only the rows where the id is between 1000 and 2000, ordered by name and limited to 50 rows.
Note about column names: real column names can be used (double quoted if necessary), but columns can also be named "_<column number>" with column numbers starting at 1.
Note that any previous filter expression is replaced with the new filter_expr if no error occurs (if an error occurs, then any previous filter is left unchanged).
filter_expr | An SQL based expression which will filter the contents of proxy, or 0 to remove any previous filter. |
true
if no error occurred. int Gnome::Gda::DataProxy::get_filtered_n_rows | ( | ) |
Get the total number of filtered rows in proxy if a filter has been applied.
As new rows (rows added to the proxy and not yet added to the proxied data model) and rows to remove (rows marked for removal but not yet removed from the proxied data model) are also filtered, the returned number also contains references to new rows and rows to be removed.
int Gnome::Gda::DataProxy::get_n_modified_rows | ( | ) | const |
Get the number of rows which have been modified in the proxy (the sum of rows existing in the proxied data model which have been modified, and new rows).
int Gnome::Gda::DataProxy::get_n_new_rows | ( | ) | const |
Get the number of rows which have been added to proxy and which are not part of the proxied data model.
Glib::RefPtr<DataModel> Gnome::Gda::DataProxy::get_proxied_model | ( | ) |
Fetch the Gda::DataModel which proxy does proxy.
Glib::RefPtr<const DataModel> Gnome::Gda::DataProxy::get_proxied_model | ( | ) | const |
Fetch the Gda::DataModel which proxy does proxy.
int Gnome::Gda::DataProxy::get_proxied_model_n_cols | ( | ) | const |
Get the number of columns in the proxied data model.
int Gnome::Gda::DataProxy::get_proxied_model_n_rows | ( | ) | const |
Get the number of rows in the proxied data model.
int Gnome::Gda::DataProxy::get_proxied_model_row | ( | int | proxy_row ) | const |
Get the proxy's proxied model row corresponding to proxy_row.
proxy_row | A proxy row number. |
int Gnome::Gda::DataProxy::get_sample_end | ( | ) | const |
Get the number of the last row to be available in proxy (in reference to the proxied data model)
int Gnome::Gda::DataProxy::get_sample_size | ( | ) | const |
Get the size of each chunk of data displayed at a time.
int Gnome::Gda::DataProxy::get_sample_start | ( | ) | const |
Get the number of the first row to be available in proxy (in reference to the proxied data model)
ValueAttribute Gnome::Gda::DataProxy::get_value_attributes | ( | int | proxy_row, |
int | col | ||
) | const |
Get the attributes of the value stored at (proxy_row, col) in proxy, which is an ORed value of Gda::ValueAttribute flags.
proxy_row | A proxy row. |
col | A valid proxy column. |
ValueSList Gnome::Gda::DataProxy::get_values | ( | int | proxy_row, |
const Glib::ArrayHandle< int > & | cols_index | ||
) | const |
Retrieve a whole list of values from the proxy data model.
This function calls gda_data_proxy_get_value() for each column index specified in cols_index, and generates a SList on the way.
proxy_row | A proxy row. |
cols_index | Array containing the columns for which the values are requested. |
n_cols | Size of cols_index. |
0
if an error occurred. const GdaDataProxy* Gnome::Gda::DataProxy::gobj | ( | ) | const [inline] |
Provides access to the underlying C GObject.
Reimplemented from Gnome::Gda::DataModel.
GdaDataProxy* Gnome::Gda::DataProxy::gobj | ( | ) | [inline] |
Provides access to the underlying C GObject.
Reimplemented from Gnome::Gda::DataModel.
GdaDataProxy* Gnome::Gda::DataProxy::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
bool Gnome::Gda::DataProxy::has_changed | ( | ) | const |
Tells if proxy contains any modifications not applied to the proxied data model.
true
if there are some modifications in proxy. bool Gnome::Gda::DataProxy::is_read_only | ( | ) | const |
true
if the proxied data model is itself read-only. virtual void Gnome::Gda::DataProxy::on_row_changes_applied | ( | int | row, |
int | proxied_row | ||
) | [protected, virtual] |
virtual void Gnome::Gda::DataProxy::on_row_delete_changed | ( | int | row, |
bool | to_be_deleted | ||
) | [protected, virtual] |
virtual void Gnome::Gda::DataProxy::on_sample_changed | ( | int | sample_start, |
int | sample_end | ||
) | [protected, virtual] |
virtual void Gnome::Gda::DataProxy::on_sample_size_changed | ( | int | sample_size ) | [protected, virtual] |
Glib::PropertyProxy<bool> Gnome::Gda::DataProxy::property_defer_sync | ( | ) |
Tells if changes to the sample of rows displayed is done in background in several steps or if it's done in one step.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<bool> Gnome::Gda::DataProxy::property_defer_sync | ( | ) | const |
Tells if changes to the sample of rows displayed is done in background in several steps or if it's done in one step.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy< Glib::RefPtr<DataModel> > Gnome::Gda::DataProxy::property_model | ( | ) |
Proxied data model.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<DataModel> > Gnome::Gda::DataProxy::property_model | ( | ) | const |
Proxied data model.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<bool> Gnome::Gda::DataProxy::property_prepend_null_entry | ( | ) | const |
Tells if a row composed of NULL values is inserted as the proxy's first row.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<bool> Gnome::Gda::DataProxy::property_prepend_null_entry | ( | ) |
Tells if a row composed of NULL values is inserted as the proxy's first row.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<int> Gnome::Gda::DataProxy::property_sample_size | ( | ) |
Number of rows which the proxy will contain at any time, like a sliding window on the proxied data model.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<int> Gnome::Gda::DataProxy::property_sample_size | ( | ) | const |
Number of rows which the proxy will contain at any time, like a sliding window on the proxied data model.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
bool Gnome::Gda::DataProxy::row_has_changed | ( | int | proxy_row ) | const |
Tells if the row number proxy_row has changed.
proxy_row | A proxy row number. |
true
if the row has changed. bool Gnome::Gda::DataProxy::row_is_deleted | ( | int | proxy_row ) | const |
Tells if the row number proxy_row is marked to be deleted.
proxy_row | A proxy row number. |
true
if the row is marked to be deleted. bool Gnome::Gda::DataProxy::row_is_inserted | ( | int | proxy_row ) | const |
Tells if the row number proxy_row is a row which has been inserted in proxy (and is thus not in the proxied data model).
proxy_row | A proxy row number. |
true
if the row is an inserted row. void Gnome::Gda::DataProxy::set_ordering_column | ( | int | col ) |
Orders by the col column.
col | The column number to order from. |
true
if no error occurred. void Gnome::Gda::DataProxy::set_sample_size | ( | int | sample_size ) |
Sets the size of each chunk of data to display: the maximum number of rows which can be "displayed" at a time (the maximum number of rows which proxy pretends to have).
The default value is arbitrary 300 as it is big enough to be able to display quite a lot of data, but small enough to avoid too much data displayed at the same time.
To remove the chunking of the data to display, simply pass sample_size the 0 value.
sample_size | The requested size of a chunk, or 0. |
void Gnome::Gda::DataProxy::set_sample_start | ( | int | sample_start ) |
Sets the number of the first row to be available in proxy (in reference to the proxied data model)
sample_start | The number of the first row to be displayed. |
Glib::SignalProxy0< void > Gnome::Gda::DataProxy::signal_filter_changed | ( | ) |
void on_my_filter_changed()
Glib::SignalProxy2< void,int,int > Gnome::Gda::DataProxy::signal_row_changes_applied | ( | ) |
void on_my_row_changes_applied(int row, int proxied_row)
Glib::SignalProxy2< void,int,bool > Gnome::Gda::DataProxy::signal_row_delete_changed | ( | ) |
void on_my_row_delete_changed(int row, bool to_be_deleted)
Glib::SignalProxy2< void,int,int > Gnome::Gda::DataProxy::signal_sample_changed | ( | ) |
void on_my_sample_changed(int sample_start, int sample_end)
Glib::SignalProxy1< void,int > Gnome::Gda::DataProxy::signal_sample_size_changed | ( | ) |
void on_my_sample_size_changed(int sample_size)
Glib::SignalProxy2< Glib::Error,int,int > Gnome::Gda::DataProxy::signal_validate_row_changes | ( | ) |
Glib::Error on_my_validate_row_changes(int row, int proxied_row)
void Gnome::Gda::DataProxy::unerase | ( | int | proxy_row ) |
Remove the "to be deleted" mark at the row proxy_row, if it existed.
proxy_row | A proxy row number. |
Glib::RefPtr< Gnome::Gda::DataProxy > wrap | ( | GdaDataProxy * | object, |
bool | take_copy = false |
||
) | [related] |
A Glib::wrap() method for this object.
object | The C instance. |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |