author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 07 Jun 2019 19:57:30 +0100 | |
branch | jv |
changeset 4278 | 8cc5f9eafef8 |
parent 3855 | 1db7742d33ad |
permissions | -rw-r--r-- |
3855
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
1 |
" |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
2 |
COPYRIGHT (c) Claus Gittinger / 2006 by eXept Software AG |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
3 |
All Rights Reserved |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
4 |
|
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
5 |
This software is furnished under a license and may be used |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
6 |
only in accordance with the terms of that license and with the |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
7 |
inclusion of the above copyright notice. This software may not |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
8 |
be provided or otherwise made available to, or used by, any |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
9 |
other person. No title to or ownership of the software is |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
10 |
hereby transferred. |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
11 |
" |
2415 | 12 |
"{ Package: 'stx:libview2' }" |
13 |
||
3855
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
14 |
"{ NameSpace: Smalltalk }" |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
15 |
|
2415 | 16 |
ProtocolAdaptor subclass:#DictionaryAdaptor |
17 |
instanceVariableNames:'myAspect' |
|
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'Interface-Support-Models' |
|
21 |
! |
|
22 |
||
23 |
!DictionaryAdaptor class methodsFor:'documentation'! |
|
24 |
||
3855
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
25 |
copyright |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
26 |
" |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
27 |
COPYRIGHT (c) Claus Gittinger / 2006 by eXept Software AG |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
28 |
All Rights Reserved |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
29 |
|
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
30 |
This software is furnished under a license and may be used |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
31 |
only in accordance with the terms of that license and with the |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
32 |
inclusion of the above copyright notice. This software may not |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
33 |
be provided or otherwise made available to, or used by, any |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
34 |
other person. No title to or ownership of the software is |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
35 |
hereby transferred. |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
36 |
" |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
37 |
! |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
38 |
|
2415 | 39 |
documentation |
40 |
" |
|
41 |
Similar to AspectAdaptor, but accesses a Dictionary instead of |
|
42 |
a classes instance variables. |
|
43 |
||
44 |
[author:] |
|
45 |
Stefan Vogel (stefan@zwerg) |
|
46 |
||
47 |
[instance variables:] |
|
48 |
||
49 |
[class variables:] |
|
50 |
||
51 |
[see also:] |
|
52 |
||
53 |
" |
|
54 |
! |
|
55 |
||
56 |
examples |
|
57 |
" |
|
58 |
[exBegin] |
|
59 |
|dialog dict dataModel| |
|
60 |
||
61 |
dict := Dictionary new. |
|
62 |
dict |
|
63 |
at:#field1 put:'hello'; |
|
64 |
at:#field2 put:'one'; |
|
65 |
at:#field3 put:'two'; |
|
66 |
at:#field4 put:'three'. |
|
67 |
||
68 |
dialog := DialogBox new. |
|
69 |
dialog addTextLabel:'1:'. |
|
70 |
dialog addInputFieldOn:(DictionaryAdaptor new |
|
71 |
subject:dict; |
|
72 |
aspect:#field1). |
|
73 |
dialog addTextLabel:'2:'. |
|
74 |
dialog addInputFieldOn:(DictionaryAdaptor new |
|
75 |
subject:dict; |
|
76 |
forAspect:#field2). |
|
77 |
dialog addTextLabel:'3:'. |
|
78 |
dialog addInputFieldOn:(DictionaryAdaptor new |
|
79 |
subject:dict; |
|
80 |
aspect:#field3). |
|
81 |
dialog addTextLabel:'4:'. |
|
82 |
dialog addInputFieldOn:(DictionaryAdaptor new |
|
83 |
subject:dict; |
|
84 |
forAspect:#field4). |
|
85 |
dialog addOkButton. |
|
86 |
dict inspect. |
|
87 |
dialog open. |
|
88 |
dialog accepted ifTrue:[ |
|
89 |
Transcript showCR:'data now: ' , dict printString |
|
90 |
] |
|
91 |
[exEnd] |
|
92 |
" |
|
93 |
! ! |
|
94 |
||
95 |
!DictionaryAdaptor class methodsFor:'instance creation'! |
|
96 |
||
97 |
forAspect:anAspect |
|
98 |
"create and return a new adaptor, which forwards requests |
|
99 |
to anObject, using anAspect to access a Dictionary. |
|
100 |
The returned object can be used in place of a ValueHolder" |
|
101 |
||
102 |
^ self new forAspect:anAspect |
|
103 |
! |
|
104 |
||
105 |
subject:anObject sendsUpdates:aBoolean aspect:aspect |
|
106 |
"create and return a new adaptor, which forwards requests |
|
107 |
to anObject, using #at:aspect and #at:aspect put: for access. |
|
108 |
The returned object can be used in place of a ValueHolder" |
|
109 |
||
110 |
^ (self subject:anObject sendsUpdates:aBoolean) aspect:aspect |
|
111 |
! ! |
|
112 |
||
113 |
!DictionaryAdaptor methodsFor:'accessing-spec'! |
|
114 |
||
115 |
aspect:aSelector |
|
116 |
"set the adapters change aspect - this is the aspect of the update message, |
|
117 |
on which the adaptor reacts" |
|
118 |
||
119 |
myAspect := aSelector. |
|
120 |
! |
|
121 |
||
122 |
forAspect |
|
123 |
"get the adapters aspect" |
|
124 |
||
125 |
^ myAspect |
|
126 |
! |
|
127 |
||
128 |
forAspect:aSelector |
|
129 |
"set the adapters aspect" |
|
130 |
||
131 |
myAspect := aSelector. |
|
132 |
! ! |
|
133 |
||
134 |
!DictionaryAdaptor methodsFor:'accessing-value'! |
|
135 |
||
136 |
setValue:newValue |
|
137 |
"set the value - this forwards a putMessage to the target" |
|
138 |
||
139 |
|target oldValue| |
|
140 |
||
141 |
target := self subjectValue. |
|
142 |
target isNil ifTrue:[^ nil]. |
|
143 |
||
144 |
oldValue := target at:myAspect. |
|
145 |
oldValue ~~ newValue ifTrue:[ |
|
146 |
target at:myAspect put:newValue. |
|
147 |
] |
|
148 |
! |
|
149 |
||
150 |
value |
|
151 |
"translate a query for my value from my user |
|
152 |
into an aspect access towards my subject" |
|
153 |
||
154 |
|target| |
|
155 |
||
156 |
target := self subjectValue. |
|
157 |
target isNil ifTrue:[^ nil]. |
|
158 |
^ target at:myAspect ifAbsent:[]. |
|
159 |
! |
|
160 |
||
161 |
value:newValue |
|
162 |
"set the value - this changes the target with #at:put: |
|
163 |
and sends out a changeNotification if the value did really change." |
|
164 |
||
165 |
|target oldValue| |
|
166 |
||
167 |
target := self subjectValue. |
|
2745
c46c41c89a78
without target, should return self - not nil
Claus Gittinger <cg@exept.de>
parents:
2415
diff
changeset
|
168 |
target isNil ifTrue:[^ self]. |
2415 | 169 |
|
170 |
oldValue := target at:myAspect ifAbsent:[]. |
|
171 |
oldValue ~~ newValue ifTrue:[ |
|
172 |
target at:myAspect put:newValue. |
|
173 |
subjectSendsUpdates ifFalse:[ |
|
174 |
self changed:#value |
|
175 |
] |
|
176 |
] |
|
177 |
! ! |
|
178 |
||
179 |
!DictionaryAdaptor methodsFor:'change & update'! |
|
180 |
||
181 |
update:something with:aParameter from:changedObject |
|
182 |
"translate an update from the model into a #value-change |
|
183 |
via my depenedents ..." |
|
184 |
||
185 |
((changedObject == subject and:[something == myAspect]) |
|
186 |
or:[changedObject == subjectChannel]) ifTrue:[ |
|
187 |
self changed:#value |
|
188 |
]. |
|
189 |
! ! |
|
190 |
||
191 |
!DictionaryAdaptor class methodsFor:'documentation'! |
|
192 |
||
193 |
version |
|
2745
c46c41c89a78
without target, should return self - not nil
Claus Gittinger <cg@exept.de>
parents:
2415
diff
changeset
|
194 |
^ '$Header: /cvs/stx/stx/libview2/DictionaryAdaptor.st,v 1.2 2009-09-18 16:14:09 cg Exp $' |
2415 | 195 |
! ! |
3855
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2745
diff
changeset
|
196 |