OpenCAGE Model to OpenCAGE GUI Events

Figure 8-4. Observers listening to the OpenCAGE Model

Observers listening to the OpenCAGE Model

The Graph_Display_Controller (GDC) has observers attached to the Node_Model it represents, i.e. the background object of the GDC. It also has observers attached to every object that is shown in the Graph Window corresponding to the GDC.

The GDC listens to the following messages of its background object but ignores the other messages of the Node_Model_Observer:

Destroying

The GDC destroys itself, too.

Child_Added

The GDC creates a Node_Display and adds it to its children.

Child_Removed

The GDC removes the appropriate Node_Display from its children.

Child_Removed

The GDC removes the appropriate Node_Display from its children.

Changed

The GDC updates its status bar.

The GDC listens to the following messages of the nodes shown in its Graph_Window but ignores the other messages of the Node_Model_Observer:

Incoming_Edge_Added

The GDC gets the Edge_Display if it already exists, otherwise it creates the Edge_Display. Then it sets the end node properly.

Outgoing_Edge_Added

The GDC gets the Edge_Display if it already exists, otherwise it creates the Edge_Display. Then it sets the start node properly.

Incoming_Edge_Removed

The GDC sets the end node of the Edge_Display to null.

Outgoing_Edge_Removed

The GDC sets the start node of the Edge_Display to null.

Obviously edges that miss start or end node cannot be displayed. Because of this, Edge_Displays have a drawable flag that is only set to true when the Edge_Display has both nodes set.

Node_Displays end Edge_Displays listen only to the following messages:

Destroying

The display destroys itself, i.e. sending all its observer the "Destroying" Message beforehand.

Changed

The display sends its observers the "Changed" Message.