Changes between Version 8 and Version 9 of mvc
- Timestamp:
- 06/13/22 11:34:45 (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
mvc
v8 v9 30 30 === The notification mechanism 31 31 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 {{{IllegalStateException}}} is thrown whenever the change in the model can not be accepted. This works as follows 32 * When setValue (or equivalent functions) receive a value that is unacceptable, eg because it's out of range, an IllegalArgumentException is thrown immediately32 * 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 IllegalArgumentException is thrown immediately 33 33 * 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. This check can not be done on the submodels containing the name or the age, but has to be done on the Person level. The Person model has to listen 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 mechanism generally will look like this 34 34 {{{