libgdamm Reference Documentation
Main Page   Namespaces   Book  

Gnome::Gda::DataProxy Class Reference
[Data Models]

Proxy to hold modifications for any DataModel, providing the DataModel interface itself. More...

Inheritance diagram for Gnome::Gda::DataProxy:

Inheritance graph
[legend]
List of all members.

Public Member Functions

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.
bool apply_all_changes ()
 Apply all the changes stored in the proxy to the proxied data model.
void apply_row_changes (int proxy_row)
 Commits the modified data in the proxy back into the Gda::DataModel.
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).
void cancel_row_changes (int proxy_row, int col)
 Resets data at the corresponding row and column.
void erase (int proxy_row)
 Marks the row proxy_row to be deleted.
int find_row_from_values (const ValueSList& values, const Glib::ArrayHandle<int>& cols_index) const
 Find the first row where all the values in values at the columns identified at cols_index match.
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).
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.
Glib::RefPtr<const DataModelget_proxied_model () const
 Fetch the Gda::DataModel which proxy does proxy.
Glib::RefPtr<DataModelget_proxied_model ()
 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.
int get_proxied_model_row (int proxy_row) const
 Get the proxy's proxied model row corresponding to proxy_row.
int get_sample_end () const
 Get the row number of the last row to be displayed.
int get_sample_size () const
 Get the size of each chunk of data displayed at a time.
int get_sample_start () const
 Get the row number of the first row to be displayed.
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.
ValueSList get_values (int proxy_row, const Glib::ArrayHandle<int>& cols_index) const
const GdaDataProxy* gobj () const
 Provides access to the underlying C GObject.
GdaDataProxy* gobj ()
 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.
bool has_changed () const
 Tells if proxy contains any modifications not applied to the proxied data model.
bool is_read_only () const
 
Returns:
true if the proxied data model is itself read-only.

Glib::PropertyProxy_ReadOnly<
Glib::RefPtr<DataModel >> 
property_model () const
 You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy< Glib::RefPtr<
DataModel > > 
property_model ()
 You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<
bool > 
property_prepend_null_entry () const
 You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<bool> property_prepend_null_entry ()
 You rarely need to use properties because there are get_ and set_ methods for almost all of them.
bool row_has_changed (int proxy_row) const
 Tells if the row number proxy_row has changed.
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 set_sample_size (int sample_size)
 Sets the size of each chunck of fata to display: the maximum number of rows which can be displayed at a time.
void set_sample_start (int sample_start)
 Sets the number of the first row to be displayed.
Glib::SignalProxy2< void,
int, int > 
signal_post_changes_applied ()
 
Prototype:
void on_my_post_changes_applied(int row, int proxied_row)

Glib::SignalProxy2< bool,
int, int > 
signal_pre_changes_applied ()
 
Prototype:
bool on_my_pre_changes_applied(int row, int proxied_row)

Glib::SignalProxy2< void,
int, bool > 
signal_row_delete_changed ()
 
Prototype:
void on_my_row_delete_changed(int row, bool to_be_deleted)

Glib::SignalProxy2< void,
int, int > 
signal_sample_changed ()
 
Prototype:
void on_my_sample_changed(int sample_start, int sample_end)

Glib::SignalProxy1< void,
int > 
signal_sample_size_changed ()
 
Prototype:
void on_my_sample_size_changed(int sample_size)

void unerase (int proxy_row)
 Remove the "to be deleted" mark at the row proxy_row, if it existed.
virtual ~DataProxy ()

Static Public Member Functions

static Glib::RefPtr<DataProxycreate (const Glib::RefPtr<DataModel>& model)

Protected Member Functions

 DataProxy (const Glib::RefPtr<DataModel>& model)
virtual void on_post_changes_applied (int row, int proxied_row)
virtual bool on_pre_changes_applied (int row, int proxied_row)
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)

Related Functions

(Note that these are not member functions.)

Glib::RefPtr<Gnome::Gda::DataProxywrap (GdaDataProxy* object, bool take_copy=false)
 A Glib::wrap() method for this object.

Detailed Description

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.


Constructor & Destructor Documentation

virtual Gnome::Gda::DataProxy::~DataProxy (  )  [virtual]

Gnome::Gda::DataProxy::DataProxy ( const Glib::RefPtr<DataModel>&  model  )  [explicit, protected]


Member Function Documentation

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).

Parameters:
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.

Returns:
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.

Parameters:
proxy_row The row number to commit.
Returns:
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).

Returns:
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.

Parameters:
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.

Parameters:
proxy_row A proxy row number.

int Gnome::Gda::DataProxy::find_row_from_values ( const ValueSList values,
const Glib::ArrayHandle< int > &  cols_index 
) const

Find the first row where all the values in values at the columns identified at cols_index match.

NOTE: the cols_index array MUST contain a column index for each value in values

Parameters:
values A list of Value values.
cols_index An array of int containing the column number to match each value of values.
Returns:
Proxy row number if the row has been identified, or -1 otherwise.

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).

Returns:
The number of modified 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.

Returns:
The number of new rows.

Glib::RefPtr<const DataModel> Gnome::Gda::DataProxy::get_proxied_model (  )  const

Fetch the Gda::DataModel which proxy does proxy.

Returns:
The proxied data model.

