AspectAdaptor.st
author Claus Gittinger <cg@exept.de>
Sat, 27 Apr 1996 19:59:26 +0200
changeset 231 2fec6188bd28
parent 223 b65dc250db8d
child 238 a179b5d6152e
permissions -rw-r--r--
examples
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
74
claus
parents: 71
diff changeset
     1
"
claus
parents: 71
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
claus
parents: 71
diff changeset
     3
	      All Rights Reserved
claus
parents: 71
diff changeset
     4
claus
parents: 71
diff changeset
     5
 This software is furnished under a license and may be used
claus
parents: 71
diff changeset
     6
 only in accordance with the terms of that license and with the
claus
parents: 71
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
claus
parents: 71
diff changeset
     8
 be provided or otherwise made available to, or used by, any
claus
parents: 71
diff changeset
     9
 other person.  No title to or ownership of the software is
claus
parents: 71
diff changeset
    10
 hereby transferred.
claus
parents: 71
diff changeset
    11
"
claus
parents: 71
diff changeset
    12
125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    13
ProtocolAdaptor subclass:#AspectAdaptor
217
08a8e312d0e4 commentary
Claus Gittinger <cg@exept.de>
parents: 129
diff changeset
    14
	instanceVariableNames:'myAspect getMsg putMsg'
08a8e312d0e4 commentary
Claus Gittinger <cg@exept.de>
parents: 129
diff changeset
    15
	classVariableNames:''
08a8e312d0e4 commentary
Claus Gittinger <cg@exept.de>
parents: 129
diff changeset
    16
	poolDictionaries:''
08a8e312d0e4 commentary
Claus Gittinger <cg@exept.de>
parents: 129
diff changeset
    17
	category:'Interface-Support-Models'
69
claus
parents:
diff changeset
    18
!
claus
parents:
diff changeset
    19
claus
parents:
diff changeset
    20
!AspectAdaptor class methodsFor:'documentation'!
claus
parents:
diff changeset
    21
claus
parents:
diff changeset
    22
copyright
claus
parents:
diff changeset
    23
"
claus
parents:
diff changeset
    24
 COPYRIGHT (c) 1995 by Claus Gittinger
71
claus
parents: 69
diff changeset
    25
	      All Rights Reserved
69
claus
parents:
diff changeset
    26
claus
parents:
diff changeset
    27
 This software is furnished under a license and may be used
claus
parents:
diff changeset
    28
 only in accordance with the terms of that license and with the
claus
parents:
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
claus
parents:
diff changeset
    30
 be provided or otherwise made available to, or used by, any
claus
parents:
diff changeset
    31
 other person.  No title to or ownership of the software is
claus
parents:
diff changeset
    32
 hereby transferred.
claus
parents:
diff changeset
    33
"
claus
parents:
diff changeset
    34
!
claus
parents:
diff changeset
    35
claus
parents:
diff changeset
    36
documentation
claus
parents:
diff changeset
    37
"
claus
parents:
diff changeset
    38
    an AspectAdaptor forwards updates and change messages
claus
parents:
diff changeset
    39
    from/to a complex model.
claus
parents:
diff changeset
    40
claus
parents:
diff changeset
    41
    Consider the case where editFields are required for the
claus
parents:
diff changeset
    42
    elements (instance variables) of a more complex model.
claus
parents:
diff changeset
    43
    Without an aspect adaptor, you needed to copy the individual
claus
parents:
diff changeset
    44
    values out-of and into multiple valueHolders.
claus
parents:
diff changeset
    45
    An aspectAdaptor makes this easier, by playing model with
85
claus
parents: 83
diff changeset
    46
    value/value: symbols towards the editField, and forwarding changes and
69
claus
parents:
diff changeset
    47
    updates to/from the complex model using different aspect symbols.
claus
parents:
diff changeset
    48
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    49
    Notice: 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    50
        this class was implemented using protocol information
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    51
        from alpha testers - it may not be complete or compatible to
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    52
        the corresponding ST-80 class. 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    53
        If you encounter any incompatibilities, please forward a note 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    54
        describing the incompatibility verbal (i.e. no code) to the ST/X team.
217
08a8e312d0e4 commentary
Claus Gittinger <cg@exept.de>
parents: 129
diff changeset
    55
223
b65dc250db8d documentation
Claus Gittinger <cg@exept.de>
parents: 217
diff changeset
    56
    [author:]
b65dc250db8d documentation
Claus Gittinger <cg@exept.de>
parents: 217
diff changeset
    57
        Claus Gittinger
