|
Class: BufferedAspectAdaptor
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
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.
copyrightCOPYRIGHT (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.
accessing
-
trigger: aValueHolder
-
-
writeBufferedValues
-
set the value - this forwards a putMessage to the target
and sends out a changeNotification if the value did really change.
accessing-value
-
value
-
if I have no buffered value yet,
fetch it via an aspect access towards my subject
-
value: newValue
-
if I have no buffered value yet,
fetch it via an aspect access towards my subject
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
]
|
|