|
Class: DictionaryAdaptor
Object
|
+--Model
|
+--ValueModel
|
+--ProtocolAdaptor
|
+--DictionaryAdaptor
- Package:
- stx:libview2
- Category:
- Interface-Support-Models
- Version:
- rev:
1.4
date: 2023/07/15 18:34:15
- user: cg
- file: DictionaryAdaptor.st directory: libview2
- module: stx stc-classLibrary: libview2
- Author:
- Stefan Vogel (stefan@zwerg)
Similar to AspectAdaptor, but accesses a Dictionary instead of
a classes instance variables.
[instance variables:]
[class variables:]
instance creation
-
forAspect: anAspect
-
create and return a new adaptor, which forwards requests
to anObject, using anAspect to access a Dictionary.
The returned object can be used in place of a ValueHolder
-
subject: anObject sendsUpdates: aBoolean aspect: aspect
-
create and return a new adaptor, which forwards requests
to anObject, using #at:aspect and #at:aspect put: for access.
The returned object can be used in place of a ValueHolder
accessing-spec
-
aspect: aSelector
-
set the adapters change aspect - this is the aspect of the update message,
on which the adaptor reacts
-
forAspect
-
get the adapters aspect
-
forAspect: aSelector
-
set the adapters aspect
accessing-value
-
setValue: newValue
-
set the value - this forwards a putMessage to the target
-
value
-
translate a query for my value from my user
into an aspect access towards my subject
-
value: newValue
-
set the value - this changes the target with #at:put:
and sends out a changeNotification if the value did really change.
change & update
-
update: something with: aParameter from: changedObject
-
translate an update from the model into a #value-change
via my depenedents ...
|dialog dict dataModel|
dict := Dictionary new.
dict
at:#field1 put:'hello';
at:#field2 put:'one';
at:#field3 put:'two';
at:#field4 put:'three'.
dialog := DialogBox new.
dialog addTextLabel:'1:'.
dialog addInputFieldOn:(DictionaryAdaptor new
subject:dict;
aspect:#field1).
dialog addTextLabel:'2:'.
dialog addInputFieldOn:(DictionaryAdaptor new
subject:dict;
forAspect:#field2).
dialog addTextLabel:'3:'.
dialog addInputFieldOn:(DictionaryAdaptor new
subject:dict;
aspect:#field3).
dialog addTextLabel:'4:'.
dialog addInputFieldOn:(DictionaryAdaptor new
subject:dict;
forAspect:#field4).
dialog addOkButton.
dict inspect.
dialog open.
dialog accepted ifTrue:[
Transcript showCR:'data now: ' , dict printString
]
|
|