author | Claus Gittinger <cg@exept.de> |
Thu, 24 Apr 1997 16:23:20 +0200 | |
changeset 2585 | 6c25622320aa |
parent 1801 | 74d0e3858ded |
child 2716 | 08cf98cf1a53 |
permissions | -rw-r--r-- |
1074 | 1 |
Object subclass:#InterestConverter |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
2 |
instanceVariableNames:'destination selector aspect' |
1074 | 3 |
classVariableNames:'' |
4 |
poolDictionaries:'' |
|
5 |
category:'Interface-Support-Models' |
|
6 |
! |
|
7 |
||
8 |
!InterestConverter class methodsFor:'documentation'! |
|
9 |
||
10 |
documentation |
|
11 |
" |
|
12 |
instances convert update messages into messages as setup via |
|
13 |
#onChangeSend:to. |
|
14 |
This is a temporary kludge and will be replaced by a more intelligent |
|
15 |
DependencyCollection class in the future. |
|
1291 | 16 |
|
17 |
[author:] |
|
18 |
Claus Gittinger |
|
1074 | 19 |
" |
20 |
! |
|
21 |
||
22 |
examples |
|
23 |
" |
|
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
24 |
#onChangeSend:to / #retractInterestsIn: |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
25 |
interested in any change: |
1315 | 26 |
[exBegin] |
1074 | 27 |
|p b| |
28 |
||
1422 | 29 |
b := [Transcript showCR:'--> notification: point has changed']. |
1074 | 30 |
|
31 |
p := Point new. |
|
32 |
p onChangeSend:#value to:b. |
|
33 |
Delay waitForSeconds:1. |
|
1422 | 34 |
Transcript showCR:'sending change ...'. |
1074 | 35 |
p changed. |
36 |
p retractInterestsFor:b. |
|
37 |
Delay waitForSeconds:1. |
|
1422 | 38 |
Transcript showCR:'sending change ...'. |
1074 | 39 |
p changed. |
1315 | 40 |
[exEnd] |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
41 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
42 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
43 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
44 |
#expressInterestIn:for:sendBack / #retractInterestIn:for: |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
45 |
interested in a specific change: |
1315 | 46 |
[exBegin] |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
47 |
|p b| |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
48 |
|
1422 | 49 |
b := [Transcript showCR:'the point changed']. |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
50 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
51 |
p := Point new. |
1422 | 52 |
Transcript showCR:'interest in #foo'. |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
53 |
p expressInterestIn:#foo for:b sendBack:#value. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
54 |
p x:1. |
1422 | 55 |
Transcript showCR:'now changing #bar'. |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
56 |
p changed:#bar. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
57 |
Transcript cr. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
58 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
59 |
Delay waitForSeconds:1. |
1422 | 60 |
Transcript showCR:'now changing #foo'. |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
61 |
p changed:#foo. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
62 |
Transcript cr. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
63 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
64 |
Delay waitForSeconds:1. |
1422 | 65 |
Transcript showCR:'no more interest in #foo'. |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
66 |
p retractInterestIn:#foo for:b. |
1422 | 67 |
Transcript showCR:'now changing #foo'. |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
68 |
p changed:#foo. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
69 |
Transcript cr. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
70 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
71 |
Delay waitForSeconds:1. |
1422 | 72 |
Transcript showCR:'interest in #bar now'. |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
73 |
p expressInterestIn:#bar for:b sendBack:#value. |
1422 | 74 |
Transcript showCR:'now changing #foo'. |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
75 |
p changed:#foo. |
1422 | 76 |
Transcript showCR:'now changing #bar'. |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
77 |
p changed:#bar. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
78 |
Transcript cr. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
79 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
80 |
Delay waitForSeconds:1. |
1422 | 81 |
Transcript showCR:'interest in #foo now'. |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
82 |
p expressInterestIn:#foo for:b sendBack:#value. |
1422 | 83 |
Transcript showCR:'now changing #foo'. |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
84 |
p changed:#foo. |
1422 | 85 |
Transcript showCR:'now changing #bar'. |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
86 |
p changed:#bar. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
87 |
Transcript cr. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
88 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
89 |
Delay waitForSeconds:1. |
1422 | 90 |
Transcript showCR:'no more interests'. |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
91 |
p retractInterestsFor:b. |
1422 | 92 |
Transcript showCR:'now changing #foo'. |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
93 |
p changed:#foo. |
1422 | 94 |
Transcript showCR:'now changing #bar'. |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
95 |
p changed:#bar. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
96 |
Transcript cr. |
1315 | 97 |
[exEnd] |
1074 | 98 |
" |
99 |
! ! |
|
100 |
||
101 |
!InterestConverter class methodsFor:'instance creation'! |
|
102 |
||
103 |
destination:anObject selector:aSelector |
|
104 |
^ self basicNew destination:anObject selector:aSelector |
|
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
105 |
! |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
106 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
107 |
destination:anObject selector:aSelector aspect:aspect |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
108 |
^ self basicNew destination:anObject selector:aSelector aspect:aspect |
1074 | 109 |
! ! |
110 |
||
111 |
!InterestConverter methodsFor:'accessing'! |
|
112 |
||
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
113 |
aspect |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
114 |
^ aspect |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
115 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
116 |
"Created: 8.3.1996 / 23:00:37 / cg" |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
117 |
! |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
118 |
|
1074 | 119 |
destination |
120 |
^ destination |
|
121 |
||
122 |
"Created: 7.3.1996 / 10:57:01 / cg" |
|
123 |
! |
|
124 |
||
125 |
destination:dest selector:sel |
|
126 |
destination := dest. |
|
127 |
selector := sel |
|
128 |
||
129 |
"Created: 7.3.1996 / 10:49:13 / cg" |
|
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
130 |
! |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
131 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
132 |
destination:dest selector:sel aspect:a |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
133 |
destination := dest. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
134 |
selector := sel. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
135 |
aspect := a |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
136 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
137 |
"Created: 8.3.1996 / 22:42:03 / cg" |
1074 | 138 |
! ! |
139 |
||
140 |
!InterestConverter methodsFor:'change & update'! |
|
141 |
||
142 |
update:something with:aParameter from:someObject |
|
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
143 |
(aspect isNil or:[aspect == something]) ifTrue:[ |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
144 |
destination perform:selector |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
145 |
] |
1074 | 146 |
|
147 |
"Created: 7.3.1996 / 10:14:30 / cg" |
|
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
148 |
"Modified: 8.3.1996 / 22:41:53 / cg" |
1074 | 149 |
! ! |
150 |
||
151 |
!InterestConverter class methodsFor:'documentation'! |
|
152 |
||
153 |
version |
|
1801 | 154 |
^ '$Header: /cvs/stx/stx/libbasic/Attic/InterestC.st,v 1.6 1996-10-22 19:33:43 cg Exp $' |
1074 | 155 |
! ! |