Glib::RefPtr<DataModel> Gnome::Gda::DataProxy::get_proxied_model (  ) 

Fetch the Gda::DataModel which proxy does proxy.

Returns:
The proxied data model.

int Gnome::Gda::DataProxy::get_proxied_model_n_cols (  )  const

Get the number of columns in the proxied data model.

Returns:
The number of columns, or -1 if an error occurred.

int Gnome::Gda::DataProxy::get_proxied_model_n_rows (  )  const

Get the number of rows in the proxied data model.

Returns:
The number of rows, or -1 if the number of rows is not known.

int Gnome::Gda::DataProxy::get_proxied_model_row ( int  proxy_row  )  const

Get the proxy's proxied model row corresponding to proxy_row.

Parameters:
proxy_row A proxy row number.
Returns:
The proxied model's row, or -1 if proxy row which only exists proxy.

int Gnome::Gda::DataProxy::get_sample_end (  )  const

Get the row number of the last row to be displayed.

Returns:
The number of the last row being displayed.

int Gnome::Gda::DataProxy::get_sample_size (  )  const

Get the size of each chunk of data displayed at a time.

Returns:
The chunck (or sample) size, or 0 if chunking is disabled.

int Gnome::Gda::DataProxy::get_sample_start (  )  const

Get the row number of the first row to be displayed.

Returns:
The number of the first row being displayed.

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.

Parameters:
proxy_row A proxy row.
col A valid proxy column.
Returns:
The attribute.

ValueSList Gnome::Gda::DataProxy::get_values ( int  proxy_row,
const Glib::ArrayHandle< int > &  cols_index 
) const

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.

Reimplemented from Gnome::Gda::Object.

bool Gnome::Gda::DataProxy::has_changed (  )  const

Tells if proxy contains any modifications not applied to the proxied data model.

Returns:
true if there are some modifications in proxy.

bool Gnome::Gda::DataProxy::is_read_only (  )  const

Returns:
true if the proxied data model is itself read-only.

virtual void Gnome::Gda::DataProxy::on_post_changes_applied ( int  row,
int  proxied_row 
) [protected, virtual]

virtual bool Gnome::Gda::DataProxy::on_pre_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_ReadOnly<Glib::RefPtr<DataModel>> Gnome::Gda::DataProxy::property_model (  )  const

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Glib::RefPtr<DataModel>> Gnome::Gda::DataProxy::property_model (  ) 

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gnome::Gda::DataProxy::property_prepend_null_entry (  )  const

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gnome::Gda::DataProxy::property_prepend_null_entry (  ) 

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

bool Gnome::Gda::DataProxy::row_has_changed ( int  proxy_row  )  const

Tells if the row number proxy_row has changed.

Parameters:
proxy_row A proxy row number.

bool Gnome::Gda::DataProxy::row_is_deleted ( int  proxy_row  )  const

Tells if the row number proxy_row is marked to be deleted.

Parameters:
proxy_row A proxy row number.
Returns:
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).

Parameters:
proxy_row A proxy row number.
Returns:
true if the row is an inserted row.

void Gnome::Gda::DataProxy::set_sample_size ( int  sample_size  ) 

Sets the size of each chunck of fata to display: the maximum number of rows which can be displayed at a time.

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.

Note:
the rows which have been added but not yet commited will always be displayed regardless of the current chunck of data, and the modified rows which are not visible when the displayed chunck of data changes are still held as modified rows.
To remove the chuncking of the data to display, simply pass sample_size the 0 value.
Parameters:
sample_size The requested size of a chunck, or 0.

void Gnome::Gda::DataProxy::set_sample_start ( int  sample_start  ) 

Sets the number of the first row to be displayed.

Parameters:
sample_start The number of the first row to be displayed.

Glib::SignalProxy2< void,int,int > Gnome::Gda::DataProxy::signal_post_changes_applied (  ) 

Prototype:
void on_my_post_changes_applied(int row, int proxied_row)

Glib::SignalProxy2< bool,int,int > Gnome::Gda::DataProxy::signal_pre_changes_applied (  ) 

Prototype:
bool on_my_pre_changes_applied(int row, int proxied_row)

Glib::SignalProxy2< void,int,bool > Gnome::Gda::DataProxy::signal_row_delete_changed (  ) 

Prototype:
void on_my_row_delete_changed(int row, bool to_be_deleted)

Glib::SignalProxy2< void,int,int > Gnome::Gda::DataProxy::signal_sample_changed (  ) 

Prototype:
void on_my_sample_changed(int sample_start, int sample_end)

Glib::SignalProxy1< void,int > Gnome::Gda::DataProxy::signal_sample_size_changed (  ) 

Prototype:
void on_my_sample_size_changed(int sample_size)

void Gnome::Gda::DataProxy::unerase ( int  proxy_row  ) 

Remove the "to be deleted" mark at the row proxy_row, if it existed.

Parameters:
proxy_row A proxy row number.


Friends And Related Function Documentation

Glib::RefPtr<Gnome::Gda::DataProxy> wrap ( GdaDataProxy *  object,
bool  take_copy = false 
) [related]

A Glib::wrap() method for this object.

Parameters:
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.
Returns:
A C++ instance that wraps this C instance.


The documentation for this class was generated from the following file:
Generated for libgdamm by Doxygen 1.5.1 © 1997-2001