Sharkysoft home

lava.mv
Interface IMvView


public interface IMvView

A view in a program the uses the model-view architecture.

Details: An IMvView provides a user-view of the model in programs that use the model-view design pattern. Instances of IMvView can register themselves with MvModels to receive model-changed messages.

Clip-source:

Since:
1998.10.22
Version:
1998.10.22
See Also:
MvModel

Method Summary
 void updateView(java.lang.Object ipModelId, java.lang.Object ipModelData)
          Notifies view of model change.
 

Method Detail

updateView

public void updateView(java.lang.Object ipModelId,
                       java.lang.Object ipModelData)
Notifies view of model change.

Details: updateView is called by the MvModels to which this IMvView is registered in order to notify the this view of a changes in the model. ipModelId identifies the calling model and is the same as the id parameter passed into MvModel constructor. (ipModelId is particularly helpful when a view has attached itself to more than one model.) ipModelData conveys information about the model's new state.

Many developers prefer to ignore ipModelData and obtain model information directly from the model's methods. For example, if this view were a graphical Component, this method might simply invalidate the display and return, relying on the paint method to query the model for information while redrawing.

On the other hand, if this view were a subclass of Label, and the purpose of the Label was simply to display application status, then ipModelData might be used to represent the Label's new text content. In this case, updateView would call setText ((String) ipModelData) and let the superclass take care of the redrawing.

The proper interpretation of ipModelId and ipModelData ultimately depends on the model that is being viewed. Consult each model's documentation to determine how these parameters are used.

Parameters:
ipModelId - model identifier
ipModelData - model change information

Sharkysoft home