Rogue Wave Views Data Access Package API Reference Guide |
Rogue Wave Views Documentation Home |
Model class. More...
#include <ilviews/dataccess/gadgets/gdtmodel.h>
Public Member Functions | |
IliModel () | |
The constructor initializes a new IliModel instance. | |
IlInt | declareProperty (const IliDatatype *typ, const char *name, const char *title, IlBoolean pub) |
Declares a new property. More... | |
virtual void | defineProperties () |
Called to define the list of properties. More... | |
virtual const char * | getLabel () const =0 |
Returns the model label, it is used by the gadget inspector. More... | |
virtual const char * | getMappingInspectorModelName () const |
Returns the mapping inspector model name. More... | |
virtual const char * | getName () const |
Returns the model name. More... | |
IlInt | getPropertyCount () const |
Returns the property count. More... | |
IlInt | getPropertyIndex (const char *name) const |
Returns a property index. More... | |
const char * | getPropertyName (IlInt index) const |
Returns a property name. More... | |
const IliValue & | getPropertyValue (const char *name) const |
Returns a property value. More... | |
const IliValue & | getPropertyValue (IlInt index) const |
Returns a property value. More... | |
virtual IlBoolean | isPublic () const |
Returns the model visibility. More... | |
void | setPropertyValue (const char *name, const IliValue &val) |
Sets a property value. More... | |
void | setPropertyValue (IlInt index, const IliValue &val) |
Sets a property value. More... | |
Model class.
Library: dbgadget
The class IliModel
defines the interface for all models. A model class is used to associate a behavior to an event. The models are used by the gadgets to execute a specific task. A gadgets can use several models to work. For example, the tree gadget uses: a model to extract the data from data source and a model to build the popup menu when the user click on tree item with the mouse right button. For each basic behavior, there is a model class with its specific virtual functions and all these model classes inherit from the IliModel
class.
Each model class can have a list of properties. A properties is a couple name - value (with a type). The properties are persistent data (there is an automatic system of read/write for model properties).
When you define a model class, you must use the macro IliDeclareModel
into the header file and the macro IliDefineCodeModel into your source file. The constructor of your model class has no argument.
For example:
Header file
Source file
IlInt IliModel::declareProperty | ( | const IliDatatype * | typ, |
const char * | name, | ||
const char * | title, | ||
IlBoolean | pub | ||
) |
Declares a new property.
Each property has a name, a value (with a type), a title which is used by the gadget inspector and a flag to indicate if the property is public. A property is public if the gadget inspector can display this property (some gadget inspectors can not display the public properties, it is not a bug but a future for the next version).
typ | It is the property value type. |
name | It is the property name. |
title | It is the property title. |
pub | The parameter value is IlTrue if the property is public otherwise it is IlFalse . |
-1
if an error occurs.
|
virtual |
Called to define the list of properties.
To define a property, you should use the declareProperty
function. To set a value, you should use the initializeProperty
function.
|
pure virtual |
Returns the model label, it is used by the gadget inspector.
|
virtual |
Returns the mapping inspector model name.
This model is used to manage the mapping definition gadget into the gadget inspector.
|
virtual |
Returns the model name.
Reimplemented in IliDbGanttModel, IliGadgetModel, and IliMappingInspectorModel.
IlInt IliModel::getPropertyCount | ( | ) | const |
Returns the property count.
IlInt IliModel::getPropertyIndex | ( | const char * | name | ) | const |
Returns a property index.
name | The property name. |
-1
. const char* IliModel::getPropertyName | ( | IlInt | index | ) | const |
Returns a property name.
index | The property index. |
0
. const IliValue& IliModel::getPropertyValue | ( | const char * | name | ) | const |
Returns a property value.
name | The property name. |
null
value. Returns a property value.
index | The property index. |
null
value.
|
virtual |
Returns the model visibility.
IlTrue
if the model can be displayed by the gadget inspector, the default value is IlTrue
. void IliModel::setPropertyValue | ( | const char * | name, |
const IliValue & | val | ||
) |
Sets a property value.
name | The property name. |
val | The value. |
© Copyright 2016, 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.