author | Claus Gittinger <cg@exept.de> |
Thu, 25 Apr 1996 18:43:54 +0200 | |
changeset 223 | b65dc250db8d |
parent 175 | df08e5b663d0 |
child 231 | 2fec6188bd28 |
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:) |
|
223 | 50 |
|
51 |
[author:] |
|
52 |
Claus Gittinger |
|
68 | 53 |
" |
54 |
! ! |
|
55 |
||
62 | 56 |
!ValueModel class methodsFor:'instance creation'! |
57 |
||
58 |
new |
|
59 |
^ (super new) initialize |
|
60 |
! ! |
|
61 |
||
125 | 62 |
!ValueModel methodsFor:'accessing'! |
63 |
||
64 |
accept |
|
65 |
accepted := true |
|
66 |
! |
|
62 | 67 |
|
125 | 68 |
accepted |
69 |
^ accepted |
|
70 |
! |
|
71 |
||
72 |
setValue:newValue |
|
73 |
"physically set my value, without change notifications" |
|
74 |
||
75 |
^ self subclassResponsibility |
|
76 |
! |
|
73 | 77 |
|
125 | 78 |
value |
79 |
"return my value" |
|
80 |
||
81 |
^ self subclassResponsibility |
|
82 |
! |
|
83 |
||
84 |
value:anObject |
|
85 |
"set my value, if it changed, send change notifications to my dependents." |
|
86 |
||
87 |
|oldValue| |
|
88 |
||
89 |
oldValue := self value. |
|
90 |
self setValue:anObject. |
|
91 |
anObject ~= oldValue ifTrue:[ |
|
92 |
"/ self notifyChange:#value |
|
93 |
self changed:#value |
|
94 |
] |
|
62 | 95 |
! ! |
96 |
||
69 | 97 |
!ValueModel methodsFor:'initialization'! |
98 |
||
99 |
initialize |
|
100 |
accepted := false |
|
101 |
! ! |
|
102 |
||
129 | 103 |
!ValueModel class methodsFor:'documentation'! |
104 |
||
105 |
version |
|
223 | 106 |
^ '$Header: /cvs/stx/stx/libview2/ValueModel.st,v 1.16 1996-04-25 16:43:26 cg Exp $' |
129 | 107 |
! ! |