author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sun, 29 Jan 2012 12:53:39 +0000 | |
branch | jv |
changeset 12123 | 4bde08cebd48 |
parent 10470 | 87b7a17ad489 |
child 12128 | a7ff7d66ee85 |
permissions | -rw-r--r-- |
9987 | 1 |
" |
10099 | 2 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
3 |
Copyright (c) 2009-2010 eXept Software AG |
|
9987 | 4 |
|
10099 | 5 |
Permission is hereby granted, free of charge, to any person |
6 |
obtaining a copy of this software and associated documentation |
|
7 |
files (the 'Software'), to deal in the Software without |
|
8 |
restriction, including without limitation the rights to use, |
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 |
copies of the Software, and to permit persons to whom the |
|
11 |
Software is furnished to do so, subject to the following |
|
12 |
conditions: |
|
13 |
||
14 |
The above copyright notice and this permission notice shall be |
|
15 |
included in all copies or substantial portions of the Software. |
|
16 |
||
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
24 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9987 | 25 |
" |
26 |
"{ Package: 'stx:libtool' }" |
|
27 |
||
28 |
"{ NameSpace: Tools }" |
|
29 |
||
30 |
ApplicationModel subclass:#InlineMessageDialog |
|
31 |
instanceVariableNames:'messageHolder progressHolder specHolder' |
|
32 |
classVariableNames:'' |
|
33 |
poolDictionaries:'' |
|
34 |
category:'Interface-Tools' |
|
35 |
! |
|
36 |
||
37 |
!InlineMessageDialog class methodsFor:'documentation'! |
|
38 |
||
39 |
copyright |
|
40 |
" |
|
10099 | 41 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
42 |
Copyright (c) 2009-2010 eXept Software AG |
|
43 |
||
44 |
Permission is hereby granted, free of charge, to any person |
|
45 |
obtaining a copy of this software and associated documentation |
|
46 |
files (the 'Software'), to deal in the Software without |
|
47 |
restriction, including without limitation the rights to use, |
|
48 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
49 |
copies of the Software, and to permit persons to whom the |
|
50 |
Software is furnished to do so, subject to the following |
|
51 |
conditions: |
|
9987 | 52 |
|
10099 | 53 |
The above copyright notice and this permission notice shall be |
54 |
included in all copies or substantial portions of the Software. |
|
55 |
||
56 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
57 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
58 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
59 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
60 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
61 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
62 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
63 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9987 | 64 |
" |
65 |
! ! |
|
66 |
||
67 |
!InlineMessageDialog class methodsFor:'interface specs'! |
|
68 |
||
69 |
messageInfoSpec |
|
70 |
"This resource specification was automatically generated |
|
71 |
by the UIPainter of ST/X." |
|
72 |
||
73 |
"Do not manually edit this!! If it is corrupted, |
|
74 |
the UIPainter may not be able to read the specification." |
|
75 |
||
76 |
" |
|
77 |
UIPainter new openOnClass:Tools::NewSystemBrowser andSelector:#messageInfoSpec |
|
78 |
Tools::NewSystemBrowser new openInterface:#messageInfoSpec |
|
79 |
" |
|
80 |
||
81 |
<resource: #canvas> |
|
82 |
||
83 |
^ |
|
84 |
#(FullSpec |
|
85 |
name: messageInfoSpec |
|
86 |
window: |
|
87 |
(WindowSpec |
|
88 |
label: 'MessageInfo' |
|
89 |
name: 'MessageInfo' |
|
90 |
min: (Point 10 10) |
|
91 |
bounds: (Rectangle 0 0 800 40) |
|
92 |
backgroundColor: (Color 100.0 78.0392156862745 22.7450980392157) |
|
93 |
forceRecursiveBackgroundOfDefaultBackground: true |
|
94 |
) |
|
95 |
component: |
|
96 |
(SpecCollection |
|
97 |
collection: ( |
|
98 |
(LabelSpec |
|
99 |
label: 'Label' |
|
100 |
name: 'Message' |
|
101 |
layout: (LayoutFrame 10 0 -10 0.5 -90 1 10 0.5) |
|
102 |
backgroundColor: (Color 100.0 78.0392156862745 22.7450980392157) |
|
103 |
translateLabel: true |
|
104 |
labelChannel: messageHolder |
|
105 |
adjust: left |
|
106 |
) |
|
107 |
(ActionButtonSpec |
|
108 |
label: 'OK' |
|
109 |
name: 'OK' |
|
110 |
layout: (LayoutFrame -80 1 -12 0.5 -12 1 12 0.5) |
|
111 |
translateLabel: true |
|
112 |
model: doOK |
|
113 |
) |
|
114 |
) |
|
115 |
||
116 |
) |
|
117 |
) |
|
118 |
||
119 |
"Modified: / 28-10-2010 / 18:30:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
120 |
! |
|
121 |
||
122 |
progressInfoSpec |
|
123 |
"This resource specification was automatically generated |
|
124 |
by the UIPainter of ST/X." |
|
125 |
||
126 |
"Do not manually edit this!! If it is corrupted, |
|
127 |
the UIPainter may not be able to read the specification." |
|
128 |
||
129 |
" |
|
130 |
UIPainter new openOnClass:Tools::InlineMessageDialog andSelector:#progressInfoSpec |
|
131 |
Tools::InlineMessageDialog new openInterface:#progressInfoSpec |
|
132 |
" |
|
133 |
||
134 |
<resource: #canvas> |
|
135 |
||
136 |
^ |
|
137 |
#(FullSpec |
|
138 |
name: progressInfoSpec |
|
139 |
window: |
|
140 |
(WindowSpec |
|
141 |
label: 'ProgressInfo' |
|
142 |
name: 'ProgressInfo' |
|
143 |
min: (Point 10 10) |
|
144 |
bounds: (Rectangle 0 0 800 40) |
|
145 |
backgroundColor: (Color 100.0 78.0392156862745 22.7450980392157) |
|
146 |
forceRecursiveBackgroundOfDefaultBackground: true |
|
147 |
) |
|
148 |
component: |
|
149 |
(SpecCollection |
|
150 |
collection: ( |
|
151 |
(LabelSpec |
|
152 |
label: 'Label' |
|
153 |
name: 'Message' |
|
154 |
layout: (LayoutFrame 10 0 0 0 -90 1 20 0) |
|
155 |
backgroundColor: (Color 100.0 78.0392156862745 22.7450980392157) |
|
156 |
translateLabel: true |
|
157 |
labelChannel: messageHolder |
|
158 |
adjust: left |
|
159 |
) |
|
160 |
(ProgressIndicatorSpec |
|
161 |
name: 'ProgressIndicator' |
|
10470 | 162 |
layout: (LayoutFrame 10 0 -20 1 -133 1 -3 1) |
9987 | 163 |
model: progressHolder |
164 |
foregroundColor: (Color 52.156862745098 37.2549019607843 0.0) |
|
165 |
backgroundColor: (Color 100.0 91.3725490196078 70.1960784313726) |
|
166 |
) |
|
167 |
(ActionButtonSpec |
|
168 |
label: 'Abort' |
|
169 |
name: 'Abort' |
|
10470 | 170 |
layout: (AlignmentOrigin -12 1 0 0.5 1 0.5) |
9987 | 171 |
translateLabel: true |
10470 | 172 |
resizeForLabel: true |
9987 | 173 |
model: doAbort |
174 |
) |
|
175 |
) |
|
176 |
||
177 |
) |
|
178 |
) |
|
179 |
! |
|
180 |
||
181 |
windowSpec |
|
182 |
"This resource specification was automatically generated |
|
183 |
by the UIPainter of ST/X." |
|
184 |
||
185 |
"Do not manually edit this!! If it is corrupted, |
|
186 |
the UIPainter may not be able to read the specification." |
|
187 |
||
188 |
" |
|
189 |
UIPainter new openOnClass:Tools::InlineMessageDialog andSelector:#windowSpec |
|
190 |
Tools::InlineMessageDialog new openInterface:#windowSpec |
|
191 |
Tools::InlineMessageDialog open |
|
192 |
" |
|
193 |
||
194 |
<resource: #canvas> |
|
195 |
||
196 |
^ |
|
197 |
#(FullSpec |
|
198 |
name: windowSpec |
|
199 |
window: |
|
200 |
(WindowSpec |
|
201 |
label: 'Tools::InlineMessageDialog' |
|
202 |
name: 'Tools::InlineMessageDialog' |
|
203 |
min: (Point 10 10) |
|
204 |
bounds: (Rectangle 0 0 800 40) |
|
205 |
backgroundColor: (Color 100.0 78.0392156862745 22.7450980392157) |
|
206 |
forceRecursiveBackgroundOfDefaultBackground: true |
|
207 |
) |
|
208 |
component: |
|
209 |
(SpecCollection |
|
210 |
collection: ( |
|
211 |
(SubCanvasSpec |
|
212 |
name: 'InfoSpec' |
|
213 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
214 |
hasHorizontalScrollBar: false |
|
215 |
hasVerticalScrollBar: false |
|
216 |
miniScrollerHorizontal: false |
|
217 |
specHolder: specHolder |
|
218 |
createNewBuilder: false |
|
219 |
) |
|
220 |
) |
|
221 |
||
222 |
) |
|
223 |
) |
|
224 |
! ! |
|
225 |
||
226 |
!InlineMessageDialog methodsFor:'accessing'! |
|
227 |
||
228 |
message: aString |
|
229 |
||
230 |
self messageHolder value: aString |
|
231 |
||
232 |
"Created: / 28-10-2010 / 18:23:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
233 |
! |
|
234 |
||
235 |
progress: aNumberOrNil |
|
236 |
||
237 |
self progressHolder value: aNumberOrNil |
|
238 |
||
239 |
"Created: / 28-10-2010 / 18:24:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
240 |
! ! |
|
241 |
||
242 |
!InlineMessageDialog methodsFor:'actions'! |
|
243 |
||
244 |
doAbort |
|
245 |
<resource: #uiCallback> |
|
246 |
||
247 |
"automatically generated by UIPainter..." |
|
248 |
||
249 |
"*** the code below performs no action" |
|
250 |
"*** (except for some feedback on the Transcript)" |
|
251 |
"*** Please change as required and accept in the browser." |
|
252 |
"*** (and replace this comment by something more useful ;-)" |
|
253 |
||
254 |
"action to be defined here..." |
|
255 |
||
256 |
Transcript showCR:self class name, ': action for doAbort ...'. |
|
257 |
! |
|
258 |
||
259 |
doOK |
|
260 |
<resource: #uiCallback> |
|
261 |
||
262 |
self hide. |
|
263 |
||
264 |
"Modified: / 28-10-2010 / 18:21:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
265 |
! ! |
|
266 |
||
267 |
!InlineMessageDialog methodsFor:'aspects'! |
|
268 |
||
269 |
messageHolder |
|
270 |
<resource: #uiAspect> |
|
271 |
||
272 |
"automatically generated by UIPainter ..." |
|
273 |
||
274 |
"*** the code below creates a default model when invoked." |
|
275 |
"*** (which may not be the one you wanted)" |
|
276 |
"*** Please change as required and accept it in the browser." |
|
277 |
"*** (and replace this comment by something more useful ;-)" |
|
278 |
||
279 |
messageHolder isNil ifTrue:[ |
|
280 |
messageHolder := ValueHolder new. |
|
281 |
"/ if your app needs to be notified of changes, uncomment one of the lines below: |
|
282 |
"/ messageHolder addDependent:self. |
|
283 |
"/ messageHolder onChangeSend:#messageHolderChanged to:self. |
|
284 |
]. |
|
285 |
^ messageHolder. |
|
286 |
! |
|
287 |
||
288 |
progressHolder |
|
289 |
<resource: #uiAspect> |
|
290 |
||
291 |
"automatically generated by UIPainter ..." |
|
292 |
||
293 |
"*** the code below creates a default model when invoked." |
|
294 |
"*** (which may not be the one you wanted)" |
|
295 |
"*** Please change as required and accept it in the browser." |
|
296 |
"*** (and replace this comment by something more useful ;-)" |
|
297 |
||
298 |
progressHolder isNil ifTrue:[ |
|
299 |
progressHolder := ValueHolder new. |
|
300 |
"/ if your app needs to be notified of changes, uncomment one of the lines below: |
|
301 |
"/ progressHolder addDependent:self. |
|
302 |
"/ progressHolder onChangeSend:#progressHolderChanged to:self. |
|
303 |
]. |
|
304 |
^ progressHolder. |
|
305 |
! |
|
306 |
||
307 |
specHolder |
|
308 |
"return/create the 'specHolder' value holder (automatically generated)" |
|
309 |
||
310 |
specHolder isNil ifTrue:[ |
|
311 |
specHolder := ValueHolder with: #messageInfoSpec. |
|
312 |
]. |
|
313 |
^ specHolder |
|
314 |
||
315 |
"Modified: / 28-10-2010 / 18:29:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
316 |
! ! |
|
317 |
||
318 |
!InlineMessageDialog methodsFor:'private'! |
|
319 |
||
320 |
getMyView |
|
321 |
||
322 |
| v | |
|
323 |
||
324 |
v := builder window. |
|
325 |
^(v superView isKindOf: SubCanvas) |
|
326 |
ifTrue:[v superView] |
|
327 |
ifFalse:[v] |
|
328 |
||
329 |
"Created: / 29-10-2010 / 11:49:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
330 |
! |
|
331 |
||
332 |
getOtherView |
|
333 |
||
334 |
| myView | |
|
335 |
||
336 |
myView := self getMyView. |
|
337 |
^myView superView subViews after: myView |
|
338 |
||
339 |
"Created: / 29-10-2010 / 11:49:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
340 |
! |
|
341 |
||
342 |
hide |
|
343 |
||
344 |
| myView otherView | |
|
345 |
myView := self getMyView. |
|
346 |
otherView := self getOtherView. |
|
347 |
||
348 |
myView isVisible ifFalse:[^self]."/already hidden" |
|
349 |
myView isVisible: false. |
|
350 |
otherView layout: |
|
351 |
(otherView layout topOffset: 0; yourself) |
|
352 |
||
353 |
"Created: / 29-10-2010 / 11:55:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
354 |
! |
|
355 |
||
356 |
show: spec |
|
357 |
||
358 |
| myView otherView | |
|
359 |
myView := self getMyView. |
|
360 |
otherView := self getOtherView. |
|
361 |
myView isVisible ifTrue:[^self]."/already shown" |
|
362 |
myView isVisible: true. |
|
363 |
otherView layout: |
|
364 |
(otherView layout topOffset: 40; yourself). |
|
365 |
self specHolder value: spec. |
|
366 |
||
367 |
"Created: / 29-10-2010 / 11:48:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
368 |
! ! |
|
369 |
||
370 |
!InlineMessageDialog class methodsFor:'documentation'! |
|
371 |
||
372 |
version_CVS |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10470
diff
changeset
|
373 |
^ '§Header: /cvs/stx/stx/libtool/Tools__InlineMessageDialog.st,v 1.3 2011/08/04 21:30:34 cg Exp §' |
9987 | 374 |
! |
375 |
||
376 |
version_SVN |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10470
diff
changeset
|
377 |
^ '$Id: Tools__InlineMessageDialog.st 7646 2010-10-29 14:44:02Z vranyj1 $' |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10470
diff
changeset
|
378 |
! ! |