'From Squeak3.7 of ''4 September 2004'' [latest update: #5989] on 16 June 2008 at 8:27:22 am'!

!LightWidget methodsFor: 'view of a model or target' stamp: 'jmv 6/16/2008 08:26'!
safeModelChanged
	"The model changed is some way.
	This is usually the place to call #targetAspect to fetch the current value of the aspect from the
		model, and to store it in some Model Extension.
	We must update all Model Extension instance variables with values from the model (i.e. target)
		or with appropriate defaults.
	We must update ourselves and all subviews to reflect the model's new state
	This method could be called from a process that is not the UI process.
	Do the update in the UI process, in the inter-cycle pause."

	OldWorldState addDeferredUIMessage:  [
		self modelChanged]! !

!LightWidget methodsFor: 'view of a model or target' stamp: 'jmv 6/16/2008 08:26'!
target: aModel aspect: aSymbol aspectAdaptor: anotherSymbol modelChangeEvent: eventSymbol
	"Widgets are notified of model changes by being sent #modelChanged.
	This happens when:
		- The widget is given a new model (or target widget), aspect or aspect adaptor
		- An owner view is updated
		
	In addition, main views are updated from model events. See #beMainViewOn:
		
	But other widgets might update on more specific events from the model. This is useful to 
	update only a small subview, and not the whole main view.
	
	This message is sent to such widgets, to set this specific event.
	
	Warning:
	When models change, they should trigger just one event.
	It might be #selfChanged (the most general one) or a more specific one.
	But it should not trigger more than one event for each change."
		
	self target: aModel aspect: aSymbol aspectAdaptor: anotherSymbol.
	target when: eventSymbol send: #safeModelChanged to: self! !

