This class implements in a component the representations that are associated with each dynamic view in the server. More...
#include <ilserver/rp.h>
Public Member Functions | |
virtual | ~IlsRepresentation () |
Destructor. More... | |
Accessors | |
IlsRepresentationId | getId () const |
Returns the representation identifier. This identifier is unique. More... | |
IlsRpObject * | getObject (IlsRpObjectId id) |
Returns a pointer to the representation object identified by the argument id. More... | |
IlsRpObject ** | getObjects (int &count) |
Returns an array of all Representation Objects stored in this representation. More... | |
unsigned int | getObjectsCount () const |
Returns the size of the Representation Objects array. | |
IlsRpModel & | getModel () const |
Returns a reference to the dynamic representation model associated with the representation. | |
virtual IlsString | getLabel () const |
Returns the dynamic representation label, which is used in trace mode. | |
IlsMvComponent * | getComponent () const |
Returns a pointer to the application component to which the representation belongs. More... | |
Transaction Control from Component to Server | |
virtual void | beginC2STransaction () |
Creates a transaction buffer where modifications performed and/or required by the application component are stored before they are sent to the server. More... | |
virtual void | commitC2STransaction () |
Commits a transaction. More... | |
virtual void | rollbackC2STransaction () |
Rolls back a transaction that applies * to a representation. More... | |
IlsBoolean | isInC2STransaction () |
Returns IlsTrue if the representation is being updated by the component. Otherwise, it returns IlsFalse . | |
Callback on Associated View on the Server Side | |
The following functions are used to handle the origin(s) of the view associated with the representation. | |
virtual void | setMainOrigin (const IlsRpObject *rpObjP, IlsBoolean keepOldOrigin=IlsFalse) |
Requests the server to set the server object associated with the representation object pointed to by the rpObjP argument as the main origin of the view associated with the corresponding representation. More... | |
virtual void | addOrigin (const IlsRpObject &rpObj) |
Requests that the server add the server object associated with the rpObj representation object as an origin of the view associated to the corresponding representation. More... | |
virtual void | removeOrigin (const IlsRpObject &rpObj) |
Requests that the server remove the server object associated with the rpObj representation object as an origin of the view associated with the corresponding representation. More... | |
virtual void | close (IlsBoolean notify) |
Requests that the view associated with the representation be closed. More... | |
Selecting a Representation | |
virtual void | setSelection () |
Called when an already opened view is opened again. More... | |
Buffer Mode | |
virtual void | setBufferMode (IlsBoolean incremental=IlsTrue) |
Sets the represented view in buffer mode. More... | |
virtual void | resetBufferMode (IlsBoolean notify=IlsTrue) |
Resets the buffer-mode state on the represented view. More... | |
Creation Callback | |
virtual void | onCreation (const IlsMvValue *ackArgv, IlsCbArgNb ackArgc) |
Executed by Rogue Wave Server after a new representation has been created. More... | |
Creating and Deleting Representation Objects | |
virtual IlsRpObject * | newRpObject (IlsRepresentation &repres, IlsRpObjModel &model) |
Called to create a new representation object in the representation, based on the model representation object model, if no constructor attachment has been declared for this model. More... | |
virtual void | deleteRpObject (IlsRpObject *obj) |
Called by the server when a representation object must be destroyed. More... | |
Public Member Functions inherited from IlsRpObject | |
virtual void | afterInit () |
Called immediately after an object has been created when a representation object is instantiated by the Server. More... | |
virtual void | onRmRepresentation () |
Called when the representation that owns the representation object is destroyed and invokes in turn the representation object destructor. More... | |
IlsBoolean | setConstAttribute (IlsRpAttributeId) |
Sets the value of a constant attribute for a representation object. More... | |
void | setConstAttributes () |
Sets the value of the constant attributes of a representation object. More... | |
virtual IlsBoolean | setMapping (const IlsRpObject &cousin) |
Associates a new representation object with an existing Server object. More... | |
IlsRpObjectId | getId () const |
Returns the identifier of the representation object. More... | |
IlsRpAttributeId | getAttributeId (const IlsString &label) const |
Returns an attribute identifier from its name. More... | |
IlsRpAttributeId | getAttributeId (const IlsString &label, int index) const |
Returns an indexed attribute identifier from its name and its index. More... | |
IlsMvDataType | getAttributeType (IlsRpAttributeId) const |
Returns the attribute type of a given attribute. More... | |
const IlsRpObjModel * | getModel () const |
Returns a pointer to the runtime representation object model associated with the representation object. More... | |
IlsRepresentation * | getRepresentation () const |
Returns a pointer to the representation that owns the representation object. More... | |
IlsBoolean | isEditable (IlsRpAttributeId id, IlsEditRights::Value right=IlsEditRights::DEFAULT_EDIT) const |
Returns IlsTrue if the attribute id has the editing rights specified by the variable right. | |
IlsBoolean | isLocalHRef (IlsRpAttributeId id) |
Returns IlsTrue if the attribute id is a local hyper-reference – in other words, a hyper-reference that has no associated relation. | |
IlsMvRef | getReference () const |
Returns a reference object that identifies a representation object in the server-to-component protocol. More... | |
virtual void | beginC2SUpdate (IlsRpUpdateType) |
Initializes a set of updates on the representation object. More... | |
void | beginC2SUpdate () |
Initializes a set of updates on the representation object. More... | |
IlsBoolean | isInC2SUpdate () |
Returns IlsTrue between a call to beginC2SUpdate() and a call to either endC2SUpdate() or discardC2SUpdate() . Otherwise, it returns IlsFalse . | |
virtual void | endC2SUpdate () |
Commits updates performed on the representation object. More... | |
virtual void | discardC2SUpdate () |
Discards the modifications currently stored in the representation object update buffer. | |
virtual void | openView (const IlsString &viewName, IlsMvValue *argv=0, IlsCbArgNb argc=0, IlsBoolean force=IlsFalse) |
Requests the server to open the view viewName on the server object associated with its corresponding representation object. More... | |
virtual void | openView (const IlsString &viewName, IlsMvValue *argv, IlsCbArgNb argc, IlsMvValue *ackArgv, IlsCbArgNb ackArgc, IlsCbArgNb resultIndex, IlsBoolean force=IlsFalse) |
Identical to the previous one except that Server executes a call to the representation object function ackOpenView() during the acknowledgment rollback of the transaction that includes the call to openView() . More... | |
virtual void | ackOpenView (const IlsMvValue *ackArgv, IlsCbArgNb ackArgc) |
Called by Server to acknowledge or to roll back a call to the second virtual member function openView() (documented above). More... | |
virtual void | setBoolean (IlsRpAttributeId id, IlsBoolean value) |
Called by the server when the Boolean attribute id has no associated modifier and must be set to value. More... | |
virtual void | setChar (IlsRpAttributeId id, char value) |
Called by the server when the attribute id of type char has no associated modifier and must be set to value. More... | |
virtual void | setShort (IlsRpAttributeId id, short value) |
Called by the server when the id attribute of type short has no associated modifier and must be set to value. More... | |
virtual void | setLong (IlsRpAttributeId id, long value) |
Called by the server when the attribute id of type long has no associated modifier and must be set to value. More... | |
virtual void | setFloat (IlsRpAttributeId id, float value) |
Called by the server when the attribute id of type float has no associated modifier and must be set to value. More... | |
virtual void | setDouble (IlsRpAttributeId id, double value) |
Called by the server when the attribute id of type double has no associated modifier and must be set to value. More... | |
virtual void | setString (IlsRpAttributeId id, const IlsString &value) |
Called by the server when the attribute id of type IlsString has no associated modifier and must be set to value. More... | |
virtual void | setAny (IlsRpAttributeId id, IlsAny value) |
Called by the server when the attribute id of type IlsAny has no associated modifier and must be set to value. More... | |
virtual void | setUserTypeValue (IlsRpAttributeId id, IlsMvUserType &value) |
Called by the server when the attribute id of type IlsMvUserType (or derived) has no associated modifier and must be set to value. More... | |
virtual void | setReference (IlsRpAttributeId id, const IlsRpObject *objectPtr) |
Called by the server when the id attribute has no associated modifier and must reference the object pointed to by objectPtr. More... | |
virtual void | setHRef (IlsRpAttributeId id, const IlsString &hrefLabel) |
called by the server when the label of the hyper-reference id has no associated modifier and must be set to hrefLabel. More... | |
virtual void | onSuppress (IlsBoolean isDestroyed=IlsFalse) |
This member function notifies the object destruction to the server. More... | |
virtual void | setRpStatus (IlsRpStatus) |
Requests modification of the representation status of the server object associated with the representation object in the view to which the representation is attached. | |
virtual IlsBoolean | onUpdate (IlsRpAttributeId id, IlsBoolean value) |
Requests the server to set the IlsBoolean attribute id to value. More... | |
virtual IlsBoolean | onUpdate (IlsRpAttributeId id, char value) |
Requests the server to set the char attribute id to value. More... | |
virtual IlsBoolean | onUpdate (IlsRpAttributeId id, short value) |
Requests the server to set the short attribute id to value. More... | |
virtual IlsBoolean | onUpdate (IlsRpAttributeId id, long value) |
Requests the server to set the long attribute id to value. More... | |
virtual IlsBoolean | onUpdate (IlsRpAttributeId id, float value) |
Requests the server to set the float attribute id to value. More... | |
virtual IlsBoolean | onUpdate (IlsRpAttributeId id, double value) |
Requests the server to set the double attribute id to value. More... | |
virtual IlsBoolean | onUpdate (IlsRpAttributeId id, const IlsString &value) |
Requests the server to set the IlsString attribute id to value. More... | |
virtual IlsBoolean | onUpdate (IlsRpAttributeId id, IlsAny value) |
Requests the server to set the IlsAny attribute id to value. More... | |
virtual IlsBoolean | onUpdate (IlsRpAttributeId id, const IlsMvUserType &value) |
Requests the server to set the IlsMvUserType attribute id to value. More... | |
virtual IlsBoolean | onUpdate (IlsRpAttributeId id, const IlsRpObject &objRef) |
Requests the server to set the attribute id of a reference to another representation object. More... | |
virtual IlsBoolean | onUpdate (IlsRpAttributeId id, const IlsRpObject &newHRefOwner, IlsRpAttributeId newHRef) |
Requests the server to replace the target object of a Server relation with another object. More... | |
virtual IlsBoolean | onNullifyRef (IlsRpAttributeId id) |
Requests the server to reset the reference attribute id to null, so as to notify the server about this modification. More... | |
virtual IlsBoolean | isMatchingRef (IlsRpAttributeId id, const IlsRpObject *newTarget) |
Tests whether the id attribute can be assigned the value of the object pointed to by newTarget . More... | |
virtual IlsBoolean | isMatchingHRef (IlsRpAttributeId id, const IlsRpObject *newHRefOwner, IlsRpAttributeId newHRef) |
Tests whether the id attribute can be assigned the hyper-reference identified by newHRef and belonging to newHRefOwner. More... | |
virtual IlsBoolean | onDereference (IlsRpAttributeId id, IlsMvValue *argv=0, IlsCbArgNb argc=0, IlsBoolean force=IlsFalse) |
Opens a view by dereferencing a hyper-reference (see Hyper-References). More... | |
virtual IlsBoolean | onDereference (IlsRpAttributeId id, IlsMvValue *argv, IlsCbArgNb argc, IlsMvValue *ackArgv, IlsCbArgNb ackArgc, IlsCbArgNb resultIndex, IlsBoolean force=IlsFalse) |
Opens a view by dereferencing a hyper-reference (see Hyper-References) with aknowledgement. More... | |
virtual IlsBoolean | onAddToCollection (const IlsRpObject &collectorOwner, IlsRpAttributeId collectorId) |
Requests the server to set or add a target to a relation (usually a n-ary relation). More... | |
virtual IlsBoolean | onRmFromCollection (const IlsRpObject &collectorOwner, IlsRpAttributeId collectorId, IlsBoolean isDestroyed=IlsFalse) |
Requests the server to remove a target in a relation (usually a n-ary relation). More... | |
virtual IlsBoolean | testCollection (const IlsRpObject &collectorOwner, IlsRpAttributeId collectorId) |
Tests whether the representation object can be added to the collection of objects designated by the attribute collectorId and owned by the representation object collectorOwner. More... | |
virtual IlsBoolean | execAsyncCallback (const IlsString &funNm, IlsMvValue *args=0, IlsCbArgNb argsNb=0, IlsBoolean inTrans=IlsTrue, IlsBoolean freeArgs=IlsFalse) |
Executes an asynchronous call to the function funNm on the Server object that matches the current representation object. More... | |
virtual IlsBoolean | execSyncCallback (const IlsString &funNm, IlsMvValue *args, IlsCbArgNb argsNb, IlsMvValue &result, IlsBoolean freeArgs=IlsFalse) |
Executes a synchronous call to the callback function funNm on the server object that matches the current representation object. More... | |
virtual IlsBoolean | execDuplexCallback (const IlsString &funNm, IlsMvValue *args, IlsCbArgNb argsNb, const IlsString &duplexFunNm, IlsMvValue *duplexArgs=0, IlsCbArgNb duplexNbArgs=0, IlsCbArgNb resultIndex=0, IlsBoolean inTrans=IlsTrue, IlsBoolean freeArgs=IlsFalse) |
Executes an asynchronous call to the function funNm on the server object, the representation object is bound to. More... | |
Protected Member Functions | |
IlsRepresentation (IlsMvComponent &, const IlsRpModel &) | |
Protected constructor. More... | |
Protected Member Functions inherited from IlsRpObject | |
IlsRpObject (const IlsRpObject &collectorOwner, IlsRpAttributeId collectorAttrId, const IlsRpObjModel *model=0, IlsBoolean endUpdate=IlsTrue) | |
Constructor used to create object from a collector. More... | |
IlsRpObject (IlsRepresentation &rp, const IlsRpObjModel &model) | |
Constructor used by the notification engine. More... | |
virtual | ~IlsRpObject () |
Destructor. More... | |
virtual IlsBoolean | beginS2CUpdate (IlsS2CTransStatus transStatus, IlsTransactionId transId) |
Called by the member function IlsRepresentation::beginS2CTransaction() on any representation object involved in the transaction. More... | |
virtual void | beforeDeletion (IlsTransactionId id) |
Called between the beginS2CUpdate() and the endS2CUpdate()` in the transaction that deletes the RpObject. More... | |
virtual void | endS2CUpdate (IlsS2CTransStatus transStatus, IlsTransactionId transId) |
Called when the server has finished updating a representation object after a server-to-component transaction. More... | |
virtual IlsBoolean | ackAttrUpdate (IlsRpAttributeId attrId, IlsS2CTransStatus transStatus, IlsTransactionId transId) |
Called for each attribute involved in a server-to-component transaction, except if the propagation has been aborted (see beginS2CUpdate() above). More... | |
Friends | |
class | IlsMvComponent |
class | IlsRpModelInterpreter |
class | IlsRpObject |
Transaction Control from Server to Component | |
virtual IlsBoolean | beginS2CTransaction (IlsS2CTransStatus st, IlsTransactionId) |
Called by the function IlsMvComponent::beginS2CTransaction() on each representation involved in a server-to-component transaction. More... | |
virtual void | endS2CTransaction (IlsS2CTransStatus, IlsTransactionId) |
Called at the end of a server-to-component transaction applying to the representation. More... | |
void | synchronize () |
Synchronizes the representation and its representation objects with updates that have been buffered on the view. More... | |
IlsBoolean | isInS2CTransaction () |
Returns IlsTrue if the representation is being updated by a server. Otherwise, it returns IlsFalse . | |
This class implements in a component the representations that are associated with each dynamic view in the server.
Library: mvserver
and mvcomp
It lets you control the transactions applying to representation objects between the object server and the application component. It can be subtyped to define runtime attributes that will be used in view specifications. See the macro ILS_REPRESENTATION_DECL()
.
For each dynamic view, there is one and only one instance of the IlsRepresentation
class or of a derived class.
|
protected |
Protected constructor.
As its arguments, this protected constructor takes references to the component it belongs to and to the representation model. Each class that derives from IlsRepresentation
and that is declared as a representation class must possess a constructor that takes both these parameters as arguments and passes them to the base class when it is initialized. For details on how to declare a class as a representation class, see the macros ILS_REPRESENTATION_BEGIN()
/ILS_REPRESENTATION_END()
and ILS_REPRESENTATION_DECL()
.
This constructor is called either by the constructor of a derived class (IlsSwRepresentation
, for example) or by the virtual member function IlsMvComponent::newRepresentation()
.
|
virtual |
Destructor.
This destructor is automatically invoked when the server is disconnected or when the view that created the representation is closed. To close a representation and notify the server about this modification without destroying the view, a component must call the IlsRepresentation::close()
member function. This destructor calls the virtual member function IlsRpObject::onRmRepresentation()
on each of its objects, which by default deletes the object.
|
virtual |
Requests that the server add the server object associated with the rpObj representation object as an origin of the view associated to the corresponding representation.
However, it has no effect if rpObj is already an origin of this view.
|
virtual |
Creates a transaction buffer where modifications performed and/or required by the application component are stored before they are sent to the server.
It is called either explicitly or implicitly. If it is called implicitly, the commit operation is also implicit and takes place after a representation object belonging to the representation has been updated (see IlsRpObject::endC2SUpdate()
).
Reimplemented in IlsSwRepresentation.
|
protectedvirtual |
Called by the function IlsMvComponent::beginS2CTransaction()
on each representation involved in a server-to-component transaction.
This function takes the same arguments as those received by
. However, when the representation is created, the transaction status transStatus is assigned the value IlsMvComponent::beginS2CTransaction()
ILS_S2C_NOTIFY_CREATION
.
If this function returns IlsTrue
, the notification, acknowledgement, or rollback is propagated to each representation object touched by the transaction in this representation. If it returns IlsFalse
, the transaction is aborted for this representation.
This function, which can be overridden, returns IlsTrue
, unless the transaction is an acknowledgement. This means by default that an acknowledgement transaction is not propagated to the representation objects.
Reimplemented in IlsSwRepresentation.
|
virtual |
Requests that the view associated with the representation be closed.
notify
is set to IlsTrue
, the server must notify the component that the representation has been closed. In particular, the server requests the deletion of all the objects in the representation (see the member function IlsRepresentation::deleteRpObject()
) and the deletion of the representation itself (see IlsMvComponent::delRepresentation()
).IlsBoolean
argument notify is set to IlsFalse
, the server does not request any deletion of the representation or of the representation objects.
|
virtual |
Commits a transaction.
By default, the updates performed during the transaction are directly sent to the server. They can also be stored in a transaction buffer at the component level.
Reimplemented in IlsSwRepresentation.
|
virtual |
Called by the server when a representation object must be destroyed.
It actually deletes the object. It can be overridden.
Reimplemented in IlsSwRepresentation.
|
protectedvirtual |
Called at the end of a server-to-component transaction applying to the representation.
The arguments are the same as those passed to the beginS2CTransaction()
function described above. This function, which can be overridden, has an empty implementation.
Reimplemented in IlsSwRepresentation.
IlsMvComponent* IlsRepresentation::getComponent | ( | ) | const |
Returns a pointer to the application component to which the representation belongs.
It returns 0 if the application component is being closed.
IlsRepresentationId IlsRepresentation::getId | ( | ) | const |
Returns the representation identifier. This identifier is unique.
It is used internally by the server-to-component protocol and also in trace mode.
IlsRpObject* IlsRepresentation::getObject | ( | IlsRpObjectId | id | ) |
Returns a pointer to the representation object identified by the argument id.
It returns 0 if no object with the specified identifier is found in the representation.
IlsRpObject ** IlsRepresentation::getObjects | ( | int & | count | ) |
Returns an array of all Representation Objects stored in this representation.
The argument count is assigned the number of elements of the returned array. You must delete the returned array using the delete []
operator.
|
virtual |
Called to create a new representation object in the representation, based on the model representation object model, if no constructor attachment has been declared for this model.
See the macros ILS_RP_OBJECT_BEGIN()
/ILS_RP_OBJECT_END()
for details.
This function builds an object of type IlsRpObject
. It can be overridden to build an object of a derived type.
repres | reference to the representation to which the new representation object is going to be inserted. |
model | representation object model. |
|
virtual |
Executed by Rogue Wave Server after a new representation has been created.
Its arguments ackArgv and ackArgc are built from the arguments ackArgv
, ackArgc
, and resultIndex
passed to the following member functions (in each case, the second one in a pair of functions with same names) :
See one of those member functions for more information on the use of the argument resultIndex
.
If the opening of the view was requested without those arguments, ackArgv is set to the null pointer and ackArgc is set to 0.
This function has an empty implementation because it is meant to be overriden by the user when needed.
Reimplemented in IlsSwRepresentation.
|
virtual |
Requests that the server remove the server object associated with the rpObj representation object as an origin of the view associated with the corresponding representation.
However, it has no effect if rpObj is not an origin of the view.
|
virtual |
Resets the buffer-mode state on the represented view.
IlsMvView::resetBufferMode()
.
|
virtual |
Rolls back a transaction that applies * to a representation.
IlsMvComponent::setDefaultC2STransStatus()
), this function sends asynchronous requests to the server. In response, the server sends back all the corresponding updates so as to restore the representation to its previous state.IlsMvComponent
class description. This member function rolls back a transaction that has been previously initialized on the representation. Reimplemented in IlsSwRepresentation.
|
virtual |
Sets the represented view in buffer mode.
IlsMvView::setBufferMode()
.
|
virtual |
Requests the server to set the server object associated with the representation object pointed to by the rpObjP argument as the main origin of the view associated with the corresponding representation.
See the member functions IlsMvView::setMainOrigin()
and IlsMvView::getMainOrigin()
for details.
|
virtual |
Called when an already opened view is opened again.
A component may request that the server open a view that is already open (see the member functions IlsMvComponent::openView()
, IlsRpObject::openView()
, and IlsRpObject::onDereference()
for more information).
If this happens and the opening of the view is not forced, the server does not replicate the view, but merely notifies the component to select the associated representation by calling the setSelection()
virtual member function on this representation. By default, this function has no effect. If the representation is a graphical one, the function can be redefined, for instance to pop up the representation, as in IlsSwRepresentation
.
Reimplemented from IlsRpObject.
Reimplemented in IlsSwRepresentation.
void IlsRepresentation::synchronize | ( | ) |
Synchronizes the representation and its representation objects with updates that have been buffered on the view.
IlsMvView::synchronize()
.