eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'InterestConverter':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: InterestConverter


Inheritance:

   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

Description:


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.


Class protocol:

instance creation
o  destination: anObject selector: aSelector
create & return an interestConverter, which sends aSelector
to anObject when a change notification arrives

o  destination: anObject selector: aSelector aspect: aspect
create & return an interestConverter, which sends aSelector
to anObject when a change notification for aspect arrives


Instance protocol:

accessing
o  aspect
return my aspect (if any)

o  destination

o  destination: dest selector: sel

o  destination: dest selector: sel aspect: a

o  selector

change & update
o  update: something with: aParameter from: someObject
(comment from inherited method)
dependent is notified of some change -
Default is to try update:with:

printing & storing
o  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
o  isInterestConverter


Examples:


#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.


ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Tue, 23 Apr 2024 09:02:28 GMT