|
Class: ProtocolAdaptor
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
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.
copyrightCOPYRIGHT (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.
instance creation
-
accessPath: aCollectionOfSelectors
-
-
subject: anObject
-
-
subject: anObject accessPath: aCollectionOfSelectors
-
-
subject: anObject sendsUpdates: aBoolean
-
-
subject: anObject sendsUpdates: aBoolean accessPath: aCollectionOfSelectors
-
-
subjectChannel: aValueProvider
-
Modified (format): / 25-07-2022 / 08:18:01 / cg
-
subjectChannel: aValueHolder accessPath: aCollectionOfSelectors
-
-
subjectChannel: aValueHolder sendsUpdates: aBoolean
-
-
subjectChannel: aValueHolder sendsUpdates: aBoolean accessPath: aCollectionOfSelectors
-
accessing
-
setValue: newValue
-
set the value in my subject or subjectChannel.
-
setValue: newValue usingSubject: anObject
-
set a value in anObject, using the selectors in accessPath.
A helper for setValue:.
-
subjectValue
-
return the value from my subject or subjectChannel.
-
value
-
return the value from my subject or subjectChannel.
-
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).
-
valueUsingSubject: anObject
-
return the value from anObject, using the selectors in accessPath.
A helper for value.
accessing-spec
-
accessPath
-
return the access path
-
accessPath: aCollectionOfSelectors
-
set the access path
-
subject
-
return the subject
-
subject: anObject
-
set the subject
-
subjectChannel
-
return the subjectChannel
-
subjectChannel: aValueHolder
-
set the subjectChannel
-
subjectSendsUpdates
-
return true, if the subject sends updates itself
If true, the receiver will not send updates on changes
-
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
-
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
-
initialize
-
setup, assuming that the subject does not send change notifications
|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
|
|