ValueModel.st
changeset 86 38cc61653cb2
parent 75 a53337dc3e19
child 96 948318b2fbd4
equal deleted inserted replaced
85:141c920b1d3d 86:38cc61653cb2
    35 "
    35 "
    36 !
    36 !
    37 
    37 
    38 version
    38 version
    39 "
    39 "
    40 $Header: /cvs/stx/stx/libview2/ValueModel.st,v 1.8 1995-05-16 17:14:27 claus Exp $
    40 $Header: /cvs/stx/stx/libview2/ValueModel.st,v 1.9 1995-07-23 02:28:55 claus Exp $
    41 "
    41 "
    42 !
    42 !
    43 
    43 
    44 documentation
    44 documentation
    45 "
    45 "
    62 
    62 
    63 new
    63 new
    64     ^ (super new) initialize
    64     ^ (super new) initialize
    65 ! !
    65 ! !
    66 
    66 
    67 !ValueModel methodsFor:'change notification'!
    67 !ValueModel ignoredMethodsFor:'change notification'!
    68 
    68 
    69 notifyChange:aSymbol
    69 notifyChange:aSymbol
    70     "notify my dependents and those that are interrested"
    70     "notify my dependents and those that are interrested"
    71 
    71 
    72     interrest notNil ifTrue:[
    72     interrest notNil ifTrue:[
    75 	].
    75 	].
    76     ].
    76     ].
    77     self changed:aSymbol
    77     self changed:aSymbol
    78 ! !
    78 ! !
    79 
    79 
       
    80 !ValueModel methodsFor:'change notification'!
       
    81 
       
    82 changed:aSymbol
       
    83     "notify my dependents and those that are interrested"
       
    84 
       
    85     interrest notNil ifTrue:[
       
    86 	interrest keysAndValuesDo:[:someone :selector |
       
    87 	    someone perform:selector
       
    88 	].
       
    89     ].
       
    90     super changed:aSymbol
       
    91 ! !
       
    92 
    80 !ValueModel methodsFor:'accessing'!
    93 !ValueModel methodsFor:'accessing'!
    81 
    94 
    82 value:anObject
    95 value:anObject
    83     "set my value, if it changed, send change notifications to my dependents."
    96     "set my value, if it changed, send change notifications to my dependents."
    84 
    97 
    85     |oldValue|
    98     |oldValue|
    86 
    99 
    87     oldValue := self value.
   100     oldValue := self value.
    88     self setValue:anObject.
   101     self setValue:anObject.
    89     anObject ~= oldValue ifTrue:[
   102     anObject ~= oldValue ifTrue:[
    90 	self notifyChange:#value
   103 	"/ self notifyChange:#value
       
   104 	self changed:#value
    91     ]
   105     ]
    92 !
   106 !
    93 
   107 
    94 accepted
   108 accepted
    95     ^ accepted
   109     ^ accepted