ElementDocController Class Reference

The ElementDocController class is responsible for controlling the communication between an ElementDoc and its views. More...

#include <elementdoccontroller.h>

Inheritance diagram for ElementDocController:

AttributeDocController DocController AbstractController MvcBase DiagramController GuiDiagramController FsaDiagramController List of all members.

Public Slots

void postElementAttributeChangeData (AbstractElement *element, int attributeType, const QVariant &data, QObject *sender=0, CEvent::Flags flags=CEvent::NoFlags)

Public Member Functions

 ElementDocController (QObject *parent=0)
 ElementDocController (AbstractModel *doc, QObject *parent=0)
ElementDocelementDoc () const

Protected Member Functions

virtual void dispatchEvent (CEvent *)
virtual void changeModelEvent (CChangeModelEvent *)
virtual void elementAddEvent (CElementAddEvent *)
virtual void elementRemoveEvent (CElementRemoveEvent *)
virtual void elementAttributeAddEvent (CElementAttributeAddEvent *)
virtual void elementAttributeRemoveEvent (CElementAttributeRemoveEvent *)
virtual void elementAttributeChangeDataEvent (CElementAttributeChangeDataEvent *)
virtual void elementSetChangeOrderEvent (CElementSetChangeOrderEvent *)

Detailed Description

The ElementDocController class is responsible for controlling the communication between an ElementDoc and its views.

Note that the elementDoc's pointer is stored internally as a "guarded pointer". Hence, if the elementDoc is deleted, our reference to it will be automatically set back to NULL.

Warning! We always assert that the elementDoc is non-null. Hence, you can't have an instance of a ElementDocController without a ElementDoc. This is fine for Nodal and means that we don't need to constantly check if the elementDoc is null in the release / deployment version (when assertions are stripped).


Constructor & Destructor Documentation

ElementDocController::ElementDocController ( QObject *  parent = 0  ) 

Constructs an element document controller with the given parent.

ElementDocController::ElementDocController ( AbstractModel doc,
QObject *  parent = 0 
)

Constructs an element document controller with the given parent and uses doc as its model.


Member Function Documentation

ElementDoc * ElementDocController::elementDoc (  )  const

Convenience method.

Returns a cached guarded pointer that has been dynamically cast to ElementDoc* from AbstractModel*.

See also AbstractController::model().

void ElementDocController::postElementAttributeChangeData ( AbstractElement element,
int  attributeType,
const QVariant &  data,
QObject *  sender = 0,
CEvent::Flags  flags = CEvent::NoFlags 
) [slot]

This convenience slot method posts a CElementAttributeChangeDataEvent to this controller with the given element, attribute (found using attributeType), data, sender and flags.

Asserts that the element is non-null and that the element contains an attribute that is of type attributeType.

Note: This method is thread-safe.

void ElementDocController::dispatchEvent ( CEvent event  )  [protected, virtual]

The element doc controller event dispatcher.

Asserts that the event is non-null.

Warning! It is assumed that the events have their correct type set (as it uses static casts).

Reimplemented from AttributeDocController.

Reimplemented in DiagramController.

void ElementDocController::changeModelEvent ( CChangeModelEvent event  )  [protected, virtual]

Re-implemented, as to also have the pointer returned by elementDoc() updated.

Asserts that the event is non-null.

Reimplemented from AttributeDocController.

Reimplemented in DiagramController.

void ElementDocController::elementAddEvent ( CElementAddEvent event  )  [protected, virtual]

Asserts that the event and the event->element() are non-null.

Reimplemented in FsaDiagramController.

void ElementDocController::elementRemoveEvent ( CElementRemoveEvent event  )  [protected, virtual]

Asserts that both the event and event->element() are non-null.

Reimplemented in FsaDiagramController, and DiagramController.

void ElementDocController::elementAttributeAddEvent ( CElementAttributeAddEvent event  )  [protected, virtual]

Adds the specified attribute to the given element and then informs the views.

Warning: Because elements can only contain one of each type of attribute (i.e. no duplicates), any existing attribute of the same type that is to be added will be removed (and the views informed) before the new one is added.

Asserts that the event, event->element() and event->attribute() are all non-null.

Reimplemented in FsaDiagramController.

void ElementDocController::elementAttributeRemoveEvent ( CElementAttributeRemoveEvent event  )  [protected, virtual]

Removes the specified attribute from the given element and then informs the views.

Asserts that the event, event->element() and event->attribute() are all non-null.

Reimplemented in FsaDiagramController.

void ElementDocController::elementAttributeChangeDataEvent ( CElementAttributeChangeDataEvent event  )  [protected, virtual]

Updates the attribute and the views.

Asserts that the event, event->element() and event->attribute() are all non-null.

Reimplemented in FsaDiagramController.

void ElementDocController::elementSetChangeOrderEvent ( CElementSetChangeOrderEvent event  )  [protected, virtual]

Changes the (Z) order of the given event->elements() in respect to elementDoc()->elements() as specified by the given event->action().

Asserts that the event is non-null.


The documentation for this class was generated from the following files:
Generated on Mon Jul 30 09:46:52 2007 for Digest by  doxygen 1.5.2