|
Class: InterestConverter
Object
|
+--InterestConverter
|
+--InterestConverterWithParameters
|
+--WeakInterestConverter
- Package:
- stx:libbasic
- Category:
- Interface-Support-Models
- Version:
- rev:
1.23
date: 2021/12/03 16:29:06
- user: cg
- file: InterestConverter.st directory: libbasic
- module: stx stc-classLibrary: libbasic
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.
copyrightCOPYRIGHT (c) 1996 by Claus Gittinger / eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
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: anAspect 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.
|
|