author | Merge Script |
Sat, 11 Jul 2015 06:35:27 +0200 | |
branch | jv |
changeset 15743 | cd30f981f1c4 |
parent 15566 | 184cea584be5 |
parent 15741 | 7269057cc08d |
child 15808 | e6815b0469a1 |
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 |
|
12686
0920976ce7ef
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
12603
diff
changeset
|
31 |
instanceVariableNames:'messageHolder progressHolder backgroundColorHolder |
0920976ce7ef
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
12603
diff
changeset
|
32 |
backgroundColorOrDefaultHolder progressView panelView |
0920976ce7ef
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
12603
diff
changeset
|
33 |
panelViewComponents specHolder panelShownHolder panelHiddenHolder |
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
34 |
worker layout changeLayoutUponShowHide |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
35 |
progressIndicatorForegroundHolder' |
12686
0920976ce7ef
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
12603
diff
changeset
|
36 |
classVariableNames:'' |
0920976ce7ef
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
12603
diff
changeset
|
37 |
poolDictionaries:'' |
0920976ce7ef
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
12603
diff
changeset
|
38 |
category:'Interface-Tools' |
9987 | 39 |
! |
40 |
||
41 |
!InlineMessageDialog class methodsFor:'documentation'! |
|
42 |
||
43 |
copyright |
|
44 |
" |
|
10099 | 45 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
46 |
Copyright (c) 2009-2010 eXept Software AG |
|
47 |
||
48 |
Permission is hereby granted, free of charge, to any person |
|
49 |
obtaining a copy of this software and associated documentation |
|
50 |
files (the 'Software'), to deal in the Software without |
|
51 |
restriction, including without limitation the rights to use, |
|
52 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
53 |
copies of the Software, and to permit persons to whom the |
|
54 |
Software is furnished to do so, subject to the following |
|
55 |
conditions: |
|
9987 | 56 |
|
10099 | 57 |
The above copyright notice and this permission notice shall be |
58 |
included in all copies or substantial portions of the Software. |
|
59 |
||
60 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
61 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
62 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
63 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
64 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
65 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
66 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
67 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9987 | 68 |
" |
11518 | 69 |
! |
70 |
||
71 |
documentation |
|
72 |
" |
|
73 |
A simple info/warning dialog to embed into application window - |
|
74 |
much like information panel in Firefox or other applications. |
|
75 |
Use it when a modal dialog might be too disturbing. |
|
76 |
||
77 |
||
78 |
[author:] |
|
79 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
|
80 |
||
81 |
[instance variables:] |
|
82 |
||
83 |
[class variables:] |
|
84 |
||
85 |
[see also:] |
|
86 |
||
87 |
" |
|
88 |
! |
|
89 |
||
90 |
examples |
|
91 |
" |
|
92 |
Starting the application: |
|
93 |
[exBegin] |
|
94 |
Tools::InlineMessageDialog new |
|
95 |
open; |
|
96 |
message: 'Hello World'; |
|
97 |
show: #messageInfoSpec. |
|
98 |
||
99 |
||
100 |
[exEnd] |
|
101 |
||
102 |
more examples to be added: |
|
103 |
[exBegin] |
|
104 |
... add code fragment for |
|
105 |
... executable example here ... |
|
106 |
[exEnd] |
|
107 |
" |
|
108 |
! ! |
|
109 |
||
110 |
!InlineMessageDialog class methodsFor:'accessing-colors'! |
|
111 |
||
112 |
defaultInformationBackground |
|
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
113 |
^ (Color red:100.0 green:78 blue:23) |
11518 | 114 |
|
115 |
"Created: / 10-04-2012 / 19:31:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
116 |
! |
|
117 |
||
118 |
defaultWarningBackground |
|
119 |
||
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
120 |
^(Color red:76 green:43 blue:43) |
11518 | 121 |
|
122 |
"Created: / 10-04-2012 / 19:30:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9987 | 123 |
! ! |
124 |
||
125 |
!InlineMessageDialog class methodsFor:'interface specs'! |
|
126 |
||
127 |
messageInfoSpec |
|
128 |
"This resource specification was automatically generated |
|
129 |
by the UIPainter of ST/X." |
|
130 |
||
131 |
"Do not manually edit this!! If it is corrupted, |
|
132 |
the UIPainter may not be able to read the specification." |
|
133 |
||
134 |
" |
|
11518 | 135 |
UIPainter new openOnClass:Tools::InlineMessageDialog andSelector:#messageInfoSpec |
136 |
Tools::InlineMessageDialog new openInterface:#messageInfoSpec |
|
9987 | 137 |
" |
138 |
||
139 |
<resource: #canvas> |
|
140 |
||
141 |
^ |
|
142 |
#(FullSpec |
|
143 |
name: messageInfoSpec |
|
144 |
window: |
|
145 |
(WindowSpec |
|
146 |
label: 'MessageInfo' |
|
147 |
name: 'MessageInfo' |
|
148 |
min: (Point 10 10) |
|
149 |
bounds: (Rectangle 0 0 800 40) |
|
150 |
) |
|
151 |
component: |
|
152 |
(SpecCollection |
|
153 |
collection: ( |
|
154 |
(LabelSpec |
|
155 |
label: 'Label' |
|
156 |
name: 'Message' |
|
11518 | 157 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
158 |
backgroundChannel: backgroundColorOrDefaultHolder |
|
9987 | 159 |
translateLabel: true |
160 |
labelChannel: messageHolder |
|
161 |
adjust: left |
|
162 |
) |
|
163 |
) |
|
164 |
||
165 |
) |
|
166 |
) |
|
167 |
! |
|
168 |
||
169 |
progressInfoSpec |
|
170 |
"This resource specification was automatically generated |
|
171 |
by the UIPainter of ST/X." |
|
172 |
||
173 |
"Do not manually edit this!! If it is corrupted, |
|
174 |
the UIPainter may not be able to read the specification." |
|
175 |
||
176 |
" |
|
177 |
UIPainter new openOnClass:Tools::InlineMessageDialog andSelector:#progressInfoSpec |
|
178 |
Tools::InlineMessageDialog new openInterface:#progressInfoSpec |
|
179 |
" |
|
180 |
||
181 |
<resource: #canvas> |
|
182 |
||
183 |
^ |
|
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
184 |
#(FullSpec |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
185 |
name: progressInfoSpec |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
186 |
window: |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
187 |
(WindowSpec |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
188 |
label: 'ProgressInfo' |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
189 |
name: 'ProgressInfo' |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
190 |
min: (Point 10 10) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
191 |
bounds: (Rectangle 0 0 800 40) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
192 |
forceRecursiveBackgroundOfDefaultBackground: true |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
193 |
) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
194 |
component: |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
195 |
(SpecCollection |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
196 |
collection: ( |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
197 |
(ViewSpec |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
198 |
name: 'Box1' |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
199 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
200 |
level: 0 |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
201 |
backgroundChannel: backgroundColorOrDefaultHolder |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
202 |
component: |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
203 |
(SpecCollection |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
204 |
collection: ( |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
205 |
(LabelSpec |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
206 |
label: 'Label' |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
207 |
name: 'Message' |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
208 |
layout: (LayoutFrame 0 0 0 0 -20 1 20 0) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
209 |
backgroundChannel: backgroundColorOrDefaultHolder |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
210 |
translateLabel: true |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
211 |
labelChannel: messageHolder |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
212 |
adjust: left |
11518 | 213 |
) |
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
214 |
(ProgressIndicatorSpec |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
215 |
name: 'ProgressIndicator' |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
216 |
layout: (LayoutFrame 0 0 -20 1 -20 1 -3 1) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
217 |
level: 0 |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
218 |
backgroundChannel: backgroundColorOrDefaultHolder |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
219 |
foregroundChannel: progressIndicatorForegroundHolder |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
220 |
model: progressHolder |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
221 |
postBuildCallback: postBuildProgressView: |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
222 |
) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
223 |
) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
224 |
|
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
225 |
) |
9987 | 226 |
) |
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
227 |
) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
228 |
|
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
229 |
) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
230 |
) |
9987 | 231 |
! |
232 |
||
11518 | 233 |
warningInfoSpec |
234 |
||
235 |
<resource: #canvas> |
|
236 |
||
237 |
^self messageInfoSpec |
|
238 |
||
239 |
"Modified: / 10-04-2012 / 19:40:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
240 |
! |
|
241 |
||
9987 | 242 |
windowSpec |
243 |
"This resource specification was automatically generated |
|
244 |
by the UIPainter of ST/X." |
|
245 |
||
246 |
"Do not manually edit this!! If it is corrupted, |
|
247 |
the UIPainter may not be able to read the specification." |
|
248 |
||
249 |
" |
|
250 |
UIPainter new openOnClass:Tools::InlineMessageDialog andSelector:#windowSpec |
|
251 |
Tools::InlineMessageDialog new openInterface:#windowSpec |
|
252 |
Tools::InlineMessageDialog open |
|
253 |
" |
|
254 |
||
255 |
<resource: #canvas> |
|
256 |
||
257 |
^ |
|
258 |
#(FullSpec |
|
259 |
name: windowSpec |
|
260 |
window: |
|
261 |
(WindowSpec |
|
262 |
label: 'Tools::InlineMessageDialog' |
|
263 |
name: 'Tools::InlineMessageDialog' |
|
264 |
min: (Point 10 10) |
|
265 |
bounds: (Rectangle 0 0 800 40) |
|
266 |
) |
|
267 |
component: |
|
268 |
(SpecCollection |
|
269 |
collection: ( |
|
11518 | 270 |
(ViewSpec |
271 |
name: 'Layout' |
|
9987 | 272 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
11518 | 273 |
backgroundChannel: backgroundColorOrDefaultHolder |
274 |
component: |
|
275 |
(SpecCollection |
|
276 |
collection: ( |
|
277 |
(HorizontalPanelViewSpec |
|
278 |
name: 'ComponentPanel' |
|
279 |
layout: (LayoutFrame 12 0 0 0 -10 1 0 1) |
|
280 |
backgroundChannel: backgroundColorOrDefaultHolder |
|
281 |
horizontalLayout: rightSpaceFit |
|
282 |
verticalLayout: fit |
|
283 |
horizontalSpace: 0 |
|
284 |
verticalSpace: 3 |
|
285 |
elementsChangeSize: true |
|
286 |
component: |
|
287 |
(SpecCollection |
|
288 |
collection: ( |
|
289 |
(SubCanvasSpec |
|
290 |
name: 'InfoSpec' |
|
291 |
level: 0 |
|
292 |
hasHorizontalScrollBar: false |
|
293 |
hasVerticalScrollBar: false |
|
294 |
miniScrollerHorizontal: false |
|
295 |
specHolder: specHolder |
|
296 |
createNewBuilder: false |
|
297 |
usePreferredHeight: true |
|
298 |
useDynamicPreferredWidth: true |
|
299 |
useDynamicPreferredHeight: true |
|
300 |
useDefaultExtent: true |
|
301 |
usePreferredWidth: true |
|
302 |
) |
|
303 |
) |
|
304 |
||
305 |
) |
|
306 |
postBuildCallback: postBuildPanelView: |
|
307 |
) |
|
308 |
) |
|
309 |
||
310 |
) |
|
9987 | 311 |
) |
312 |
) |
|
313 |
||
314 |
) |
|
315 |
) |
|
316 |
! ! |
|
317 |
||
11518 | 318 |
!InlineMessageDialog class methodsFor:'others'! |
319 |
||
320 |
version_CVS |
|
15741
7269057cc08d
class: Tools::InlineMessageDialog
Stefan Vogel <sv@exept.de>
parents:
15500
diff
changeset
|
321 |
^ '$Header$' |
11518 | 322 |
! ! |
323 |
||
9987 | 324 |
!InlineMessageDialog methodsFor:'accessing'! |
325 |
||
11518 | 326 |
backgroundColor: aColor |
327 |
"Sets the background color, but only iff backgroundColorHolder is |
|
328 |
not set" |
|
329 |
||
330 |
backgroundColorHolder isNil ifTrue:[ |
|
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
331 |
self backgroundColorOrDefaultHolder value: aColor. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
332 |
self progressIndicatorForegroundHolder value:(aColor darkened). |
11518 | 333 |
] |
334 |
||
335 |
"Created: / 10-04-2012 / 19:38:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
336 |
! |
|
337 |
||
15500
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
338 |
buttons |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
339 |
panelView isNil ifTrue:[ ^ #() ]. |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
340 |
^ OrderedCollection streamContents:[ :s | |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
341 |
panelView allSubViewsDo:[:v | |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
342 |
(v class == Button or:[ v class == LinkButton ]) ifTrue:[ |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
343 |
s nextPut: v |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
344 |
]. |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
345 |
] |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
346 |
] |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
347 |
|
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
348 |
"Created: / 03-03-2015 / 10:10:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
349 |
! |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
350 |
|
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
351 |
message |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
352 |
^ self messageHolder value |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
353 |
|
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
354 |
"Created: / 03-03-2015 / 10:06:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
355 |
! |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
356 |
|
9987 | 357 |
message: aString |
358 |
||
359 |
self messageHolder value: aString |
|
360 |
||
361 |
"Created: / 28-10-2010 / 18:23:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
362 |
! |
|
363 |
||
364 |
progress: aNumberOrNil |
|
365 |
||
11249 | 366 |
aNumberOrNil isNumber ifTrue:[ |
367 |
progressView notNil ifTrue:[ |
|
368 |
progressView showBusyIndication: false. |
|
369 |
]. |
|
370 |
self progressHolder value: aNumberOrNil |
|
371 |
] ifFalse:[ |
|
372 |
progressView notNil ifTrue:[ |
|
373 |
progressView showBusyIndication: true. |
|
374 |
] |
|
375 |
||
376 |
] |
|
9987 | 377 |
|
378 |
"Created: / 28-10-2010 / 18:24:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
379 |
! ! |
|
380 |
||
11518 | 381 |
!InlineMessageDialog methodsFor:'accessing-presentation'! |
382 |
||
383 |
changeLayoutUponShowHide: aBoolean |
|
384 |
"If set to false, no changes to compokent layout is done |
|
385 |
when panel is shown/hidden. This effectively means, that |
|
386 |
that panel is shown over the normal content. |
|
387 |
||
388 |
Default value is true (i.e., relayout components)" |
|
389 |
||
390 |
changeLayoutUponShowHide := aBoolean |
|
391 |
||
392 |
"Modified (comment): / 17-05-2012 / 13:56:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
393 |
! ! |
|
394 |
||
9987 | 395 |
!InlineMessageDialog methodsFor:'actions'! |
396 |
||
397 |
doAbort |
|
398 |
||
11248 | 399 |
worker isNil ifTrue:[ self hide. ^ self ]. |
400 |
worker interruptWith:[ |
|
401 |
NoHandlerError handle:[:ex | |
|
12686
0920976ce7ef
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
12603
diff
changeset
|
402 |
ex exception creator == AbortOperationRequest ifTrue:[ |
11248 | 403 |
ex return. |
404 |
]. |
|
405 |
ex reject. |
|
406 |
] do:[ |
|
407 |
AbortOperationRequest raise. |
|
408 |
]. |
|
13853 | 409 |
]. |
410 |
(worker notNil and:[worker isDead not]) ifTrue:[ |
|
411 |
worker terminate. |
|
412 |
"/ raise its prio to make it terminate quickly |
|
12462
7466535c9b47
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12416
diff
changeset
|
413 |
worker priority:(Processor userSchedulingPriority + 1). |
11518 | 414 |
worker := nil. |
415 |
]. |
|
416 |
||
13853 | 417 |
"Modified: / 11-04-2012 / 16:24:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11518 | 418 |
! |
419 |
||
12416
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
420 |
doAbortIfWorking |
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
421 |
worker notNil ifTrue:[ self doAbort ]. |
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
422 |
|
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
423 |
"Created: / 04-10-2012 / 19:20:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
424 |
! |
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
425 |
|
11518 | 426 |
doOK |
427 |
<resource: #uiCallback> |
|
428 |
||
429 |
(worker notNil and:[worker isDead not]) ifTrue:[ |
|
13853 | 430 |
worker terminate. |
12416
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
431 |
"/ raise its prio to make it terminate quickly |
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
432 |
worker priority:(Processor userSchedulingPriority + 1). |
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
433 |
worker := nil. |
11248 | 434 |
]. |
11518 | 435 |
self hide. |
9987 | 436 |
|
13853 | 437 |
"Modified: / 31-03-2013 / 18:02:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11518 | 438 |
! ! |
439 |
||
440 |
!InlineMessageDialog methodsFor:'adding & removing components'! |
|
441 |
||
442 |
addButton: aButton |
|
443 |
| layoutView | |
|
444 |
||
445 |
aButton preferredExtent: ((aButton width + 20) max: 70"px") @ 24. |
|
446 |
layoutView := View new. |
|
447 |
layoutView backgroundChannel: self backgroundColorOrDefaultHolder. |
|
448 |
layoutView addComponent: aButton. |
|
449 |
aButton layout: |
|
450 |
( LayoutFrame fractions:(0 @ 0.5 corner:1.0 @ 0.5) offsets:(3 @ -12 corner:-3 @ 12) ). |
|
451 |
layoutView preferredExtent: (aButton preferredExtent x + 12) @ 24. |
|
452 |
||
453 |
^self addComponent: layoutView |
|
454 |
||
455 |
"Created: / 10-04-2012 / 20:49:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
456 |
! |
|
457 |
||
458 |
addButtonAbort |
|
459 |
||
460 |
^self addButtonWithLabel: (self resources string:'Abort') action: [ self doAbort ] |
|
461 |
||
462 |
"Created: / 10-04-2012 / 21:45:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
463 |
! |
|
464 |
||
465 |
addButtonOK |
|
466 |
||
467 |
^self addButtonWithLabel: (self resources string:'OK') action: [ self doOK ] |
|
468 |
||
469 |
"Created: / 10-04-2012 / 21:44:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
470 |
! |
|
471 |
||
472 |
addButtonWithLabel: label action: action |
|
473 |
^self addButton: (Button label: label action: action) |
|
474 |
||
475 |
"Created: / 10-04-2012 / 20:50:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9987 | 476 |
! |
477 |
||
11518 | 478 |
addComponent: aView |
479 |
panelView isNil ifTrue:[ |
|
480 |
panelViewComponents isNil ifTrue:[ |
|
481 |
panelViewComponents := OrderedCollection new |
|
482 |
]. |
|
483 |
panelViewComponents add: aView |
|
484 |
] ifFalse:[ |
|
485 |
panelView addSubView: aView. |
|
486 |
aView isVisible: true. |
|
487 |
]. |
|
488 |
^aView. |
|
489 |
||
490 |
"Created: / 10-04-2012 / 20:50:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
491 |
! |
|
492 |
||
493 |
beInformation |
|
494 |
||
495 |
self backgroundColor: self class defaultInformationBackground. |
|
496 |
self specHolder value: #messageInfoSpec |
|
497 |
||
498 |
"Created: / 11-04-2012 / 11:39:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
499 |
! |
|
500 |
||
501 |
beProgress |
|
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
502 |
|colorOrNil| |
11518 | 503 |
|
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
504 |
"/ never, ever use explicit colors. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
505 |
"/ If at all, ask the stylesheet and add it to your personal one. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
506 |
"/ (Don't expect otherss to also like your color preferences) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
507 |
"/ colorOrNil := self class defaultInformationBackground. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
508 |
|
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
509 |
colorOrNil := View styleSheet colorAt:'inlineMessageDialog.information.backgroundColor' default:View defaultBackgroundColor. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
510 |
self backgroundColor: colorOrNil. |
11518 | 511 |
self specHolder value: #progressInfoSpec |
512 |
||
513 |
"Created: / 11-04-2012 / 11:41:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
514 |
! |
|
9987 | 515 |
|
11518 | 516 |
beWarning |
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
517 |
|colorOrNil| |
11518 | 518 |
|
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
519 |
"/ never, ever use explicit colors. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
520 |
"/ If at all, ask the stylesheet and add it to your personal one. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
521 |
"/ (Don't expect others to also like your color preferences) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
522 |
|
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
523 |
"/ colorOrNil := self class defaultWarningBackground. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
524 |
colorOrNil := View styleSheet colorAt:'inlineMessageDialog.warning.backgroundColor' default:(self class defaultWarningBackground). |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
525 |
self backgroundColor: colorOrNil. |
11518 | 526 |
self specHolder value: #messageInfoSpec |
527 |
||
528 |
"Created: / 11-04-2012 / 11:41:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
529 |
! |
|
9987 | 530 |
|
11518 | 531 |
removeComponent: aView |
532 |
panelView notNil ifTrue:[ |
|
533 |
panelView removeComponent: aView. |
|
534 |
]. |
|
535 |
panelViewComponents notNil ifTrue:[ |
|
536 |
panelViewComponents remove: aView ifAbsent:[]. |
|
537 |
] |
|
538 |
||
539 |
"Created: / 11-04-2012 / 00:51:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
540 |
! |
|
541 |
||
542 |
removeComponents |
|
543 |
"Removes all components except subcanvas" |
|
544 |
panelViewComponents := nil. |
|
545 |
panelView notNil ifTrue:[ |
|
546 |
panelView subViews copyWithoutFirst do:[:component| |
|
547 |
component destroy |
|
548 |
] |
|
549 |
||
550 |
]. |
|
551 |
||
552 |
"Created: / 11-04-2012 / 00:51:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9987 | 553 |
! ! |
554 |
||
555 |
!InlineMessageDialog methodsFor:'aspects'! |
|
556 |
||
11518 | 557 |
backgroundColorHolder |
558 |
"return/create the 'backgroundColorHolder' value holder (automatically generated)" |
|
559 |
||
560 |
backgroundColorHolder isNil ifTrue:[ |
|
561 |
backgroundColorHolder := ValueHolder new. |
|
562 |
]. |
|
563 |
^ backgroundColorHolder |
|
564 |
! |
|
565 |
||
566 |
backgroundColorHolder:something |
|
567 |
"set the 'backgroundColorHolder' value holder (automatically generated)" |
|
568 |
||
569 |
|oldValue newValue| |
|
570 |
||
571 |
backgroundColorHolder notNil ifTrue:[ |
|
572 |
oldValue := backgroundColorHolder value. |
|
573 |
backgroundColorHolder removeDependent:self. |
|
574 |
]. |
|
575 |
backgroundColorHolder := something. |
|
576 |
backgroundColorHolder notNil ifTrue:[ |
|
577 |
backgroundColorHolder addDependent:self. |
|
578 |
]. |
|
579 |
newValue := backgroundColorHolder value. |
|
580 |
oldValue ~~ newValue ifTrue:[ |
|
581 |
self update:#value with:newValue from:backgroundColorHolder. |
|
582 |
]. |
|
583 |
! |
|
584 |
||
585 |
backgroundColorOrDefaultHolder |
|
586 |
"return/create the 'backgroundColorOrDefaultHolder' value holder (automatically generated)" |
|
587 |
||
588 |
backgroundColorOrDefaultHolder isNil ifTrue:[ |
|
589 |
backgroundColorOrDefaultHolder := ValueHolder new. |
|
590 |
backgroundColorOrDefaultHolder addDependent:self. |
|
591 |
]. |
|
592 |
^ backgroundColorOrDefaultHolder |
|
593 |
! |
|
594 |
||
9987 | 595 |
messageHolder |
596 |
<resource: #uiAspect> |
|
597 |
||
598 |
messageHolder isNil ifTrue:[ |
|
599 |
messageHolder := ValueHolder new. |
|
600 |
]. |
|
601 |
^ messageHolder. |
|
11509 | 602 |
|
603 |
"Modified (comment): / 15-05-2012 / 11:08:35 / cg" |
|
9987 | 604 |
! |
605 |
||
11248 | 606 |
panelHiddenHolder |
607 |
"return/create the 'panelHiddenHolder' value holder (automatically generated)" |
|
608 |
||
609 |
panelHiddenHolder isNil ifTrue:[ |
|
610 |
panelHiddenHolder := ValueHolder new. |
|
611 |
]. |
|
612 |
^ panelHiddenHolder |
|
613 |
! |
|
614 |
||
615 |
panelHiddenHolder:aValueModel |
|
616 |
"set the 'panelHiddenHolder' value holder (automatically generated)" |
|
617 |
||
618 |
panelHiddenHolder := aValueModel. |
|
619 |
! |
|
620 |
||
621 |
panelShownHolder |
|
622 |
"return/create the 'panelShownHolder' value holder (automatically generated)" |
|
623 |
||
624 |
panelShownHolder isNil ifTrue:[ |
|
625 |
panelShownHolder := ValueHolder new. |
|
626 |
]. |
|
627 |
^ panelShownHolder |
|
628 |
! |
|
629 |
||
630 |
panelShownHolder:aValueModel |
|
631 |
"set the 'panelShownHolder' value holder (automatically generated)" |
|
632 |
||
633 |
panelShownHolder := aValueModel. |
|
634 |
! |
|
635 |
||
9987 | 636 |
progressHolder |
637 |
<resource: #uiAspect> |
|
638 |
||
639 |
"automatically generated by UIPainter ..." |
|
640 |
||
641 |
"*** the code below creates a default model when invoked." |
|
642 |
"*** (which may not be the one you wanted)" |
|
643 |
"*** Please change as required and accept it in the browser." |
|
644 |
"*** (and replace this comment by something more useful ;-)" |
|
645 |
||
646 |
progressHolder isNil ifTrue:[ |
|
647 |
progressHolder := ValueHolder new. |
|
648 |
"/ if your app needs to be notified of changes, uncomment one of the lines below: |
|
649 |
"/ progressHolder addDependent:self. |
|
650 |
"/ progressHolder onChangeSend:#progressHolderChanged to:self. |
|
651 |
]. |
|
652 |
^ progressHolder. |
|
653 |
! |
|
654 |
||
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
655 |
progressIndicatorForegroundHolder |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
656 |
progressIndicatorForegroundHolder isNil ifTrue:[ |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
657 |
progressIndicatorForegroundHolder := ValueHolder new. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
658 |
]. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
659 |
^ progressIndicatorForegroundHolder |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
660 |
! |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
661 |
|
9987 | 662 |
specHolder |
663 |
"return/create the 'specHolder' value holder (automatically generated)" |
|
664 |
||
665 |
specHolder isNil ifTrue:[ |
|
666 |
specHolder := ValueHolder with: #messageInfoSpec. |
|
667 |
]. |
|
668 |
^ specHolder |
|
669 |
||
670 |
"Modified: / 28-10-2010 / 18:29:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
671 |
! ! |
|
672 |
||
11518 | 673 |
!InlineMessageDialog methodsFor:'change & update'! |
674 |
||
675 |
update:aspect with:parameter from:changedObject |
|
676 |
"Invoked when an object that I depend upon sends a change notification." |
|
677 |
||
678 |
changedObject == backgroundColorHolder ifTrue:[ |
|
679 |
self backgroundColorOrDefaultHolder value: backgroundColorHolder value. |
|
680 |
^ self. |
|
681 |
]. |
|
682 |
super update:aspect with:parameter from:changedObject |
|
683 |
||
684 |
"Modified: / 10-04-2012 / 19:36:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
685 |
! ! |
|
686 |
||
11249 | 687 |
!InlineMessageDialog methodsFor:'hooks'! |
688 |
||
11518 | 689 |
commonPostBuild |
690 |
panelViewComponents notEmptyOrNil ifTrue:[ |
|
15741
7269057cc08d
class: Tools::InlineMessageDialog
Stefan Vogel <sv@exept.de>
parents:
15500
diff
changeset
|
691 |
panelViewComponents do:[:each| panelView addSubView: each]. |
7269057cc08d
class: Tools::InlineMessageDialog
Stefan Vogel <sv@exept.de>
parents:
15500
diff
changeset
|
692 |
panelViewComponents := nil. |
11518 | 693 |
"/ "/Correction view, dunno why the layout is bad without it... |
694 |
"/ correctionView := View new. |
|
695 |
"/ correctionView extent: (panelView subViews size * 3)@24. |
|
696 |
"/ correctionView backgroundChannel: self backgroundColorOrDefaultHolder. |
|
697 |
"/ panelView addComponent: correctionView |
|
698 |
] |
|
699 |
||
700 |
"Created: / 10-04-2012 / 21:02:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
701 |
! |
|
702 |
||
703 |
postBuildPanelView: aPanelView |
|
704 |
panelView := aPanelView. |
|
705 |
||
706 |
"Created: / 10-04-2012 / 20:47:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
707 |
! |
|
708 |
||
11249 | 709 |
postBuildProgressView: aProgressIndicator |
710 |
progressView := aProgressIndicator |
|
711 |
||
712 |
"Created: / 10-02-2012 / 10:42:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
713 |
! ! |
|
714 |
||
9987 | 715 |
!InlineMessageDialog methodsFor:'private'! |
716 |
||
717 |
getMyView |
|
718 |
||
719 |
| v | |
|
720 |
||
11518 | 721 |
builder isNil ifTrue:[ ^ nil ]. |
9987 | 722 |
v := builder window. |
723 |
^(v superView isKindOf: SubCanvas) |
|
724 |
ifTrue:[v superView] |
|
725 |
ifFalse:[v] |
|
726 |
||
727 |
"Created: / 29-10-2010 / 11:49:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
728 |
! |
|
729 |
||
730 |
getOtherView |
|
731 |
||
732 |
| myView | |
|
733 |
||
734 |
myView := self getMyView. |
|
11518 | 735 |
^ (myView isNil or:[myView superView isNil]) ifTrue:[ |
11248 | 736 |
nil. |
737 |
] ifFalse: [ |
|
738 |
myView superView subViews after: myView |
|
739 |
]. |
|
9987 | 740 |
|
741 |
"Created: / 29-10-2010 / 11:49:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
742 |
! |
|
743 |
||
744 |
hide |
|
745 |
||
746 |
| myView otherView | |
|
12416
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
747 |
builder isNil ifTrue:[ ^ self ]. |
9987 | 748 |
myView := self getMyView. |
749 |
otherView := self getOtherView. |
|
750 |
||
11518 | 751 |
myView isVisible ifFalse:[ "/already hidden" |
752 |
self reset. |
|
753 |
^self |
|
754 |
]. |
|
9987 | 755 |
myView isVisible: false. |
11248 | 756 |
panelShownHolder notNil ifTrue:[ |
757 |
panelShownHolder value: false |
|
758 |
]. |
|
759 |
panelHiddenHolder notNil ifTrue:[ |
|
760 |
panelHiddenHolder value: true |
|
761 |
]. |
|
11518 | 762 |
changeLayoutUponShowHide ~~ false ifTrue:[ |
12416
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
763 |
otherView layout: layout. |
11518 | 764 |
]. |
11248 | 765 |
|
11518 | 766 |
self reset. |
9987 | 767 |
|
768 |
"Created: / 29-10-2010 / 11:55:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12416
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
769 |
"Modified (format): / 17-01-2013 / 23:35:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9987 | 770 |
! |
771 |
||
11518 | 772 |
show |
9987 | 773 |
|
774 |
| myView otherView | |
|
775 |
myView := self getMyView. |
|
776 |
otherView := self getOtherView. |
|
11518 | 777 |
(myView isNil or:[myView isVisible]) ifTrue:[ |
778 |
^self. |
|
779 |
]. |
|
9987 | 780 |
myView isVisible: true. |
11248 | 781 |
panelShownHolder notNil ifTrue:[ |
782 |
panelShownHolder value: true |
|
783 |
]. |
|
784 |
panelHiddenHolder notNil ifTrue:[ |
|
785 |
panelHiddenHolder value: false |
|
786 |
]. |
|
787 |
||
11518 | 788 |
changeLayoutUponShowHide ~~ false ifTrue:[ |
789 |
otherView notNil ifTrue:[ |
|
790 |
layout := otherView layout copy. |
|
791 |
otherView layout: |
|
792 |
(layout copy topOffset: layout topOffset + 40; yourself). |
|
793 |
]. |
|
794 |
]. |
|
795 |
||
796 |
"Created: / 11-04-2012 / 11:43:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
797 |
! |
|
798 |
||
799 |
show: spec |
|
800 |
<resource: #obsolete> |
|
801 |
||
802 |
self obsoleteMethodWarning. |
|
803 |
self breakPoint: #jv. |
|
804 |
||
805 |
spec == #warningInfoSpec ifTrue:[ self beWarning ]. |
|
806 |
spec == #messageInfoSpec ifTrue:[ self beInformation ]. |
|
807 |
spec == #progressInfoSpec ifTrue:[ self beProgress ]. |
|
808 |
self show. |
|
9987 | 809 |
|
810 |
"Created: / 29-10-2010 / 11:48:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
811 |
! ! |
|
812 |
||
14525
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
813 |
!InlineMessageDialog methodsFor:'testing'! |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
814 |
|
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
815 |
isMessageOrWarning |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
816 |
^ self specHolder value == #messageInfoSpec. |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
817 |
|
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
818 |
"Created: / 20-06-2014 / 11:25:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
819 |
! |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
820 |
|
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
821 |
isProgress |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
822 |
^ self specHolder value == #progressInfoSpec. |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
823 |
|
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
824 |
"Created: / 20-06-2014 / 11:25:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
825 |
! |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
826 |
|
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
827 |
isVisible |
14813
0fa22b6fe63a
Hack in Tools::InlineMessageDialog>>isVisible
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14525
diff
changeset
|
828 |
| myView | |
0fa22b6fe63a
Hack in Tools::InlineMessageDialog>>isVisible
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14525
diff
changeset
|
829 |
|
0fa22b6fe63a
Hack in Tools::InlineMessageDialog>>isVisible
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14525
diff
changeset
|
830 |
myView := self getMyView. |
0fa22b6fe63a
Hack in Tools::InlineMessageDialog>>isVisible
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14525
diff
changeset
|
831 |
^ myView notNil and:[ myView isVisible ] |
14525
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
832 |
|
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
833 |
"Created: / 20-06-2014 / 11:26:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
14813
0fa22b6fe63a
Hack in Tools::InlineMessageDialog>>isVisible
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14525
diff
changeset
|
834 |
"Modified: / 07-11-2014 / 11:13:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
14525
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
835 |
! ! |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
836 |
|
11518 | 837 |
!InlineMessageDialog methodsFor:'utilities'! |
838 |
||
839 |
reset |
|
840 |
"Resets the dialog to initial state, removes all |
|
841 |
user supplied components." |
|
842 |
||
843 |
self removeComponents. |
|
844 |
||
845 |
"Created: / 11-04-2012 / 00:51:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
846 |
! |
|
847 |
||
848 |
showMessage: aString |
|
849 |
"Shows given message and OK button (which closes the dialog |
|
850 |
when clicked" |
|
851 |
||
852 |
self showMessage: aString closeAfter: nil |
|
853 |
||
854 |
"Created: / 11-04-2012 / 13:11:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
855 |
! |
|
856 |
||
857 |
showMessage: aString closeAfter: aTimeDurationOrIntegerOrNil |
|
858 |
"Shows given message and OK button (which closes the dialog |
|
859 |
when clicked). The dialog closes automaticaly after |
|
860 |
aTimeDurationOrIntegerOrNil (integer value means secons, nil |
|
861 |
means do not close automatically)" |
|
862 |
||
863 |
||
864 |
self reset. |
|
865 |
self beInformation. |
|
866 |
self message: aString. |
|
867 |
self addButtonOK. |
|
868 |
self show. |
|
869 |
aTimeDurationOrIntegerOrNil notNil ifTrue:[ |
|
870 |
worker := |
|
871 |
[ |
|
872 |
aTimeDurationOrIntegerOrNil isInteger ifTrue:[ |
|
873 |
Delay waitForSeconds: aTimeDurationOrIntegerOrNil. |
|
874 |
] ifFalse:[ |
|
875 |
Delay waitForMilliseconds: aTimeDurationOrIntegerOrNil milliseconds |
|
876 |
]. |
|
877 |
self hide. |
|
878 |
] newProcess. |
|
879 |
worker addExitAction:[ worker := nil ]. |
|
880 |
worker resume. |
|
881 |
]. |
|
882 |
||
883 |
"Created: / 11-04-2012 / 13:13:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
884 |
! |
|
885 |
||
886 |
showProgressLabeled: aString while: aBlock |
|
887 |
"During an execution of aBlock, show a label with given |
|
888 |
string, a progressbar showing the progress and an 'Abort' button. |
|
889 |
||
890 |
If the block raises a ProgressNotification, then the percentage |
|
891 |
progress is updated accordingly. If it raises an ActivityNotification, |
|
892 |
then the label is updated and progress bar is changed to be an |
|
893 |
activity notificator. |
|
894 |
||
895 |
When an 'Abort' button is pressed, the block is interrupted by |
|
896 |
AbortOperationRequest. |
|
897 |
||
898 |
When a block terminates (either normally or abruptly, dialog is closed. |
|
899 |
" |
|
900 |
||
901 |
worker := [ |
|
902 |
self reset. |
|
903 |
self beProgress. |
|
904 |
self message: aString. |
|
905 |
self addButtonAbort. |
|
906 |
self progress: nil. |
|
907 |
self show. |
|
908 |
[ |
|
909 |
aBlock value. |
|
910 |
] on: ProgressNotification , ActivityNotification do:[:ex| |
|
911 |
self progress: ex parameter. |
|
912 |
ex messageText notNil ifTrue:[ |
|
913 |
self message: ex messageText. |
|
914 |
]. |
|
915 |
ex proceed. |
|
916 |
]. |
|
917 |
] newProcess. |
|
918 |
worker addExitAction:[ |
|
919 |
"This check is required, since somebody may want to show |
|
920 |
info/warning from within the action block" |
|
921 |
self specHolder value == #progressInfoSpec ifTrue:[ |
|
922 |
self hide. |
|
923 |
]. |
|
924 |
worker := nil. |
|
925 |
]. |
|
926 |
worker resume. |
|
927 |
||
928 |
"Created: / 11-04-2012 / 13:38:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
929 |
! ! |
|
930 |
||
931 |
!InlineMessageDialog methodsFor:'utilities-obsolete'! |
|
932 |
||
933 |
information: message |
|
934 |
||
935 |
self information: message timeout: nil |
|
936 |
||
937 |
"Created: / 11-02-2012 / 23:14:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
938 |
! |
|
939 |
||
940 |
information: message timeout: timeoutOrNil |
|
941 |
||
942 |
self reset. |
|
943 |
self beInformation. |
|
944 |
self message: message. |
|
945 |
self addButtonOK. |
|
946 |
self show. |
|
947 |
timeoutOrNil isInteger ifTrue:[ |
|
948 |
[ |
|
949 |
Delay waitForSeconds: timeoutOrNil. |
|
950 |
self hide. |
|
951 |
] fork. |
|
952 |
] |
|
953 |
||
954 |
"Created: / 11-02-2012 / 23:14:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
955 |
! |
|
956 |
||
957 |
progress: label while: block |
|
958 |
||
959 |
worker := [ |
|
960 |
self reset. |
|
961 |
self beProgress. |
|
962 |
self message: label. |
|
963 |
self addButtonAbort. |
|
964 |
self progress: nil. |
|
965 |
self show. |
|
966 |
[ |
|
967 |
block value. |
|
968 |
] on: ProgressNotification , ActivityNotification do:[:ex| |
|
969 |
self progress: ex parameter. |
|
970 |
ex messageText notNil ifTrue:[ |
|
971 |
self message: ex messageText. |
|
972 |
]. |
|
973 |
ex proceed. |
|
974 |
]. |
|
975 |
] newProcess. |
|
976 |
worker addExitAction:[ |
|
977 |
self specHolder value == #progressInfoSpec ifTrue:[ |
|
978 |
self hide. |
|
979 |
]. |
|
980 |
worker := nil. |
|
981 |
]. |
|
982 |
worker resume. |
|
983 |
||
984 |
"Created: / 10-02-2012 / 10:34:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
985 |
! |
|
986 |
||
987 |
warning: message action: block labeled: label |
|
988 |
||
989 |
self reset. |
|
990 |
self beWarning. |
|
991 |
self message: message. |
|
992 |
self addButtonWithLabel: label action: block. |
|
993 |
self addButtonOK. |
|
994 |
self show |
|
995 |
||
996 |
"Created: / 13-02-2012 / 16:59:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
997 |
! ! |
|
998 |
||
9987 | 999 |
!InlineMessageDialog class methodsFor:'documentation'! |
1000 |
||
11249 | 1001 |
version |
15741
7269057cc08d
class: Tools::InlineMessageDialog
Stefan Vogel <sv@exept.de>
parents:
15500
diff
changeset
|
1002 |
^ '$Header$' |
12462
7466535c9b47
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12416
diff
changeset
|
1003 |
! |
7466535c9b47
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12416
diff
changeset
|
1004 |
|
7466535c9b47
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12416
diff
changeset
|
1005 |
version_HG |
7466535c9b47
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12416
diff
changeset
|
1006 |
|
13853 | 1007 |
^ '$Changeset: <not expanded> $' |
11249 | 1008 |
! |
1009 |
||
9987 | 1010 |
version_SVN |
15741
7269057cc08d
class: Tools::InlineMessageDialog
Stefan Vogel <sv@exept.de>
parents:
15500
diff
changeset
|
1011 |
^ '$Id$' |
9987 | 1012 |
! ! |
12416
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
1013 |