author | Claus Gittinger <cg@exept.de> |
Thu, 25 Apr 1996 18:32:07 +0200 | |
changeset 221 | ea942fe5dc04 |
parent 175 | df08e5b663d0 |
child 223 | b65dc250db8d |
permissions | -rw-r--r-- |
75 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
69 | 13 |
Model subclass:#ValueModel |
175
df08e5b663d0
let objects interest implementation do things
Claus Gittinger <cg@exept.de>
parents:
143
diff
changeset
|
14 |
instanceVariableNames:'accepted' |
df08e5b663d0
let objects interest implementation do things
Claus Gittinger <cg@exept.de>
parents:
143
diff
changeset
|
15 |
classVariableNames:'' |
df08e5b663d0
let objects interest implementation do things
Claus Gittinger <cg@exept.de>
parents:
143
diff
changeset
|
16 |
poolDictionaries:'' |
df08e5b663d0
let objects interest implementation do things
Claus Gittinger <cg@exept.de>
parents:
143
diff
changeset
|
17 |
category:'Interface-Support-Models' |
62 | 18 |
! |
19 |
||
68 | 20 |
!ValueModel class methodsFor:'documentation'! |
21 |
||
69 | 22 |
copyright |
23 |
" |
|
24 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
71 | 25 |
All Rights Reserved |
69 | 26 |
|
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
68 | 36 |
documentation |
37 |
" |
|
38 |
abstract superclass for ValueHolders and Adaptors. |
|
69 | 39 |
It does not itself know how and where the value is stored, |
143
ae38792bd85c
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
129
diff
changeset
|
40 |
but knows about interested objects (which get informed, whenever |
69 | 41 |
the value changes) and keeps track if the value was ever accepted. |
68 | 42 |
|
43 |
Notice: this class was implemented using protocol information |
|
44 |
from alpha testers - it may not be complete or compatible to |
|
45 |
the corresponding ST-80 class. If you encounter any incompatibilities, |
|
46 |
please forward a note to the ST/X team. |
|
69 | 47 |
|
48 |
subclasses must redefine: #setValue: and #value |
|
49 |
(and optionally redefine #value:) |
|
68 | 50 |
" |
51 |
! ! |
|
52 |
||
62 | 53 |
!ValueModel class methodsFor:'instance creation'! |
54 |
||
55 |
new |
|
56 |
^ (super new) initialize |
|
57 |
! ! |
|
58 |
||
125 | 59 |
!ValueModel methodsFor:'accessing'! |
60 |
||
61 |
accept |
|
62 |
accepted := true |
|
63 |
! |
|
62 | 64 |
|
125 | 65 |
accepted |
66 |
^ accepted |
|
67 |
! |
|
68 |
||
69 |
setValue:newValue |
|
70 |
"physically set my value, without change notifications" |
|
71 |
||
72 |
^ self subclassResponsibility |
|
73 |
! |
|
73 | 74 |
|
125 | 75 |
value |
76 |
"return my value" |
|
77 |
||
78 |
^ self subclassResponsibility |
|
79 |
! |
|
80 |
||
81 |
value:anObject |
|
82 |
"set my value, if it changed, send change notifications to my dependents." |
|
83 |
||
84 |
|oldValue| |
|
85 |
||
86 |
oldValue := self value. |
|
87 |
self setValue:anObject. |
|
88 |
anObject ~= oldValue ifTrue:[ |
|
89 |
"/ self notifyChange:#value |
|
90 |
self changed:#value |
|
91 |
] |
|
62 | 92 |
! ! |
93 |
||
69 | 94 |
!ValueModel methodsFor:'initialization'! |
95 |
||
96 |
initialize |
|
97 |
accepted := false |
|
98 |
! ! |
|
99 |
||
129 | 100 |
!ValueModel class methodsFor:'documentation'! |
101 |
||
102 |
version |
|
175
df08e5b663d0
let objects interest implementation do things
Claus Gittinger <cg@exept.de>
parents:
143
diff
changeset
|
103 |
^ '$Header: /cvs/stx/stx/libview2/Attic/ValModel.st,v 1.15 1996-03-08 22:20:18 cg Exp $' |
129 | 104 |
! ! |