author | Claus Gittinger <cg@exept.de> |
Thu, 09 May 1996 11:23:15 +0200 | |
changeset 255 | 9821fb092e99 |
parent 231 | 2fec6188bd28 |
child 326 | ab4e3df5c5d5 |
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 |
|
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 |
||
62 | 58 |
!ValueModel class methodsFor:'instance creation'! |
59 |
||
60 |
new |
|
61 |
^ (super new) initialize |
|
62 |
! ! |
|
63 |
||
125 | 64 |
!ValueModel methodsFor:'accessing'! |
65 |
||
66 |
accept |
|
67 |
accepted := true |
|
68 |
! |
|
62 | 69 |
|
125 | 70 |
accepted |
71 |
^ accepted |
|
72 |
! |
|
73 |
||
74 |
setValue:newValue |
|
75 |
"physically set my value, without change notifications" |
|
76 |
||
77 |
^ self subclassResponsibility |
|
78 |
! |
|
73 | 79 |
|
125 | 80 |
value |
81 |
"return my value" |
|
82 |
||
83 |
^ self subclassResponsibility |
|
84 |
! |
|
85 |
||
86 |
value:anObject |
|
87 |
"set my value, if it changed, send change notifications to my dependents." |
|
88 |
||
89 |
|oldValue| |
|
90 |
||
91 |
oldValue := self value. |
|
92 |
self setValue:anObject. |
|
93 |
anObject ~= oldValue ifTrue:[ |
|
94 |
"/ self notifyChange:#value |
|
95 |
self changed:#value |
|
96 |
] |
|
62 | 97 |
! ! |
98 |
||
69 | 99 |
!ValueModel methodsFor:'initialization'! |
100 |
||
101 |
initialize |
|
102 |
accepted := false |
|
103 |
! ! |
|
104 |
||
129 | 105 |
!ValueModel class methodsFor:'documentation'! |
106 |
||
107 |
version |
|
231 | 108 |
^ '$Header: /cvs/stx/stx/libview2/ValueModel.st,v 1.17 1996-04-27 17:59:19 cg Exp $' |
129 | 109 |
! ! |