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.23 date: 2021/12/03 16:29:06
user: cg
file: InterestConverter.st directory: libbasic
module: stx stc-classLibrary: libbasic

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.

copyright

COPYRIGHT (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.

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: anAspect 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.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sun, 21 Jul 2024 23:42:39 GMT