--- a/ValueModel.st Thu Nov 23 11:40:23 1995 +0100
+++ b/ValueModel.st Thu Nov 23 11:43:41 1995 +0100
@@ -10,8 +10,6 @@
hereby transferred.
"
-'From Smalltalk/X, Version:2.10.5 on 9-may-1995 at 12:03:02 pm'!
-
Model subclass:#ValueModel
instanceVariableNames:'accepted interrest'
classVariableNames:''
@@ -35,10 +33,6 @@
"
!
-version
- ^ '$Header: /cvs/stx/stx/libview2/ValueModel.st,v 1.11 1995-11-11 16:05:28 cg Exp $'
-!
-
documentation
"
abstract superclass for ValueHolders and Adaptors.
@@ -54,6 +48,10 @@
subclasses must redefine: #setValue: and #value
(and optionally redefine #value:)
"
+!
+
+version
+ ^ '$Header: /cvs/stx/stx/libview2/ValueModel.st,v 1.12 1995-11-23 10:43:15 cg Exp $'
! !
!ValueModel class methodsFor:'instance creation'!
@@ -62,17 +60,39 @@
^ (super new) initialize
! !
-!ValueModel ignoredMethodsFor:'change notification'!
+!ValueModel methodsFor:'accessing'!
+
+accept
+ accepted := true
+!
-notifyChange:aSymbol
- "notify my dependents and those that are interrested"
+accepted
+ ^ accepted
+!
+
+setValue:newValue
+ "physically set my value, without change notifications"
+
+ ^ self subclassResponsibility
+!
- interrest notNil ifTrue:[
- interrest keysAndValuesDo:[:someone :selector |
- someone perform:selector
- ].
- ].
- self changed:aSymbol
+value
+ "return my value"
+
+ ^ self subclassResponsibility
+!
+
+value:anObject
+ "set my value, if it changed, send change notifications to my dependents."
+
+ |oldValue|
+
+ oldValue := self value.
+ self setValue:anObject.
+ anObject ~= oldValue ifTrue:[
+ "/ self notifyChange:#value
+ self changed:#value
+ ]
! !
!ValueModel methodsFor:'change notification'!
@@ -88,41 +108,6 @@
super changed:aSymbol
! !
-!ValueModel methodsFor:'accessing'!
-
-value:anObject
- "set my value, if it changed, send change notifications to my dependents."
-
- |oldValue|
-
- oldValue := self value.
- self setValue:anObject.
- anObject ~= oldValue ifTrue:[
- "/ self notifyChange:#value
- self changed:#value
- ]
-!
-
-accepted
- ^ accepted
-!
-
-accept
- accepted := true
-!
-
-value
- "return my value"
-
- ^ self subclassResponsibility
-!
-
-setValue:newValue
- "physically set my value, without change notifications"
-
- ^ self subclassResponsibility
-! !
-
!ValueModel methodsFor:'initialization'!
initialize
@@ -131,6 +116,17 @@
!ValueModel methodsFor:'interrest'!
+onChangeSend:selector to:someone
+ "add an interrest, arranging that
+ a message with selector will be sent to someone
+ when my value changes."
+
+ interrest isNil ifTrue:[
+ interrest := IdentityDictionary new
+ ].
+ interrest at:someone put:selector
+!
+
retractInterrestFor:someone
"release interrest i.e. do no longer send changeMsg to changeReceiver
iff someone is the changeReceiver.
@@ -140,15 +136,5 @@
interrest notNil ifTrue:[
interrest removeKey:someone ifAbsent:nil
]
-!
+! !
-onChangeSend:selector to:someone
- "add an interrest, arranging that
- a message with selector will be sent to someone
- when my value changes."
-
- interrest isNil ifTrue:[
- interrest := IdentityDictionary new
- ].
- interrest at:someone put:selector
-! !