AbstractController Class Reference

The AbstractController class provides an abstract base for all controllers in the Model-View-Controller system. More...

#include <abstractcontroller.h>

Inheritance diagram for AbstractController:

MvcBase DigestDbController DocController SettingsController AttributeDocController ElementDocController DiagramController GuiDiagramController FsaDiagramController List of all members.

Public Member Functions

 AbstractController (QObject *objectPtr)
virtual ~AbstractController ()
AbstractModelmodel () const
void setModel (AbstractModel *model)
const AbstractViewSetviews () const
void attachView (AbstractView *view)
void detachView (AbstractView *view)

Protected Member Functions

virtual void dispatchEvent (CEvent *)
virtual void changeModelEvent (CChangeModelEvent *)
virtual void viewAttachEvent (CViewAttachEvent *)
virtual void viewDetachEvent (CViewDetachEvent *)
virtual void detachAllViewsEvent (CEvent *)

Detailed Description

The AbstractController class provides an abstract base for all controllers in the Model-View-Controller system.


Constructor & Destructor Documentation

AbstractController::AbstractController ( QObject *  objectPtr  ) 

Constructs an abstract controller.

AbstractController::~AbstractController (  )  [virtual]

Destroys the abstract controller.

If the model() is non-null, then a MChangeControllerEvent will be posted to it with null (0) as the parameter. Likewise, a VChangeControllerEvent will be posted with null (0) as the parameter to each of the attached views().


Member Function Documentation

AbstractModel * AbstractController::model (  )  const

void AbstractController::setModel ( AbstractModel model  ) 

Convenience method.

Posts a CChangeModelEvent to itself with the given model.

const AbstractViewSet& AbstractController::views (  )  const [inline]

void AbstractController::attachView ( AbstractView view  ) 

Convenience method.

Posts a CViewAttachEvent to itself with the given view.

void AbstractController::detachView ( AbstractView view  ) 

Convenience method.

Posts a CViewDetachEvent to itself with the given view.

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

The controller's 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 in AttributeDocController, DocController, ElementDocController, DiagramController, DigestDbController, and SettingsController.

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

Changes the model that the controller is to operate on.

If the model() is non-null, this will post a MChangeControllerEvent to it and a VModelChangedEvent to all attached views().

Asserts that the event is non-null.

Reimplemented in AttributeDocController, DocController, ElementDocController, DiagramController, DigestDbController, and SettingsController.

void AbstractController::viewAttachEvent ( CViewAttachEvent event  )  [protected, virtual]

Attaches a view to the controller.

Posts a VChangeControllerEvent to the view. However, a VModelChangedEvent is not sent. After receiving the former, the view should post the latter to itself.

Duplicates will be implicitly ignored, as the AbstractView pointers are stored in a QSet.

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

void AbstractController::viewDetachEvent ( CViewDetachEvent event  )  [protected, virtual]

Detaches a view from the controller.

Asserts that the event is non-null.

void AbstractController::detachAllViewsEvent ( CEvent  )  [protected, virtual]

Detaches all views from the controller.


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