|
Class: InterestConverter
Object
|
+--InterestConverter
|
+--InterestConverterWithParameters
|
+--WeakInterestConverter
- Package:
- stx:libbasic
- Category:
- Interface-Support-Models
- Version:
- rev:
1.18
date: 2019/06/28 07:03:35
- user: cg
- file: InterestConverter.st directory: libbasic
- module: stx stc-classLibrary: libbasic
- Author:
- Claus Gittinger
instances convert update messages into messages as setup via
#onChangeSend:to:.
This is a temporary kludge and will be replaced by a more intelligent
DependencyCollection class in the future.
instance creation
-
destination: anObject selector: aSelector
-
create & return an interestConverter, which sends aSelector
to anObject when a change notification arrives
-
destination: anObject selector: aSelector aspect: aspect
-
create & return an interestConverter, which sends aSelector
to anObject when a change notification for aspect arrives
accessing
-
aspect
-
return my aspect (if any)
-
destination
-
-
destination: dest selector: sel
-
-
destination: dest selector: sel aspect: a
-
-
selector
-
change & update
-
update: something with: aParameter from: someObject
-
(comment from inherited method)
dependent is notified of some change -
Default is to try update:with:
printing & storing
-
displayOn: aGCOrStream
-
Compatibility
append a printed desription on some stream (Dolphin, Squeak)
OR:
display the receiver in a graphicsContext at 0@0 (ST80).
This method allows for any object to be displayed in some view
(although the fallBack is to display its printString ...)
testing
-
isInterestConverter
-
#onChangeSend:to / #retractInterestsIn:
interested in any change:
|p b|
b := [Transcript showCR:'--> notification: point has changed'].
p := Point new.
p onChangeSend:#value to:b.
Delay waitForSeconds:1.
Transcript showCR:'sending change ...'.
p changed.
Transcript showCR:'retracting ...'.
p retractInterestsFor:b.
Delay waitForSeconds:1.
Transcript showCR:'sending change ...'.
p changed.
|
#expressInterestIn:for:sendBack / #retractInterestIn:for:
interested in a specific change:
|p b|
b := [Transcript showCR:'the point changed'].
p := Point new.
Transcript showCR:'interest in #foo'.
p expressInterestIn:#foo for:b sendBack:#value.
p x:1.
Transcript showCR:'now changing #bar'.
p changed:#bar.
Transcript cr.
Delay waitForSeconds:1.
Transcript showCR:'now changing #foo'.
p changed:#foo.
Transcript cr.
Delay waitForSeconds:1.
Transcript showCR:'no more interest in #foo'.
p retractInterestIn:#foo for:b.
Transcript showCR:'now changing #foo'.
p changed:#foo.
Transcript cr.
Delay waitForSeconds:1.
Transcript showCR:'interest in #bar now'.
p expressInterestIn:#bar for:b sendBack:#value.
Transcript showCR:'now changing #foo'.
p changed:#foo.
Transcript showCR:'now changing #bar'.
p changed:#bar.
Transcript cr.
Delay waitForSeconds:1.
Transcript showCR:'interest in #foo now'.
p expressInterestIn:#foo for:b sendBack:#value.
Transcript showCR:'now changing #foo'.
p changed:#foo.
Transcript showCR:'now changing #bar'.
p changed:#bar.
Transcript cr.
Delay waitForSeconds:1.
Transcript showCR:'no more interests'.
p retractInterestsFor:b.
Transcript showCR:'now changing #foo'.
p changed:#foo.
Transcript showCR:'now changing #bar'.
p changed:#bar.
Transcript cr.
|
|