rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Prototypes Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvGroupMediator Class Reference

Mediator between a 'Business Graphic Object' and its corresponding object in the application. More...

#include <ilviews/protos/grouplin.h>

Inheritance diagram for IlvGroupMediator:
IlvAccessible IlvProtoMediator

List of all members.

Public Member Functions

 IlvGroupMediator (IlvGroup *presentation, IlAny object=0)
 Links an object of the application domain with its representation.
IlBoolean changeValue (const IlvValue &val)
 Changes the object's value. Both the name and the new value are contained in val.
IlBoolean changeValues (const IlvValue *values, IlUShort count)
 Updates the object when the user has changed the presentation.
void getAccessors (const IlSymbol *const **, const IlvValueTypeClass *const **, IlUInt &) const
 Returns the names of all the accessors known by this object.
const char * getName () const
 Returns the object name.
IlAny getObject () const
 Returns the object linked to the current presentation.
IlvGroupgetPresentation () const
 Returns the presentation currently linked to the object.
void lock ()
 Locks the mediator.
IlBoolean locked ()
 Guard against update loops that could occur if the representation attribute does not match the attribute of the object it represents.
IlvValuequeryValue (IlvValue &val) const
 Queries the value designated by value from the object. Both the value and the value type are stored in value.
void queryValues (IlvValue *values, IlUShort count) const
 Updates the presentation from the object values.
virtual void setObject (IlAny arg, IlBoolean refresh=IlTrue)
 Sets the object to link to the presentation.
virtual void setPresentation (IlvGroup *group, IlBoolean refresh=IlTrue)
 Sets the presentation that will allow the user to edit the object.
void unlock ()
 Releases the lock.
virtual void update (const IlSymbol *const *symbs=0, IlUInt count=0)
 Synchronizes the presentation with the object values.

Detailed Description

Mediator between a 'Business Graphic Object' and its corresponding object in the application.

Library: ilvproto

The IlvGroupMediator class allows you to link an application object to its corresponding presentation in a graphical user interface (GUI). The presentation is implemented as an IlvGroup. This class reads the values exported from the group and keeps synchronized its object and the group implementing its user interface. Synchronization is used to refer to the following:

See the samples in the Views directory: samples/protos/inspector

See also:
IlvGroup

Constructor & Destructor Documentation

IlvGroupMediator::IlvGroupMediator ( IlvGroup presentation,
IlAny  object = 0 
)

Links an object of the application domain with its representation.

Creates an instance of IlvGroupMediator by linking its presentation with its object. presentation implements the presentation under the form of an IlvGroup while object is an object of the application domain.

Parameters:
presentation A group that implements the visual appearance of an object. This group will usually require attributes that match the attributes of its attached object.
object Any reference to an applicative object that must be presented to the user.
object A reference to any kind of object of the application represented by the presentation.

Member Function Documentation

IlBoolean IlvGroupMediator::changeValue ( const IlvValue v  )  [virtual]

Changes the object's value. Both the name and the new value are contained in val.

Parameters:
v The value to be set (both name and value).
Returns:
Whether the object considered the operation successful or not.

Reimplemented from IlvAccessible.

IlBoolean IlvGroupMediator::changeValues ( const IlvValue values,
IlUShort  count 
) [virtual]

Updates the object when the user has changed the presentation.

This method must be overloaded. The implementation should read the values changed, update the internal state of the object to reflect these new values, and propagate these changes to other potential observers of the object. This method should start with if(locked()) return IlTrue; to avoid possible feedback loops between the object and its representation. You may also want to use the lock method to lock the IlvGroupMediator class before propagating the changes, and then use the unlock method when you have finished (to avoid unnecessary updates of the presentation).

Parameters:
values Values that have changed in the IlvGroup and should be reflected in the application object.
count Number of values.
Returns:
IlTrue if the change was successful.

Reimplemented from IlvAccessible.

void IlvGroupMediator::getAccessors ( const IlSymbol *const **  a,
const IlvValueTypeClass *const **  t,
IlUInt c 
) const [virtual]

Returns the names of all the accessors known by this object.

Subclasses of IlvAccessible must override this method by calling the static method DeclareAccessor for each accessor handled by the subclass. The returned arrays are filled by the method and must not be freed.

Parameters:
a Pointer to an array filled on return with the names of the accessors defined for the object.
t Pointer to an array filled on return with the type of each accessor.
c Number of accessors, set by the method.

Implements IlvAccessible.

const char* IlvGroupMediator::getName (  )  const [virtual]

Returns the object name.

Returns:
The object name. This pointer must not be freed.

Implements IlvAccessible.

IlAny IlvGroupMediator::getObject (  )  const

Returns the object linked to the current presentation.

Returns:
The object linked to the current presentation.
See also:
setObject.
IlvGroup* IlvGroupMediator::getPresentation (  )  const

Returns the presentation currently linked to the object.

Returns:
The presentation currently linked to the object.
void IlvGroupMediator::lock (  ) 

Locks the mediator.

Locks the IlvGroupMediator so that further changes will not be propagated to the object. This avoids infinite update loops between the object and its representation.

IlBoolean IlvGroupMediator::locked (  ) 

Guard against update loops that could occur if the representation attribute does not match the attribute of the object it represents.

Returns:
IlTrue if the lock on the object has been set. This implies that changes are not propagated to the object or the group.
IlvValue& IlvGroupMediator::queryValue ( IlvValue value  )  const [virtual]

Queries the value designated by value from the object. Both the value and the value type are stored in value.

Parameters:
value The queried value name.
Returns:
The value passed in argument, set to the object value.

Reimplemented from IlvAccessible.

void IlvGroupMediator::queryValues ( IlvValue values,
IlUShort  count 
) const [virtual]

Updates the presentation from the object values.

This method must be overloaded. The implementation should fill the values array with values representing the internal state of the object.

Parameters:
values Values to be changed in the IlvGroup.
count Number of values.

Reimplemented from IlvAccessible.

virtual void IlvGroupMediator::setObject ( IlAny  arg,
IlBoolean  refresh = IlTrue 
) [virtual]

Sets the object to link to the presentation.

Parameters:
arg The object that is linked to the presentation.
refresh Can be set to IlFalse if you don't want an immediate refresh.
virtual void IlvGroupMediator::setPresentation ( IlvGroup group,
IlBoolean  refresh = IlTrue 
) [virtual]

Sets the presentation that will allow the user to edit the object.

Parameters:
group The presentation that is linked to this object.
refresh Can be set to IlFalse if you don't want an immediate refresh.

Reimplemented in IlvProtoMediator.

void IlvGroupMediator::unlock (  ) 

Releases the lock.

Releases the lock on the object, allowing further changes to be propagated.

virtual void IlvGroupMediator::update ( const IlSymbol *const *  symbs = 0,
IlUInt  count = 0 
) [virtual]

Synchronizes the presentation with the object values.

Use this method whenever the object is changed from the application and the presentation is to be updated to reflect these changes. The optional list of symbols indicates what attributes have changed. It can be used to minimize refreshes of the representation.

Parameters:
symbs Array of attribute names that should be queried from the object and changed in the group serving as presentation. If symbs is NULL, all attributes that are notifying in the IlvGroup are queried from the object and changed in the presentation.
count Size of the symbs array.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

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