Download presentation
Presentation is loading. Please wait.
1
December 200491.3913 Ron McFadyen1 sf:SaleFrame1s:Salepropertylisteners:Object initialize(s:Sale) attach(sf) add (sf) Figure 23.22 Replace addPropertyListener with attach
2
December 200491.3913 Ron McFadyen2 s:Salepropertylisteners:Object * :update (s, “sale.total”, total) Figure 23.23 notify (“sale.total”, total) setTotal (total) Replace publishPropertyEvent with notify Replace onPropertyEvent with update
3
December 200491.3913 Ron McFadyen3 setText (value.toString() Figure 23.24 update (source, name, value) :SaleFrame1saleTextField:JTextField Replace onPropertyEvent with update
4
December 200491.3913 Ron McFadyen4 TrafficLight > Observer * PhotoCameraRadarUnit > Subject Attach() Detach() Notify() Attach() Detach() Notify() changeToRed() update() takePhoto() update() measureSpeed() update() TrafficLight is a subject/publisher and implements the Subject interface. PhotoCamera and RadarUnit are observers and implement the Observer interface. A subject must know it observers (notice multiplicity and navigability).
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.