ValModel.st
author Claus Gittinger <cg@exept.de>
Thu, 25 Apr 1996 18:32:07 +0200
changeset 221 ea942fe5dc04
parent 175 df08e5b663d0
child 223 b65dc250db8d
permissions -rw-r--r--
documentation
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
68
claus
parents: 66
diff changeset
    20
!ValueModel class methodsFor:'documentation'!
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
claus
parents: 66
diff changeset
    43
    Notice: this class was implemented using protocol information
claus
parents: 66
diff changeset
    44
    from alpha testers - it may not be complete or compatible to
claus
parents: 66
diff changeset
    45
    the corresponding ST-80 class. If you encounter any incompatibilities,
claus
parents: 66
diff changeset
    46
    please forward a note to the ST/X team.
69
claus
parents: 68
diff changeset
    47
claus
parents: 68
diff changeset
    48
    subclasses must redefine: #setValue: and #value
claus
parents: 68
diff changeset
    49
    (and optionally redefine #value:)
68
claus
parents: 66
diff changeset
    50
"
claus
parents: 66
diff changeset
    51
! !
claus
parents: 66
diff changeset
    52
62
194eb0590b1e Initial revision
claus
parents:
diff changeset
    53
!ValueModel class methodsFor:'instance creation'!
194eb0590b1e Initial revision
claus
parents:
diff changeset
    54
194eb0590b1e Initial revision
claus
parents:
diff changeset
    55
new
194eb0590b1e Initial revision
claus
parents:
diff changeset
    56
    ^ (super new) initialize
194eb0590b1e Initial revision
claus
parents:
diff changeset
    57
! !
194eb0590b1e Initial revision
claus
parents:
diff changeset
    58
125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    59
!ValueModel methodsFor:'accessing'!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    60
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    61
accept
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    62
    accepted := true
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    63
!
62
194eb0590b1e Initial revision
claus
parents:
diff changeset
    64
125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    65
accepted
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    66
    ^ accepted
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    67
!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    68
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    69
setValue:newValue 
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    70
    "physically set my value, without change notifications"
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    71
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    72
    ^ self subclassResponsibility
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    73
!
73
claus
parents: 71
diff changeset
    74
125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    75
value 
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    76
    "return my value"
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    77
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    78
    ^ self subclassResponsibility
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    79
!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    80
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    81
value:anObject
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    82
    "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
    83
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    84
    |oldValue|
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
    oldValue := self value.
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    87
    self setValue:anObject.
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    88
    anObject ~= oldValue ifTrue:[
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    89
	"/ self notifyChange:#value
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    90
	self changed:#value
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    91
    ]
62
194eb0590b1e Initial revision
claus
parents:
diff changeset
    92
! !
194eb0590b1e Initial revision
claus
parents:
diff changeset
    93
69
claus
parents: 68
diff changeset
    94
!ValueModel methodsFor:'initialization'!
claus
parents: 68
diff changeset
    95
claus
parents: 68
diff changeset
    96
initialize
claus
parents: 68
diff changeset
    97
    accepted := false
claus
parents: 68
diff changeset
    98
! !
claus
parents: 68
diff changeset
    99
129
f890eaabc487 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   100
!ValueModel class methodsFor:'documentation'!
f890eaabc487 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   101
f890eaabc487 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   102
version
175
df08e5b663d0 let objects interest implementation do things
Claus Gittinger <cg@exept.de>
parents: 143
diff changeset
   103
    ^ '$Header: /cvs/stx/stx/libview2/Attic/ValModel.st,v 1.15 1996-03-08 22:20:18 cg Exp $'
129
f890eaabc487 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   104
! !