rwlogo

Rogue Wave Views
Data Access Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

 All Classes Files Functions Variables Typedefs Enumerations Enumerator
List of all members | Public Member Functions
IliModel Class Referenceabstract

Model class. More...

#include <ilviews/dataccess/gadgets/gdtmodel.h>

Inheritance diagram for IliModel:
IliChartSeriesModel IliDbTreeItemDialogModel IliDbTreePopupMenuModel IliGadgetModel IliMappingInspectorModel IliXMLModel IliChartDataModel IliDbGanttModel IliXMLDocumentModel IliXMLStreamModel IliDbGanttFullModel IliDbGanttLightModel IliXMLExportModel IliXMLImportModel

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 IliValuegetPropertyValue (const char *name) const
 Returns a property value. More...
 
const IliValuegetPropertyValue (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...
 

Detailed Description

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

class MyModel : public IliModel {
public:
MyModel();
~MyModel();
IliDeclareModel();
// The model virtual functions
};

Source file

IliDefineCodeModel(IliModel, MyModel,"My Model");
See Also
IliGadgetModel, IliDbTreeGadget, IliDeclareModel, IliDefineCodeModel

Member Function Documentation

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

Parameters
typIt is the property value type.
nameIt is the property name.
titleIt is the property title.
pubThe parameter value is IlTrue if the property is public otherwise it is IlFalse.
Returns
The property index, return -1 if an error occurs.
virtual void IliModel::defineProperties ( )
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.

virtual const char* IliModel::getLabel ( ) const
pure virtual

Returns the model label, it is used by the gadget inspector.

Returns
The label.
virtual const char* IliModel::getMappingInspectorModelName ( ) const
virtual

Returns the mapping inspector model name.

This model is used to manage the mapping definition gadget into the gadget inspector.

Returns
The model name.
virtual const char* IliModel::getName ( ) const
virtual

Returns the model name.

Returns
The name.

Reimplemented in IliDbGanttModel, IliGadgetModel, and IliMappingInspectorModel.

IlInt IliModel::getPropertyCount ( ) const

Returns the property count.

Returns
The count.
IlInt IliModel::getPropertyIndex ( const char *  name) const

Returns a property index.

Parameters
nameThe property name.
Returns
The index if found, otherwise -1.
const char* IliModel::getPropertyName ( IlInt  index) const

Returns a property name.

Parameters
indexThe property index.
Returns
The name if index valid, otherwise 0.
const IliValue& IliModel::getPropertyValue ( const char *  name) const

Returns a property value.

Parameters
nameThe property name.
Returns
The value if found otherwise a null value.
const IliValue& IliModel::getPropertyValue ( IlInt  index) const

Returns a property value.

Parameters
indexThe property index.
Returns
The value if found otherwise a null value.
virtual IlBoolean IliModel::isPublic ( ) const
virtual

Returns the model visibility.

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

Parameters
nameThe property name.
valThe value.
void IliModel::setPropertyValue ( IlInt  index,
const IliValue val 
)

Sets a property value.

Parameters
indexThe property index.
valThe value.

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