eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ProtocolAdaptor':

Home

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

Class: ProtocolAdaptor


Inheritance:

   Object
   |
   +--Model
      |
      +--ValueModel
         |
         +--ProtocolAdaptor
            |
            +--AspectAdaptor
            |
            +--DictionaryAdaptor

Package:
stx:libview2
Category:
Interface-Support-Models
Version:
rev: 1.18 date: 2023/07/15 18:32:21
user: cg
file: ProtocolAdaptor.st directory: libview2
module: stx stc-classLibrary: libview2

Description:


a ProtocolAdaptor allows access to embeded values in a
complex model and plays model towards the outside world.

Consider the case where editFields are required for the
elements (instance variables) of a more complex model.
Using ValueHolders, you had to copy the individual
values out-of and into multiple valueHolders.
A protocolAdaptor makes this easier, by playing model towards
the editField, returning a value from the complex model, 
and forwards changes to the complex model.

Notice: 
    since you can specify the aspect- and changeSymbols in most ST/X
    widgets, ProtocolAdapters are not always needed 
    (at least, if no accesspath is required). 
    However, if you want to apply widgets on objects which where not 
    originally designed as models (such as Arrays), ProtocolAdapters 
    are very handy.

Notice: 
    this class was implemented using protocol information
    from alpha testers - it may not be complete or compatible to
    the corresponding ST-80 class. 
    If you encounter any incompatibilities, please forward a note 
    describing the incompatibility verbal (i.e. no code) to the ST/X team.

copyright

COPYRIGHT (c) 1995 by Claus Gittinger 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  accessPath: aCollectionOfSelectors

o  subject: anObject

o  subject: anObject accessPath: aCollectionOfSelectors

o  subject: anObject sendsUpdates: aBoolean

o  subject: anObject sendsUpdates: aBoolean accessPath: aCollectionOfSelectors

o  subjectChannel: aValueProvider
Modified (format): / 25-07-2022 / 08:18:01 / cg

o  subjectChannel: aValueHolder accessPath: aCollectionOfSelectors

o  subjectChannel: aValueHolder sendsUpdates: aBoolean

o  subjectChannel: aValueHolder sendsUpdates: aBoolean accessPath: aCollectionOfSelectors


Instance protocol:

accessing
o  setValue: newValue
set the value in my subject or subjectChannel.

o  setValue: newValue usingSubject: anObject
set a value in anObject, using the selectors in accessPath.
A helper for setValue:.

o  subjectValue
return the value from my subject or subjectChannel.

o  value
return the value from my subject or subjectChannel.

o  value: newValue
set my value & send change notifications to my dependents
if it changed. But only if my subject does not itself
send change notifications (otherwise, we'd send double notifications).

o  valueUsingSubject: anObject
return the value from anObject, using the selectors in accessPath.
A helper for value.

accessing-spec
o  accessPath
return the access path

o  accessPath: aCollectionOfSelectors
set the access path

o  subject
return the subject

o  subject: anObject
set the subject

o  subjectChannel
return the subjectChannel

o  subjectChannel: aValueHolder
set the subjectChannel

o  subjectSendsUpdates
return true, if the subject sends updates itself
If true, the receiver will not send updates on changes

o  subjectSendsUpdates: aBoolean
set/clear the flag which states if the subject sends updates itself.
If true, the receiver will not send updates on changes

change & update
o  update: something with: aPArameter from: changedObject
translate updates from my subject into value-changes towards
my dependents. Since I have no specific aspect, every change is forwarded

initialization
o  initialize
setup, assuming that the subject does not send change notifications


Examples:


        |a obj|

        a := ProtocolAdaptor accessPath:#(1 2 3).
        obj := Array with:#(11 (121 122 123) 13)
                     with:#(21 (221 222 223) 23)
                     with:#(33 (321 322 323) 33).
        a valueUsingSubject:obj  
        |a obj|

        a := ProtocolAdaptor accessPath:#(1 2 origin).
        obj := Array with:(Array with:1@1 with:(1@2 corner:100@100))
                     with:(Array with:2@1 with:2@2)
                     with:(Array with:3@1 with:3@2).
        a valueUsingSubject:obj  
        |a model|

        a := ProtocolAdaptor accessPath:#(1 2 origin).
        model := (Array with:(Array with:1@1 with:(1@2 corner:100@100))
                     with:(Array with:2@1 with:2@2)
                     with:(Array with:3@1 with:3@2)) asValue.
        a subjectChannel:model.
        a value   


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Tue, 03 Dec 2024 17:15:31 GMT