eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'BufferedAspectAdaptor':

Home

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

Class: BufferedAspectAdaptor


Inheritance:

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

Package:
stx:libview2
Category:
Interface-Support-Models
Version:
rev: 1.1 date: 2021/12/06 17:14:16
user: cg
file: BufferedAspectAdaptor.st directory: libview2
module: stx stc-classLibrary: libview2

Description:


I behave similar to an AspectAdaptor in that I fetch my value from and forward updates to a complex model.
However, any changed value will be temporarily buffered and only written tothe target subject
when my trigger changes.
Usefull, if you need holders on aspects of a complex model (such as a dictionary),
but only want the values to be changed there when the user finally clicks on an accept button.
For this, set the trigger to be the dialog's acceptChannel.

See examples and compare with examples in AspectAdaptor.

copyright

COPYRIGHT (c) 2021 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 protocol:

accessing
o  trigger: aValueHolder

o  writeBufferedValues
set the value - this forwards a putMessage to the target
and sends out a changeNotification if the value did really change.

accessing-value
o  value
if I have no buffered value yet,
fetch it via an aspect access towards my subject

o  value: newValue
if I have no buffered value yet,
fetch it via an aspect access towards my subject


Examples:


a dialog on elements of a dictionary: (notice: the dicationary elements only change if the dialog is accepted with OK; otherwise, they remain unchanged)
    |dialog data|

    data := JSONObject new
                at:'Name' put:'Fritz';
                at:'Tel' put:'1234567';
                at:'City' put:'Stuttgart';
                yourself.

    dialog := DialogBox new.
    dialog addTextLabel:'Name:'.
    dialog addInputFieldOn:(BufferedAspectAdaptor new
                                    trigger:(dialog acceptChannel);
                                    subject:data; 
                                    accessWith:#Name
                                    assignWith:#Name:). 
    dialog addTextLabel:'Tel:'.
    dialog addInputFieldOn:(BufferedAspectAdaptor new
                                    trigger:(dialog acceptChannel);
                                    subject:data; 
                                    forAspect:#Tel).
    dialog addTextLabel:'City:'.
    dialog addInputFieldOn:(BufferedAspectAdaptor new
                                    trigger:(dialog acceptChannel);
                                    subject:data; 
                                    forAspect:#City).
    dialog addOkButton.
    data inspect.
    dialog open.
    dialog accepted ifTrue:[
        Transcript showCR:'data now: ' , data printString
    ]


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 12:46:49 GMT