eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'BufferedValueHolder':

Home

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

Class: BufferedValueHolder


Inheritance:

   Object
   |
   +--Model
      |
      +--ValueModel
         |
         +--ValueHolder
            |
            +--BufferedValueHolder

Package:
stx:libview2
Category:
Interface-Support-Models
Version:
rev: 1.18 date: 2023/07/15 18:34:06
user: cg
file: BufferedValueHolder.st directory: libview2
module: stx stc-classLibrary: libview2

Description:


a bufferedValueHolder keeps a temporary copy of the realHolders value,
and only does a real store of the value when triggered.
Triggering is done by depending on a trigger object's value, which is
typically a ValueHolder on a boolean, which is set by an ok-button.

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.

copyright

COPYRIGHT (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.

Class protocol:

initialization
o  intialize

instance creation
o  subject: someModel triggerChannel: aTrigger
return a new BufferedValueHolder offering a buffered copy of someModels
value - only updating this value, when aTrigger changes to true.


Instance protocol:

accessing
o  setValue: anObject
set my value without notification.

o  subject: someModel

o  value
return my value

accessing-channels
o  triggerChannel: aTrigger

change & update
o  update: something with: aParameter from: changedObject
now, store the buffered value into the subject

initialization
o  initialize
(comment from inherited method)
just to ignore initialize to objects which do not need it

queries
o  isBuffering
return true, if the receiver is currently buffering something
(i.e. its value has been assigned)


Examples:


unbuffered (values are changed, even if not accepted, iff a field is left with Return or accept is done in a field):
    |firstName lastName dialog|

    firstName :=  'foo' asValue.
    lastName := 'bar' asValue.

    dialog := Dialog new.
    (dialog addTextLabel:'Name:') layout:#left.
    dialog addInputFieldOn:firstName.
    dialog addVerticalSpace.
    (dialog addTextLabel:'Address:') layout:#left.
    dialog addInputFieldOn:lastName.

    dialog addAbortButton; addOkButton.

    dialog open.

    Transcript show:firstName value; show:' '; showCR:lastName value
buffered (values are only stored when accepted; undo reloads old values) (use an instance of TriggerValue. If a ValueHolder was used, we had to temporarily set its value back to nil, to have the change really be forwarded to its dependends)
    |firstName lastName trigger dialog|

    firstName :=  'foo' asValue.
    lastName := 'bar' asValue.
    trigger := TriggerValue new.

    dialog := Dialog new.
    (dialog addTextLabel:'Name:') layout:#left.
    dialog addInputFieldOn:(BufferedValueHolder
                                subject:firstName
                                triggerChannel:trigger).
    dialog addVerticalSpace.
    (dialog addTextLabel:'Address:') layout:#left.
    dialog addInputFieldOn:(BufferedValueHolder
                                subject:lastName
                                triggerChannel:trigger).

    dialog addAbortButton; 
           addButton:(Button new 
                            label:'undo'; 
                            action:[trigger value:false]);
           addOkButton.

    dialog open.
    dialog accepted ifTrue:[
        trigger value:true
    ].

    Transcript show:firstName value; show:' '; showCR:lastName value


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 16:15:36 GMT