Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Mediator between a 'Business Graphic Object' and its corresponding object in the application. More...
#include <ilviews/protos/grouplin.h>
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. | |
IlvGroup * | getPresentation () 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. | |
IlvValue & | queryValue (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. |
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:
When, through accessors interpreting the user actions, one of the public attributes of the group is changed, the IlvGroupMediator
is notified and updates the object to reflect the changes by calling the changeValues
method.
When the object changes and these changes need to be propagated to the presentation so that the user can see the changes, the IlvGroupMediator
will call its queryValues
method, which updates the values with data corresponding to the internal state of the object.
Finally, whenever attributes change in the object, the application calls the update
method to ensure that the presentation reflects these changes.
See the samples in the Views directory: samples/protos/inspector
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.
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. |
Changes the object's value. Both the name and the new value are contained in val.
v | The value to be set (both name and value). |
Reimplemented from IlvAccessible.
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).
values | Values that have changed in the IlvGroup and should be reflected in the application object. | |
count | Number of values. |
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.
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.
Implements IlvAccessible.
IlAny IlvGroupMediator::getObject | ( | ) | const |
Returns the object linked to the current presentation.
setObject
. IlvGroup* IlvGroupMediator::getPresentation | ( | ) | const |
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.
IlTrue
if the lock on the object has been set. This implies that changes are not propagated to the object or the group. Queries the value designated by value from the object. Both the value and the value type are stored in value.
value | The queried value name. |
Reimplemented from IlvAccessible.
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.
values | Values to be changed in the IlvGroup . | |
count | Number of values. |
Reimplemented from IlvAccessible.
Sets the object to link to the presentation.
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.
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.
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. |
© 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.