CMSC 498B: Developing User Interfaces - Spring 2002Model-View-Controller (MVC) | |
Model View Controller (MVC)ModelInformationActionsViewMap information to visual displaysControllerMap events to modifications of modelMap events to modifications of viewWhy bother?
Scroll bar exampleModel InformationCurrent value, Extent, Max, Min, Step size, Page sizeActionsSet/get value, extent, Stepup/stepdown, Pageup/pagedownView Position of the thumb given max, min and value, and extentController Input eventsMouseDownMouseMoveMouseUpHow to translate into actionsGeometry questionsView update questionsKeyboard eventsHow does the view know when the model has changed? => Model generates Change event. View listens to that event, and requests a rerender of itself - using the model when it is time to render. All actions are triggered from the controller. Calculator exampleModel InformationCurrent value (Generates ValueChanged event)Accumulator valueSaved operatorActionsEnter numberPerform operationView Static parts (redisplay on interaction events)Number part (redisplay on value changed event)Controller Input onto buttonsEssential geometrySpreadsheetModel How many views? Look at upper view when cell is modifiedType a formulaType a dependent formulaController
Is it clear why we worry about graphics and making our own widgets yet? |