Changes between Version 35 and Version 36 of mvc
- Timestamp:
- 11/20/23 10:27:47 (12 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
mvc
v35 v36 84 84 85 85 === Compound Model 86 A compound model is a model containing other Models, for instance the Person model may contain two {{{StringModel}}}s to contain the first and last name,and a {{{NumberModel}}} to contain the age.86 A compound model is a model containing other Models, for instance the Person model may contain a {{{StringModel}}} to contain the name and a {{{NumberModel}}} to contain the age. 87 87 88 88 A compound model is usually not changed directly, it's the contained basic models that change. It does listen to its children but usually only checks the consistency of the contained subvalues (throwing Unacceptable if needed). The compound model normally never calls setValue to its children. 89 90 In rare examples it may be needed to modify submodels from a compound model. Then things can get complex pretty quickly. First, the compound model then will have to call setValue on one of its children. This will cause the clock to advance (as setValue normally does that). Therefore the compound model should not advance the clock itself. That call to setValue will also trigger a changed-notification that may have to be dealt with in a special way to avoid infinite loops. One example of this is the MultiplicationModel in the MultiplierExample. But it is recommended to avoid this. It gets even trickier if a compound model wishes to change multiple sub-values. 89 91 90 92