Navigation:  Programming Cookbook > Creating GUI Applications > Model View Presenter Overview >


Previous pageReturn to chapter overviewNext page

A view is a window that is responsible for displaying a model's data to the user. It is typically, but not definitively, a Windows control. In the triad diagram above, the red link indicates an indirect binding between model and view such that the view is really an Observer onto the model.

The model does not hold a direct reference to the view but, in order to inform its observers when it has changed, it triggers a notification event (using #trigger:). The view will previously have registered an interest in these events (using #when:send:to:) and, when the event is triggered, the view's handler method will fetch the new model data and display it to the user appropriately.

It is a fundamental stance in MVP that views know about their models but not vice versa. Hence, a view has direct access via instance variables to both its model and its presenter.


Take a look at ListControlView>>connectModel: in your image. You'll see that, when a model is being connected to it, the list view registers an interest in several events triggered by the model. The event handler for #listChanged is registered to call #onListChanged and, if you now look at this latter method, you'll see that is implemented to refresh the view's entire contents.