rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Data Access Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IliModel Class Reference

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

List of all members.

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.
virtual void defineProperties ()
 Called to define the list of properties.
virtual const char * getLabel () const =0
 Returns the model label, it is used by the gadget inspector.
virtual const char * getMappingInspectorModelName () const
 Returns the mapping inspector model name.
virtual const char * getName () const
 Returns the model name.
IlInt getPropertyCount () const
 Returns the property count.
IlInt getPropertyIndex (const char *name) const
 Returns a property index.
const char * getPropertyName (IlInt index) const
 Returns a property name.
const IliValuegetPropertyValue (IlInt index) const
 Returns a property value.
const IliValuegetPropertyValue (const char *name) const
 Returns a property value.
virtual IlBoolean isPublic () const
 Returns the model visibility.
void setPropertyValue (IlInt index, const IliValue &val)
 Sets a property value.
void setPropertyValue (const char *name, const IliValue &val)
 Sets a property value.

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:
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.
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, IliMappingInspectorModel, and IliGadgetModel.

IlInt IliModel::getPropertyCount (  )  const

Returns the property count.

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

Returns a property index.

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

Returns a property name.

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

Returns a property value.

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

Returns a property value.

Parameters:
name The property name.
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 ( IlInt  index,
const IliValue val 
)

Sets a property value.

Parameters:
index The property index.
val The value.
void IliModel::setPropertyValue ( const char *  name,
const IliValue val 
)

Sets a property value.

Parameters:
name The property name.
val The value.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright 2012, 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.