b65dc250db8d documentation
Claus Gittinger <cg@exept.de>
parents: 217
diff changeset
    58
217
08a8e312d0e4 commentary
Claus Gittinger <cg@exept.de>
parents: 129
diff changeset
    59
    [see also:]
08a8e312d0e4 commentary
Claus Gittinger <cg@exept.de>
parents: 129
diff changeset
    60
        ValueHolder Model
69
claus
parents:
diff changeset
    61
"
claus
parents:
diff changeset
    62
!
claus
parents:
diff changeset
    63
claus
parents:
diff changeset
    64
examples
claus
parents:
diff changeset
    65
"
claus
parents:
diff changeset
    66
    a dialog on a points x/y coordinates:
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    67
                                                                        [exBegin]
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    68
        |dialog data f|
69
claus
parents:
diff changeset
    69
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    70
        data := 0@0.
69
claus
parents:
diff changeset
    71
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    72
        dialog := DialogBox new.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    73
        dialog addTextLabel:'x:'.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    74
        f := dialog addInputFieldOn:(AspectAdaptor new
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    75
                                        subject:data; 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    76
                                        accessWith:#x 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    77
                                        assignWith:#x:).
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    78
        f converter:(PrintConverter new initForNumber).
69
claus
parents:
diff changeset
    79
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    80
        dialog addTextLabel:'y:'.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    81
        f := dialog addInputFieldOn:(AspectAdaptor new
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    82
                                        subject:data; 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    83
                                        forAspect:#y).
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    84
        f converter:(PrintConverter new initForNumber).
69
claus
parents:
diff changeset
    85
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    86
        dialog addOkButton.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    87
        data inspect.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    88
        dialog open.
69
claus
parents:
diff changeset
    89
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    90
        dialog accepted ifTrue:[
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    91
            Transcript showCr:'data now: ' , data printString
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    92
        ]
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    93
                                                                        [exEnd]
69
claus
parents:
diff changeset
    94
claus
parents:
diff changeset
    95
claus
parents:
diff changeset
    96
    a dialog on a four-field complex model:
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    97
                                                                        [exBegin]
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    98
        |dialog data dataModel|
69
claus
parents:
diff changeset
    99
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   100
        data := #('hello' 'one' 'two' 'three').
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   101
        dataModel := Plug new.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   102
        dataModel respondTo:#field1 with:[data at:1].
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   103
        dataModel respondTo:#field2 with:[data at:2].
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   104
        dataModel respondTo:#field3 with:[data at:3].
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   105
        dataModel respondTo:#field4 with:[data at:4].
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   106
        dataModel respondTo:#field1: with:[:arg | data at:1 put:arg].
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   107
        dataModel respondTo:#field2: with:[:arg | data at:2 put:arg].
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   108
        dataModel respondTo:#field3: with:[:arg | data at:3 put:arg].
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   109
        dataModel respondTo:#field4: with:[:arg | data at:4 put:arg].
69
claus
parents:
diff changeset
   110
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   111
        dialog := DialogBox new.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   112
        dialog addTextLabel:'1:'.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   113
        dialog addInputFieldOn:(AspectAdaptor new
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   114
                                        subject:dataModel; 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   115
                                        accessWith:#field1
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   116
                                        assignWith:#field1:). 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   117
        dialog addTextLabel:'2:'.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   118
        dialog addInputFieldOn:(AspectAdaptor new
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   119
                                        subject:dataModel; 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   120
                                        forAspect:#field2).
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   121
        dialog addTextLabel:'3:'.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   122
        dialog addInputFieldOn:(AspectAdaptor new
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   123
                                        subject:dataModel; 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   124
                                        accessWith:#field3
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   125
                                        assignWith:#field3:
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   126
                                        aspect:#field3). 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   127
        dialog addTextLabel:'4:'.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   128
        dialog addInputFieldOn:(AspectAdaptor new
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   129
                                        subject:dataModel; 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   130
                                        forAspect:#field4).
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   131
        dialog addOkButton.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   132
        dataModel inspect.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   133
        dialog open.
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   134
        dialog accepted ifTrue:[
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   135
            Transcript showCr:'data now: ' , data printString
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   136
        ]
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   137
                                                                        [exEnd]
69
claus
parents:
diff changeset
   138
"
claus
parents:
diff changeset
   139
! !
claus
parents:
diff changeset
   140
claus
parents:
diff changeset
   141
!AspectAdaptor class methodsFor:'instance creation'!
claus
parents:
diff changeset
   142
claus
parents:
diff changeset
   143
accessWith:getSelector assignWith:putSelector 
83
claus
parents: 74
diff changeset
   144
    "create and return an adaptor which uses getSelector to fetch a value
claus
parents: 74
diff changeset
   145
     and setSelector to change it."
claus
parents: 74
diff changeset
   146
69
claus
parents:
diff changeset
   147
    ^ (self new) accessWith:getSelector assignWith:putSelector
85
claus
parents: 83
diff changeset
   148
!
claus
parents: 83
diff changeset
   149
claus
parents: 83
diff changeset
   150
subject:anObject sendsUpdates:aBoolean accessWith:getSel assignWith:putSel aspect:aspect
claus
parents: 83
diff changeset
   151
    ^ (self subject:anObject sendsUpdates:aBoolean) 
claus
parents: 83
diff changeset
   152
		accessWith:getSel assignWith:putSel aspect:aspect
69
claus
parents:
diff changeset
   153
! !
claus
parents:
diff changeset
   154
125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   155
!AspectAdaptor methodsFor:'accessing-spec'!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   156
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   157
accessWith:getSelector assignWith:putSelector
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   158
    "setup the recevier to use getSelector to fetch a value
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   159
     and setSelector to change it."
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   160
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   161
    getMsg := getSelector.
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   162
    putMsg := putSelector
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   163
!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   164
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   165
accessWith:getSelector assignWith:putSelector aspect:aspectSymbol
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   166
    "setup the recevier to use getSelector to fetch a value
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   167
     and setSelector to change it."
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   168
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   169
    getMsg := getSelector.
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   170
    putMsg := putSelector.
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   171
    myAspect := aspectSymbol
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   172
!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   173
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   174
forAspect
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   175
    myAspect isNil ifTrue:[
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   176
	^ getMsg
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   177
    ].
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   178
    ^ myAspect
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   179
!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   180
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   181
forAspect:aSelector
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   182
    getMsg := myAspect := aSelector.
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   183
    putMsg := (aSelector , ':') asSymbol.
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   184
! !
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   185
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   186
!AspectAdaptor methodsFor:'accessing-value'!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   187
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   188
setValue:newValue
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   189
    |target oldValue|
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   190
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   191
    target := super value.
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   192
    oldValue := target perform:getMsg.
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   193
    oldValue ~~ newValue ifTrue:[
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   194
	target perform:putMsg with:newValue.
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   195
    ]
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   196
!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   197
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   198
value
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   199
    "translate a query for my value from my user
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   200
     into an aspect access towards my subject"
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   201
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   202
    |target|
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   203
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   204
    target := super value.
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   205
    ^ target perform:getMsg
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   206
!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   207
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   208
value:newValue
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   209
    |target oldValue|
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   210
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   211
    target := super value.
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   212
    oldValue := target perform:getMsg.
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   213
    oldValue ~~ newValue ifTrue:[
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   214
	target perform:putMsg with:newValue.
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   215
	subjectSendsUpdates ifFalse:[
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   216
	    self changed:#value
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   217
	]
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   218
    ]
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   219
! !
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   220
69
claus
parents:
diff changeset
   221
!AspectAdaptor methodsFor:'change & update'!
claus
parents:
diff changeset
   222
claus
parents:
diff changeset
   223
update:something with:aParameter from:changedObject
claus
parents:
diff changeset
   224
    "translate an update from the model into a #value-change
claus
parents:
diff changeset
   225
     via my depenedents ..."
claus
parents:
diff changeset
   226
claus
parents:
diff changeset
   227
    ((changedObject == subject)
claus
parents:
diff changeset
   228
    or:[changedObject == subjectChannel]) ifTrue:[
claus
parents:
diff changeset
   229
	something == self forAspect ifTrue:[
claus
parents:
diff changeset
   230
	    self changed:#value
claus
parents:
diff changeset
   231
	].
claus
parents:
diff changeset
   232
	^ self
claus
parents:
diff changeset
   233
    ].
claus
parents:
diff changeset
   234
! !
claus
parents:
diff changeset
   235
129
f890eaabc487 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   236
!AspectAdaptor class methodsFor:'documentation'!
f890eaabc487 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   237
f890eaabc487 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   238
version
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
   239
    ^ '$Header: /cvs/stx/stx/libview2/AspectAdaptor.st,v 1.12 1996-04-27 17:58:52 cg Exp $'
129
f890eaabc487 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   240
! !