eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'DictionaryAdaptor':

Home

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

Class: DictionaryAdaptor


Inheritance:

   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)

Description:


Similar to AspectAdaptor, but accesses a Dictionary instead of
a classes instance variables.


[instance variables:]

[class variables:]


Related information:



Class protocol:

instance creation
o  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

o  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


Instance protocol:

accessing-spec
o  aspect: aSelector
set the adapters change aspect - this is the aspect of the update message,
on which the adaptor reacts

o  forAspect
get the adapters aspect

o  forAspect: aSelector
set the adapters aspect

accessing-value
o  setValue: newValue
set the value - this forwards a putMessage to the target

o  value
translate a query for my value from my user
into an aspect access towards my subject

o  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
o  update: something with: aParameter from: changedObject
translate an update from the model into a #value-change
via my depenedents ...


Examples:


        |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
        ]


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 04:45:21 GMT