ValModel.st
author Claus Gittinger <cg@exept.de>
Tue, 14 Jan 1997 18:02:37 +0100
changeset 365 47e0d48fd769
parent 326 ab4e3df5c5d5
child 441 b0d486981a62
permissions -rw-r--r--
commentary
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
75
claus
parents: 73
diff changeset
     1
"
claus
parents: 73
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
claus
parents: 73
diff changeset
     3
	      All Rights Reserved
claus
parents: 73
diff changeset
     4
claus
parents: 73
diff changeset
     5
 This software is furnished under a license and may be used
claus
parents: 73
diff changeset
     6
 only in accordance with the terms of that license and with the
claus
parents: 73
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
claus
parents: 73
diff changeset
     8
 be provided or otherwise made available to, or used by, any
claus
parents: 73
diff changeset
     9
 other person.  No title to or ownership of the software is
claus
parents: 73
diff changeset
    10
 hereby transferred.
claus
parents: 73
diff changeset
    11
"
claus
parents: 73
diff changeset
    12
69
claus
parents: 68
diff changeset
    13
Model subclass:#ValueModel
175
df08e5b663d0 let objects interest implementation do things
Claus Gittinger <cg@exept.de>
parents: 143
diff changeset
    14
	instanceVariableNames:'accepted'
df08e5b663d0 let objects interest implementation do things
Claus Gittinger <cg@exept.de>
parents: 143
diff changeset
    15
	classVariableNames:''
df08e5b663d0 let objects interest implementation do things
Claus Gittinger <cg@exept.de>
parents: 143
diff changeset
    16
	poolDictionaries:''
df08e5b663d0 let objects interest implementation do things
Claus Gittinger <cg@exept.de>
parents: 143
diff changeset
    17
	category:'Interface-Support-Models'
62
194eb0590b1e Initial revision
claus
parents:
diff changeset
    18
!
194eb0590b1e Initial revision
claus
parents:
diff changeset
    19
326
ab4e3df5c5d5 only ignore new value if identical to previous value.
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
    20
!ValueModel  class methodsFor:'documentation'!
68
claus
parents: 66
diff changeset
    21
69
claus
parents: 68
diff changeset
    22
copyright
claus
parents: 68
diff changeset
    23
"
claus
parents: 68
diff changeset
    24
 COPYRIGHT (c) 1995 by Claus Gittinger
71
claus
parents: 70
diff changeset
    25
	      All Rights Reserved
69
claus
parents: 68
diff changeset
    26
claus
parents: 68
diff changeset
    27
 This software is furnished under a license and may be used
claus
parents: 68
diff changeset
    28
 only in accordance with the terms of that license and with the
claus
parents: 68
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
claus
parents: 68
diff changeset
    30
 be provided or otherwise made available to, or used by, any
claus
parents: 68
diff changeset
    31
 other person.  No title to or ownership of the software is
claus
parents: 68
diff changeset
    32
 hereby transferred.
claus
parents: 68
diff changeset
    33
"
claus
parents: 68
diff changeset
    34
!
claus
parents: 68
diff changeset
    35
68
claus
parents: 66
diff changeset
    36
documentation
claus
parents: 66
diff changeset
    37
"
claus
parents: 66
diff changeset
    38
    abstract superclass for ValueHolders and Adaptors.
69
claus
parents: 68
diff changeset
    39
    It does not itself know how and where the value is stored,
143
ae38792bd85c interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 129
diff changeset
    40
    but knows about interested objects (which get informed, whenever
69
claus
parents: 68
diff changeset
    41
    the value changes) and keeps track if the value was ever accepted.
68
claus
parents: 66
diff changeset
    42
231
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    43
    Notice: 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    44
        this class was implemented using protocol information
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    45
        from alpha testers - it may not be complete or compatible to
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    46
        the corresponding ST-80 class. 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    47
        If you encounter any incompatibilities, please forward a note 
