author | Claus Gittinger <cg@exept.de> |
Thu, 25 Apr 1996 18:20:46 +0200 | |
changeset 1290 | 15ba3221b89b |
parent 1098 | e8543399e2a0 |
child 1291 | 74d61fd64c4a |
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. |
|
16 |
" |
|
17 |
! |
|
18 |
||
19 |
examples |
|
20 |
" |
|
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
21 |
#onChangeSend:to / #retractInterestsIn: |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
22 |
interested in any change: |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
23 |
|
1074 | 24 |
|p b| |
25 |
||
26 |
b := [Transcript showCr:'--> notification: point has changed']. |
|
27 |
||
28 |
p := Point new. |
|
29 |
p onChangeSend:#value to:b. |
|
30 |
Delay waitForSeconds:1. |
|
31 |
Transcript showCr:'sending change ...'. |
|
32 |
p changed. |
|
33 |
p retractInterestsFor:b. |
|
34 |
Delay waitForSeconds:1. |
|
35 |
Transcript showCr:'sending change ...'. |
|
36 |
p changed. |
|
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
37 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
38 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
39 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
40 |
|
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 |
#expressInterestIn:for:sendBack / #retractInterestIn:for: |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
44 |
interested in a specific change: |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
45 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
46 |
|p b| |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
47 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
48 |
b := [Transcript showCr:'the point changed']. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
49 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
50 |
p := Point new. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
51 |
Transcript showCr:'interest in #foo'. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
52 |
p expressInterestIn:#foo for:b sendBack:#value. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
53 |
p x:1. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
54 |
Transcript showCr:'now changing #bar'. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
55 |
p changed:#bar. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
56 |
Transcript cr. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
57 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
58 |
Delay waitForSeconds:1. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
59 |
Transcript showCr:'now changing #foo'. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
60 |
p changed:#foo. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
61 |
Transcript cr. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
62 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
63 |
Delay waitForSeconds:1. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
64 |
Transcript showCr:'no more interest in #foo'. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
65 |
p retractInterestIn:#foo for:b. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
66 |
Transcript showCr:'now changing #foo'. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
67 |
p changed:#foo. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
68 |
Transcript cr. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
69 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
70 |
Delay waitForSeconds:1. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
71 |
Transcript showCr:'interest in #bar now'. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
72 |
p expressInterestIn:#bar for:b sendBack:#value. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
73 |
Transcript showCr:'now changing #foo'. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
74 |
p changed:#foo. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
75 |
Transcript showCr:'now changing #bar'. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
76 |
p changed:#bar. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
77 |
Transcript cr. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
78 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
79 |
Delay waitForSeconds:1. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
80 |
Transcript showCr:'interest in #foo now'. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
81 |
p expressInterestIn:#foo for:b sendBack:#value. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
82 |
Transcript showCr:'now changing #foo'. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
83 |
p changed:#foo. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
84 |
Transcript showCr:'now changing #bar'. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
85 |
p changed:#bar. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
86 |
Transcript cr. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
87 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
88 |
Delay waitForSeconds:1. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
89 |
Transcript showCr:'no more interests'. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
90 |
p retractInterestsFor:b. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
91 |
Transcript showCr:'now changing #foo'. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
92 |
p changed:#foo. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
93 |
Transcript showCr:'now changing #bar'. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
94 |
p changed:#bar. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
95 |
Transcript cr. |
1074 | 96 |
" |
97 |
! |
|
98 |
||
99 |
history |
|
100 |
||
101 |
"Created: 7.3.1996 / 10:08:55 / cg" |
|
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
102 |
"Modified: 8.3.1996 / 22:40:11 / cg" |
1074 | 103 |
! ! |
104 |
||
105 |
!InterestConverter class methodsFor:'instance creation'! |
|
106 |
||
107 |
destination:anObject selector:aSelector |
|
108 |
^ self basicNew destination:anObject selector:aSelector |
|
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
109 |
! |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
110 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
111 |
destination:anObject selector:aSelector aspect:aspect |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
112 |
^ self basicNew destination:anObject selector:aSelector aspect:aspect |
1074 | 113 |
! ! |
114 |
||
115 |
!InterestConverter methodsFor:'accessing'! |
|
116 |
||
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
117 |
aspect |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
118 |
^ aspect |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
119 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
120 |
"Created: 8.3.1996 / 23:00:37 / cg" |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
121 |
! |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
122 |
|
1074 | 123 |
destination |
124 |
^ destination |
|
125 |
||
126 |
"Created: 7.3.1996 / 10:57:01 / cg" |
|
127 |
! |
|
128 |
||
129 |
destination:dest selector:sel |
|
130 |
destination := dest. |
|
131 |
selector := sel |
|
132 |
||
133 |
"Created: 7.3.1996 / 10:49:13 / cg" |
|
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
134 |
! |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
135 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
136 |
destination:dest selector:sel aspect:a |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
137 |
destination := dest. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
138 |
selector := sel. |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
139 |
aspect := a |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
140 |
|
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
141 |
"Created: 8.3.1996 / 22:42:03 / cg" |
1074 | 142 |
! ! |
143 |
||
144 |
!InterestConverter methodsFor:'change & update'! |
|
145 |
||
146 |
update:something with:aParameter from:someObject |
|
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
147 |
(aspect isNil or:[aspect == something]) ifTrue:[ |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
148 |
destination perform:selector |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
149 |
] |
1074 | 150 |
|
151 |
"Created: 7.3.1996 / 10:14:30 / cg" |
|
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
152 |
"Modified: 8.3.1996 / 22:41:53 / cg" |
1074 | 153 |
! ! |
154 |
||
155 |
!InterestConverter class methodsFor:'documentation'! |
|
156 |
||
157 |
version |
|
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
158 |
^ '$Header: /cvs/stx/stx/libbasic/InterestConverter.st,v 1.2 1996-03-08 22:03:47 cg Exp $' |
1074 | 159 |
! ! |