author | Claus Gittinger <cg@exept.de> |
Tue, 27 Jan 1998 12:12:49 +0100 | |
changeset 773 | b6337f784d05 |
parent 504 | b77cdd860259 |
child 796 | 5aca7d7a8f30 |
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 |
441
b0d486981a62
unconditionally send a change notification;
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
14 |
instanceVariableNames:'' |
175
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 |
||
441
b0d486981a62
unconditionally send a change notification;
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
20 |
!ValueModel class methodsFor:'documentation'! |
68 | 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 |
|
231 | 43 |
Notice: |
44 |
this class was implemented using protocol information |
|
45 |
from alpha testers - it may not be complete or compatible to |
|
46 |
the corresponding ST-80 class. |
|
47 |
If you encounter any incompatibilities, please forward a note |
|
48 |
describing the incompatibility verbal (i.e. no code) to the ST/X team. |
|
69 | 49 |
|
50 |
subclasses must redefine: #setValue: and #value |
|
51 |
(and optionally redefine #value:) |
|
223 | 52 |
|
53 |
[author:] |
|
54 |
Claus Gittinger |
|
68 | 55 |
" |
56 |
! ! |
|
57 |
||
441
b0d486981a62
unconditionally send a change notification;
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
58 |
!ValueModel class methodsFor:'instance creation'! |
62 | 59 |
|
60 |
new |
|
61 |
^ (super new) initialize |
|
62 |
! ! |
|
63 |
||
125 | 64 |
!ValueModel methodsFor:'accessing'! |
65 |
||
66 |
setValue:newValue |
|
67 |
"physically set my value, without change notifications" |
|
68 |
||
69 |
^ self subclassResponsibility |
|
70 |
! |
|
73 | 71 |
|
125 | 72 |
value |
73 |
"return my value" |
|
74 |
||
75 |
^ self subclassResponsibility |
|
76 |
! |
|
77 |
||
504 | 78 |
value:newValue |
79 |
"set my value & send change notifications to my dependents |
|
80 |
if it changed." |
|
81 |
||
82 |
|oldValue| |
|
125 | 83 |
|
504 | 84 |
oldValue := self value. |
85 |
oldValue ~~ newValue ifTrue:[ |
|
86 |
self setValue:newValue. |
|
87 |
self changed:#value |
|
88 |
] |
|
326
ab4e3df5c5d5
only ignore new value if identical to previous value.
Claus Gittinger <cg@exept.de>
parents:
231
diff
changeset
|
89 |
|
504 | 90 |
"Modified: 27.3.1997 / 15:14:04 / cg" |
62 | 91 |
! ! |
92 |
||
492 | 93 |
!ValueModel methodsFor:'converting'! |
94 |
||
95 |
compute:aBlock |
|
96 |
"return a BlockValue on the receiver, which computes aBlock" |
|
97 |
||
98 |
^ BlockValue with:aBlock arguments:(Array with:self) |
|
99 |
! ! |
|
100 |
||
69 | 101 |
!ValueModel methodsFor:'initialization'! |
102 |
||
103 |
initialize |
|
441
b0d486981a62
unconditionally send a change notification;
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
104 |
|
b0d486981a62
unconditionally send a change notification;
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
105 |
"Modified: 21.2.1997 / 16:29:38 / cg" |
69 | 106 |
! ! |
107 |
||
773
b6337f784d05
added #isBuffering (read not from trevis griggs)
Claus Gittinger <cg@exept.de>
parents:
504
diff
changeset
|
108 |
!ValueModel methodsFor:'queries'! |
b6337f784d05
added #isBuffering (read not from trevis griggs)
Claus Gittinger <cg@exept.de>
parents:
504
diff
changeset
|
109 |
|
b6337f784d05
added #isBuffering (read not from trevis griggs)
Claus Gittinger <cg@exept.de>
parents:
504
diff
changeset
|
110 |
isBuffering |
b6337f784d05
added #isBuffering (read not from trevis griggs)
Claus Gittinger <cg@exept.de>
parents:
504
diff
changeset
|
111 |
"return true, if the receiver is buffering something. |
b6337f784d05
added #isBuffering (read not from trevis griggs)
Claus Gittinger <cg@exept.de>
parents:
504
diff
changeset
|
112 |
For compatibility with BufferedValueHolder, false is returned here" |
b6337f784d05
added #isBuffering (read not from trevis griggs)
Claus Gittinger <cg@exept.de>
parents:
504
diff
changeset
|
113 |
|
b6337f784d05
added #isBuffering (read not from trevis griggs)
Claus Gittinger <cg@exept.de>
parents:
504
diff
changeset
|
114 |
^ false |
b6337f784d05
added #isBuffering (read not from trevis griggs)
Claus Gittinger <cg@exept.de>
parents:
504
diff
changeset
|
115 |
|
b6337f784d05
added #isBuffering (read not from trevis griggs)
Claus Gittinger <cg@exept.de>
parents:
504
diff
changeset
|
116 |
"Created: / 27.1.1998 / 12:12:08 / cg" |
b6337f784d05
added #isBuffering (read not from trevis griggs)
Claus Gittinger <cg@exept.de>
parents:
504
diff
changeset
|
117 |
! ! |
b6337f784d05
added #isBuffering (read not from trevis griggs)
Claus Gittinger <cg@exept.de>
parents:
504
diff
changeset
|
118 |
|
441
b0d486981a62
unconditionally send a change notification;
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
119 |
!ValueModel class methodsFor:'documentation'! |
129 | 120 |
|
121 |
version |
|
773
b6337f784d05
added #isBuffering (read not from trevis griggs)
Claus Gittinger <cg@exept.de>
parents:
504
diff
changeset
|
122 |
^ '$Header: /cvs/stx/stx/libview2/Attic/ValModel.st,v 1.22 1998-01-27 11:12:41 cg Exp $' |
129 | 123 |
! ! |