2fec6188bd28 examples
Claus Gittinger <cg@exept.de>
parents: 223
diff changeset
    48
        describing the incompatibility verbal (i.e. no code) to the ST/X team.
69
claus
parents: 68
diff changeset
    49
claus
parents: 68
diff changeset
    50
    subclasses must redefine: #setValue: and #value
claus
parents: 68
diff changeset
    51
    (and optionally redefine #value:)
223
b65dc250db8d documentation
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
    52
b65dc250db8d documentation
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
    53
    [author:]
b65dc250db8d documentation
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
    54
        Claus Gittinger
68
claus
parents: 66
diff changeset
    55
"
claus
parents: 66
diff changeset
    56
! !
claus
parents: 66
diff changeset
    57
326
ab4e3df5c5d5 only ignore new value if identical to previous value.
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
    58
!ValueModel  class methodsFor:'instance creation'!
62
194eb0590b1e Initial revision
claus
parents:
diff changeset
    59
194eb0590b1e Initial revision
claus
parents:
diff changeset
    60
new
194eb0590b1e Initial revision
claus
parents:
diff changeset
    61
    ^ (super new) initialize
194eb0590b1e Initial revision
claus
parents:
diff changeset
    62
! !
194eb0590b1e Initial revision
claus
parents:
diff changeset
    63
125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    64
!ValueModel methodsFor:'accessing'!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    65
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    66
accept
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    67
    accepted := true
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    68
!
62
194eb0590b1e Initial revision
claus
parents:
diff changeset
    69
125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    70
accepted
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    71
    ^ accepted
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    72
!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    73
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    74
setValue:newValue 
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    75
    "physically set my value, without change notifications"
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    76
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    77
    ^ self subclassResponsibility
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    78
!
73
claus
parents: 71
diff changeset
    79
125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    80
value 
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    81
    "return my value"
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    82
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    83
    ^ self subclassResponsibility
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    84
!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    85
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    86
value:anObject
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    87
    "set my value, if it changed, send change notifications to my dependents."
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    88
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    89
    |oldValue|
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    90
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    91
    oldValue := self value.
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    92
    self setValue:anObject.
326
ab4e3df5c5d5 only ignore new value if identical to previous value.
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
    93
"/    anObject ~= oldValue ifTrue:[
ab4e3df5c5d5 only ignore new value if identical to previous value.
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
    94
    anObject ~~ oldValue ifTrue:[
ab4e3df5c5d5 only ignore new value if identical to previous value.
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
    95
        "/ self notifyChange:#value
ab4e3df5c5d5 only ignore new value if identical to previous value.
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
    96
        self changed:#value
125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    97
    ]
326
ab4e3df5c5d5 only ignore new value if identical to previous value.
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
    98
ab4e3df5c5d5 only ignore new value if identical to previous value.
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
    99
    "Modified: 26.7.1996 / 17:15:05 / cg"
62
194eb0590b1e Initial revision
claus
parents:
diff changeset
   100
! !
194eb0590b1e Initial revision
claus
parents:
diff changeset
   101
69
claus
parents: 68
diff changeset
   102
!ValueModel methodsFor:'initialization'!
claus
parents: 68
diff changeset
   103
claus
parents: 68
diff changeset
   104
initialize
claus
parents: 68
diff changeset
   105
    accepted := false
claus
parents: 68
diff changeset
   106
! !
claus
parents: 68
diff changeset
   107
326
ab4e3df5c5d5 only ignore new value if identical to previous value.
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   108
!ValueModel  class methodsFor:'documentation'!
129
f890eaabc487 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   109
f890eaabc487 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   110
version
326
ab4e3df5c5d5 only ignore new value if identical to previous value.
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   111
    ^ '$Header: /cvs/stx/stx/libview2/Attic/ValModel.st,v 1.18 1996-07-26 16:09:31 cg Exp $'
129
f890eaabc487 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   112
! !