rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Prototypes Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

List of all members | Public Member Functions
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

Public Member Functions

 IlvGroupMediator (IlvGroup *presentation, IlAny object=0)
 Links an object of the application domain with its representation. More...
 
IlBoolean changeValue (const IlvValue &val)
 Changes the object's value. Both the name and the new value are contained in val. More...
 
IlBoolean changeValues (const IlvValue *values, IlUShort count)
 Updates the object when the user has changed the presentation. More...
 
void getAccessors (const IlSymbol *const **, const IlvValueTypeClass *const **, IlUInt &) const
 Returns the names of all the accessors known by this object. More...
 
const char * getName () const
 Returns the object name. More...
 
IlAny getObject () const
 Returns the object linked to the current presentation. More...
 
IlvGroupgetPresentation () const
 Returns the presentation currently linked to the object. More...
 
void lock ()
 Locks the mediator. More...
 
IlBoolean locked ()
 Guard against update loops that could occur if the representation attribute does not match the attribute of the object it represents. More...
 
IlvValuequeryValue (IlvValue &val) const
 Queries the value designated by value from the object. Both the value and the value type are stored in value. More...
 
void queryValues (IlvValue *values, IlUShort count) const
 Updates the presentation from the object values. More...
 
virtual void setObject (IlAny arg, IlBoolean refresh=IlTrue)
 Sets the object to link to the presentation. More...
 
virtual void setPresentation (IlvGroup *group, IlBoolean refresh=IlTrue)
 Sets the presentation that will allow the user to edit the object. More...
 
void unlock ()
 Releases the lock. More...
 
virtual void update (const IlSymbol *const *symbs=0, IlUInt count=0)
 Synchronizes the presentation with the object values. More...
 
- Public Member Functions inherited from IlvAccessible
virtual IlUInt compareAllValues (const IlvAccessible *ref, IlvValueArray &diffs, IlBoolean any=IlFalse) const
 Compares two objects and returns the differing attributes. More...
 
virtual IlUInt compareValues (const IlvAccessible *ref, IlvValue *values, IlUShort count, IlvValueArray &diffs) const
 Compares two objects and returns the differing attributes. More...
 
virtual IlBoolean convertValues (IlvValue *v, IlUShort c, IlvDisplay *d) const
 Convert values to match the types defined by the object accessors. More...
 
IlUInt getSubscriptions (IlvAccessible *subscriber, IlSymbol **&sourceValue, IlSymbol **&subscriberValue, IlvValueTypeClass **&type, IlvValueSubscriptionMode *&mode, IlvAccessible ***subscribers=0) const
 Returns alls subscriptions made by subscriber. More...
 
virtual const IlvValueTypeClassgetValueType (const IlSymbol *s) const
 Returns the type of a given attribute. More...
 
virtual IlBoolean isOutputValue (const IlSymbol *value) const
 Indicates whether value designates an accessor that can generate notifying values. More...
 
virtual IlvValuepullValue (IlvValue &v) const
 See below.
 
virtual void pullValues (IlvValue *vals, IlUShort c) const
 Propagates value queries to the subscribers to this object. More...
 
virtual IlBoolean pushValue (const IlvValue &v) const
 See below.
 
virtual IlBoolean pushValues (const IlvValue *vals, IlUShort c) const
 Propagates value changes to the subscribers to this object. More...
 
virtual void subscribe (IlvAccessible *subscriber, IlSymbol *sourceValue, IlSymbol *subscriberValue, IlvValueTypeClass *type, IlvValueSubscriptionMode mode=IlvValueSubscriptionChange)
 Subscribes the subscriber object to the value sourceValue of this object. More...
 
virtual void unSubscribe (IlvAccessible *subscriber, IlSymbol *sourceValue=0, IlSymbol *subscriberValue=0)
 Cancels subscriptions previously made. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from IlvAccessible
static void DeclareAccessor (const IlSymbol *attr, IlvValueTypeClass *type, const IlSymbol *const **accessors, const IlvValueTypeClass *const **types, IlUInt &count, IlBoolean checkDuplicates=IlFalse, IlAny accessorList=0)
 
static const IlvValueTypeClassGetType (IlSymbol *name)
 Returns the type instance from a name. More...
 
static IlBoolean StringToValue (const char *s, IlSymbol *type, IlvValue &v, IlvDisplay *display)
 Converts the character string s to an IlvValue with the type type. More...
 
static IlBoolean StringToValue (const char *s, const IlvValueTypeClass *typeClass, IlvValue &v, IlvDisplay *d)
 Converts the character string s to an IlvValue with the type type. More...
 
static IlBoolean ValuesAreEqual (IlvValue &v1, IlvValue &v2, IlBoolean compareNames=IlTrue)
 Compares two values. More...
 

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
presentationA group that implements the visual appearance of an object. This group will usually require attributes that match the attributes of its attached object.
objectAny reference to an applicative object that must be presented to the user.
objectA 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
vThe 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
valuesValues that have changed in the IlvGroup and should be reflected in the application object.
countNumber 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
aPointer to an array filled on return with the names of the accessors defined for the object.
tPointer to an array filled on return with the type of each accessor.
cNumber 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
valueThe 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
valuesValues to be changed in the IlvGroup.
countNumber of values.

Reimplemented from IlvAccessible.

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

Sets the object to link to the presentation.

Parameters
argThe object that is linked to the presentation.
refreshCan 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
groupThe presentation that is linked to this object.
refreshCan 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
symbsArray 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.
countSize of the symbs array.

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