5273
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1997 eXept Software AG
|
|
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 |
"
|
9280
|
12 |
"{ Package: 'stx:libbasic' }"
|
|
13 |
|
|
14 |
InterestConverter subclass:#WeakInterestConverter
|
|
15 |
instanceVariableNames:''
|
2656
|
16 |
classVariableNames:''
|
|
17 |
poolDictionaries:''
|
|
18 |
category:'Interface-Support-Models'
|
|
19 |
!
|
|
20 |
|
|
21 |
!WeakInterestConverter class methodsFor:'documentation'!
|
|
22 |
|
5273
|
23 |
copyright
|
|
24 |
"
|
|
25 |
COPYRIGHT (c) 1997 eXept Software AG
|
|
26 |
All Rights Reserved
|
|
27 |
|
|
28 |
This software is furnished under a license and may be used
|
|
29 |
only in accordance with the terms of that license and with the
|
|
30 |
inclusion of the above copyright notice. This software may not
|
|
31 |
be provided or otherwise made available to, or used by, any
|
|
32 |
other person. No title to or ownership of the software is
|
|
33 |
hereby transferred.
|
|
34 |
"
|
|
35 |
|
|
36 |
|
|
37 |
!
|
|
38 |
|
2656
|
39 |
documentation
|
|
40 |
"
|
|
41 |
these are much like InterestConverters; however, the reference to
|
|
42 |
the destination is weak, which allows for them to be garbage collected.
|
|
43 |
|
|
44 |
[author:]
|
|
45 |
Claus Gittinger
|
|
46 |
"
|
|
47 |
! !
|
|
48 |
|
|
49 |
!WeakInterestConverter class methodsFor:'instance creation'!
|
|
50 |
|
|
51 |
destination:anObject selector:aSelector
|
|
52 |
"create & return an interestConverter, which sends aSelector
|
|
53 |
to anObject when a change notification arrives"
|
|
54 |
|
|
55 |
^ self basicNew destination:anObject selector:aSelector
|
|
56 |
|
|
57 |
"Created: 21.5.1997 / 14:08:49 / cg"
|
|
58 |
!
|
|
59 |
|
|
60 |
destination:anObject selector:aSelector aspect:aspect
|
|
61 |
"create & return an interestConverter, which sends aSelector
|
|
62 |
to anObject when a change notification for aspect arrives"
|
|
63 |
|
|
64 |
^ self basicNew destination:anObject selector:aSelector aspect:aspect
|
|
65 |
|
|
66 |
"Created: 21.5.1997 / 14:08:49 / cg"
|
|
67 |
! !
|
|
68 |
|
|
69 |
!WeakInterestConverter methodsFor:'accessing'!
|
|
70 |
|
|
71 |
aspect
|
|
72 |
"return my aspect (if any)"
|
|
73 |
|
|
74 |
^ aspect
|
|
75 |
|
|
76 |
"Created: 21.5.1997 / 14:08:49 / cg"
|
|
77 |
!
|
|
78 |
|
|
79 |
destination
|
|
80 |
"return my destination"
|
|
81 |
|
9280
|
82 |
^ destination at:1
|
2656
|
83 |
!
|
|
84 |
|
|
85 |
destination:dest selector:sel
|
|
86 |
"set destination and selector"
|
|
87 |
|
9280
|
88 |
destination := WeakArray with:dest.
|
2656
|
89 |
selector := sel
|
|
90 |
|
|
91 |
"Created: 21.5.1997 / 14:08:49 / cg"
|
|
92 |
!
|
|
93 |
|
|
94 |
destination:dest selector:sel aspect:a
|
|
95 |
"set destination, selector and aspect"
|
|
96 |
|
9280
|
97 |
destination := WeakArray with:dest.
|
2656
|
98 |
selector := sel.
|
|
99 |
aspect := a
|
|
100 |
|
|
101 |
"Created: 21.5.1997 / 14:08:49 / cg"
|
|
102 |
! !
|
|
103 |
|
|
104 |
!WeakInterestConverter methodsFor:'change & update'!
|
|
105 |
|
|
106 |
update:something with:aParameter from:someObject
|
9280
|
107 |
|realDestination|
|
2656
|
108 |
|
|
109 |
(aspect isNil or:[aspect == something]) ifTrue:[
|
9280
|
110 |
realDestination := destination at:1.
|
|
111 |
realDestination notNil ifTrue:[
|
|
112 |
realDestination perform:selector
|
2656
|
113 |
]
|
|
114 |
]
|
|
115 |
|
|
116 |
"Modified: 8.3.1996 / 22:41:53 / cg"
|
|
117 |
"Created: 21.5.1997 / 14:08:49 / cg"
|
|
118 |
! !
|
|
119 |
|
|
120 |
!WeakInterestConverter class methodsFor:'documentation'!
|
|
121 |
|
|
122 |
version
|
13745
|
123 |
^ '$Header: /cvs/stx/stx/libbasic/WeakInterestConverter.st,v 1.4 2011-09-29 11:19:04 cg Exp $'
|
2656
|
124 |
! !
|