--- a/AspectAdaptor.st Tue Feb 14 15:17:29 2012 +0100
+++ b/AspectAdaptor.st Thu Mar 01 08:57:54 2012 +0100
@@ -36,8 +36,7 @@
documentation
"
- an AspectAdaptor forwards updates and change messages
- from/to a complex model.
+ an AspectAdaptor forwards updates and change messages from/to a complex model.
Consider the case where editFields are required for the
elements (instance variables) of a compound object:
@@ -226,20 +225,29 @@
!AspectAdaptor methodsFor:'accessing-value'!
+defaultValueIfNoSubject
+ "if there is no subject (taget to provide the value),
+ this value is returned."
+
+ ^ nil
+
+ "Created: / 01-03-2012 / 08:53:38 / cg"
+!
+
setValue:newValue
"set the value - this forwards a putMessage to the target"
|target oldValue|
target := super value.
- target isNil ifTrue:[^ nil].
+ target notNil ifTrue:[
+ oldValue := target perform:getMsg.
+ oldValue ~~ newValue ifTrue:[
+ target perform:putMsg with:newValue.
+ ]
+ ].
- oldValue := target perform:getMsg.
- oldValue ~~ newValue ifTrue:[
- target perform:putMsg with:newValue.
- ]
-
- "Modified: 22.1.1997 / 18:28:40 / cg"
+ "Modified: / 01-03-2012 / 08:54:10 / cg"
!
value
@@ -249,8 +257,11 @@
|target|
target := super value.
- target isNil ifTrue:[^ nil].
+ target isNil ifTrue:[^ self defaultValueIfNoSubject].
+
^ target perform:getMsg
+
+ "Modified (format): / 01-03-2012 / 08:54:33 / cg"
!
value:newValue
@@ -260,17 +271,17 @@
|target oldValue|
target := super value.
- target isNil ifTrue:[^ self].
+ target notNil ifTrue:[
+ oldValue := target perform:getMsg.
+ oldValue ~~ newValue ifTrue:[
+ target perform:putMsg with:newValue.
+ subjectSendsUpdates ifFalse:[
+ self changed:#value
+ ]
+ ]
+ ].
- oldValue := target perform:getMsg.
- oldValue ~~ newValue ifTrue:[
- target perform:putMsg with:newValue.
- subjectSendsUpdates ifFalse:[
- self changed:#value
- ]
- ]
-
- "Modified: 22.1.1997 / 18:29:59 / cg"
+ "Modified: / 01-03-2012 / 08:54:27 / cg"
! !
!AspectAdaptor methodsFor:'change & update'!
@@ -288,5 +299,5 @@
!AspectAdaptor class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/AspectAdaptor.st,v 1.22 2009-09-18 09:34:14 fm Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/AspectAdaptor.st,v 1.23 2012-03-01 07:57:54 cg Exp $'
! !