Changes between Version 39 and Version 40 of mvc
- Timestamp:
- 11/20/23 10:37:55 (12 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
mvc
v39 v40 35 35 As mentioned the Model notifies all listeners when something in the model changes. The convention we try to stick to (but can not enforce) is that {{{Unacceptable}}} is thrown whenever the change in the model can not be accepted. This works as follows 36 36 * When setValue (or equivalent functions) receive a value that is unacceptable, eg because it's out of range, or because some parent model has an issue with it, an {{{Unacceptable}}} is thrown immediately 37 * In the case of a compound object, the problem may not arise immediately but only indirectly. For instance suppose that Parsons with a name starting with "A" can not be older than 100 years. Let's assume this check is done on the Person level. The Person model listens to changes to name and age, and this listener will throw if there is a conflict. This throw will then end up in the event notifier of the name or age model where the offending change will have to be reverted. Therefore the event notification in general is of the type ThrowingListenable and changes need to be reverted in case of conflicts. The notification mechanismgenerally will look like this37 * In the case of a compound object, the problem may not arise immediately but only indirectly. For instance suppose that Parsons with a name starting with "A" can not be older than 100 years. Let's assume this check is done on the Person level. The Person model listens to changes to name and age, and this listener will throw if there is a conflict. This throw will then end up in the event notifier of the name or age model where the offending change will have to be reverted. Therefore the event notification in general is of the type ThrowingListenable and changes need to be reverted in case of conflicts. setValue (which calls notifyChanges) generally will look like this 38 38 {{{ 39 39 public void setValue(newval) {