author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 19 Jul 2017 09:42:32 +0200 | |
branch | jv |
changeset 17619 | edb119820fcb |
parent 17136 | cb908d2ba02e |
child 19612 | 9f2e3136aa4d |
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 |
||
318 |
!InlineMessageDialog methodsFor:'accessing'! |
|
319 |
||
11518 | 320 |
backgroundColor: aColor |
321 |
"Sets the background color, but only iff backgroundColorHolder is |
|
322 |
not set" |
|
323 |
||
324 |
backgroundColorHolder isNil ifTrue:[ |
|
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
325 |
self backgroundColorOrDefaultHolder value: aColor. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
326 |
self progressIndicatorForegroundHolder value:(aColor darkened). |
11518 | 327 |
] |
328 |
||
329 |
"Created: / 10-04-2012 / 19:38:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
330 |
! |
|
331 |
||
15500
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
332 |
buttons |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
333 |
panelView isNil ifTrue:[ ^ #() ]. |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
334 |
^ OrderedCollection streamContents:[ :s | |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
335 |
panelView allSubViewsDo:[:v | |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
336 |
(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
|
337 |
s nextPut: v |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
338 |
]. |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
339 |
] |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
340 |
] |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
341 |
|
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
342 |
"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
|
343 |
! |
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 |
message |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
346 |
^ self messageHolder value |
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: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
|
349 |
! |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
350 |
|
9987 | 351 |
message: aString |
352 |
||
353 |
self messageHolder value: aString |
|
354 |
||
355 |
"Created: / 28-10-2010 / 18:23:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
356 |
! |
|
357 |
||
358 |
progress: aNumberOrNil |
|
359 |
||
11249 | 360 |
aNumberOrNil isNumber ifTrue:[ |
361 |
progressView notNil ifTrue:[ |
|
362 |
progressView showBusyIndication: false. |
|
363 |
]. |
|
364 |
self progressHolder value: aNumberOrNil |
|
365 |
] ifFalse:[ |
|
366 |
progressView notNil ifTrue:[ |
|
367 |
progressView showBusyIndication: true. |
|
368 |
] |
|
369 |
||
370 |
] |
|
9987 | 371 |
|
372 |
"Created: / 28-10-2010 / 18:24:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
373 |
! ! |
|
374 |
||
11518 | 375 |
!InlineMessageDialog methodsFor:'accessing-presentation'! |
376 |
||
377 |
changeLayoutUponShowHide: aBoolean |
|
378 |
"If set to false, no changes to compokent layout is done |
|
379 |
when panel is shown/hidden. This effectively means, that |
|
380 |
that panel is shown over the normal content. |
|
381 |
||
382 |
Default value is true (i.e., relayout components)" |
|
383 |
||
384 |
changeLayoutUponShowHide := aBoolean |
|
385 |
||
386 |
"Modified (comment): / 17-05-2012 / 13:56:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
387 |
! ! |
|
388 |
||
9987 | 389 |
!InlineMessageDialog methodsFor:'actions'! |
390 |
||
391 |
doAbort |
|
392 |
||
11248 | 393 |
worker isNil ifTrue:[ self hide. ^ self ]. |
394 |
worker interruptWith:[ |
|
395 |
NoHandlerError handle:[:ex | |
|
12686
0920976ce7ef
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
12603
diff
changeset
|
396 |
ex exception creator == AbortOperationRequest ifTrue:[ |
11248 | 397 |
ex return. |
398 |
]. |
|
399 |
ex reject. |
|
400 |
] do:[ |
|
401 |
AbortOperationRequest raise. |
|
402 |
]. |
|
13853 | 403 |
]. |
404 |
(worker notNil and:[worker isDead not]) ifTrue:[ |
|
405 |
worker terminate. |
|
406 |
"/ raise its prio to make it terminate quickly |
|
12462
7466535c9b47
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12416
diff
changeset
|
407 |
worker priority:(Processor userSchedulingPriority + 1). |
11518 | 408 |
worker := nil. |
409 |
]. |
|
410 |
||
13853 | 411 |
"Modified: / 11-04-2012 / 16:24:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11518 | 412 |
! |
413 |
||
12416
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
414 |
doAbortIfWorking |
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
415 |
worker notNil ifTrue:[ self doAbort ]. |
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
416 |
|
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
417 |
"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
|
418 |
! |
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
419 |
|
11518 | 420 |
doOK |
421 |
<resource: #uiCallback> |
|
422 |
||
423 |
(worker notNil and:[worker isDead not]) ifTrue:[ |
|
13853 | 424 |
worker terminate. |
12416
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
425 |
"/ raise its prio to make it terminate quickly |
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
426 |
worker priority:(Processor userSchedulingPriority + 1). |
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
427 |
worker := nil. |
11248 | 428 |
]. |
11518 | 429 |
self hide. |
9987 | 430 |
|
13853 | 431 |
"Modified: / 31-03-2013 / 18:02:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11518 | 432 |
! ! |
433 |
||
434 |
!InlineMessageDialog methodsFor:'adding & removing components'! |
|
435 |
||
436 |
addButton: aButton |
|
437 |
| layoutView | |
|
438 |
||
439 |
aButton preferredExtent: ((aButton width + 20) max: 70"px") @ 24. |
|
440 |
layoutView := View new. |
|
441 |
layoutView backgroundChannel: self backgroundColorOrDefaultHolder. |
|
442 |
layoutView addComponent: aButton. |
|
443 |
aButton layout: |
|
444 |
( LayoutFrame fractions:(0 @ 0.5 corner:1.0 @ 0.5) offsets:(3 @ -12 corner:-3 @ 12) ). |
|
445 |
layoutView preferredExtent: (aButton preferredExtent x + 12) @ 24. |
|
446 |
||
447 |
^self addComponent: layoutView |
|
448 |
||
449 |
"Created: / 10-04-2012 / 20:49:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
450 |
! |
|
451 |
||
452 |
addButtonAbort |
|
453 |
||
454 |
^self addButtonWithLabel: (self resources string:'Abort') action: [ self doAbort ] |
|
455 |
||
456 |
"Created: / 10-04-2012 / 21:45:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
457 |
! |
|
458 |
||
459 |
addButtonOK |
|
460 |
||
461 |
^self addButtonWithLabel: (self resources string:'OK') action: [ self doOK ] |
|
462 |
||
463 |
"Created: / 10-04-2012 / 21:44:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
464 |
! |
|
465 |
||
466 |
addButtonWithLabel: label action: action |
|
467 |
^self addButton: (Button label: label action: action) |
|
468 |
||
469 |
"Created: / 10-04-2012 / 20:50:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9987 | 470 |
! |
471 |
||
11518 | 472 |
addComponent: aView |
473 |
panelView isNil ifTrue:[ |
|
474 |
panelViewComponents isNil ifTrue:[ |
|
475 |
panelViewComponents := OrderedCollection new |
|
476 |
]. |
|
477 |
panelViewComponents add: aView |
|
478 |
] ifFalse:[ |
|
479 |
panelView addSubView: aView. |
|
480 |
aView isVisible: true. |
|
481 |
]. |
|
482 |
^aView. |
|
483 |
||
484 |
"Created: / 10-04-2012 / 20:50:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
485 |
! |
|
486 |
||
487 |
beInformation |
|
488 |
||
489 |
self backgroundColor: self class defaultInformationBackground. |
|
490 |
self specHolder value: #messageInfoSpec |
|
491 |
||
492 |
"Created: / 11-04-2012 / 11:39:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
493 |
! |
|
494 |
||
495 |
beProgress |
|
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
496 |
|colorOrNil| |
11518 | 497 |
|
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
498 |
"/ never, ever use explicit colors. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
499 |
"/ 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
|
500 |
"/ (Don't expect otherss to also like your color preferences) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
501 |
"/ colorOrNil := self class defaultInformationBackground. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
502 |
|
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
503 |
colorOrNil := View styleSheet colorAt:'inlineMessageDialog.information.backgroundColor' default:View defaultBackgroundColor. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
504 |
self backgroundColor: colorOrNil. |
11518 | 505 |
self specHolder value: #progressInfoSpec |
506 |
||
507 |
"Created: / 11-04-2012 / 11:41:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
508 |
! |
|
9987 | 509 |
|
11518 | 510 |
beWarning |
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
511 |
|colorOrNil| |
11518 | 512 |
|
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
513 |
"/ never, ever use explicit colors. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
514 |
"/ 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
|
515 |
"/ (Don't expect others to also like your color preferences) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
516 |
|
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
517 |
"/ colorOrNil := self class defaultWarningBackground. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
518 |
colorOrNil := View styleSheet colorAt:'inlineMessageDialog.warning.backgroundColor' default:(self class defaultWarningBackground). |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
519 |
self backgroundColor: colorOrNil. |
11518 | 520 |
self specHolder value: #messageInfoSpec |
521 |
||
522 |
"Created: / 11-04-2012 / 11:41:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
523 |
! |
|
9987 | 524 |
|
11518 | 525 |
removeComponent: aView |
526 |
panelView notNil ifTrue:[ |
|
527 |
panelView removeComponent: aView. |
|
528 |
]. |
|
529 |
panelViewComponents notNil ifTrue:[ |
|
530 |
panelViewComponents remove: aView ifAbsent:[]. |
|
531 |
] |
|
532 |
||
533 |
"Created: / 11-04-2012 / 00:51:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
534 |
! |
|
535 |
||
536 |
removeComponents |
|
537 |
"Removes all components except subcanvas" |
|
538 |
panelViewComponents := nil. |
|
539 |
panelView notNil ifTrue:[ |
|
15804
eb592f71d181
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
15741
diff
changeset
|
540 |
panelView subViews allButFirst do:[:component| |
11518 | 541 |
component destroy |
542 |
] |
|
543 |
||
544 |
]. |
|
545 |
||
546 |
"Created: / 11-04-2012 / 00:51:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9987 | 547 |
! ! |
548 |
||
549 |
!InlineMessageDialog methodsFor:'aspects'! |
|
550 |
||
11518 | 551 |
backgroundColorHolder |
552 |
"return/create the 'backgroundColorHolder' value holder (automatically generated)" |
|
553 |
||
554 |
backgroundColorHolder isNil ifTrue:[ |
|
555 |
backgroundColorHolder := ValueHolder new. |
|
556 |
]. |
|
557 |
^ backgroundColorHolder |
|
558 |
! |
|
559 |
||
560 |
backgroundColorHolder:something |
|
561 |
"set the 'backgroundColorHolder' value holder (automatically generated)" |
|
562 |
||
563 |
|oldValue newValue| |
|
564 |
||
565 |
backgroundColorHolder notNil ifTrue:[ |
|
566 |
oldValue := backgroundColorHolder value. |
|
567 |
backgroundColorHolder removeDependent:self. |
|
568 |
]. |
|
569 |
backgroundColorHolder := something. |
|
570 |
backgroundColorHolder notNil ifTrue:[ |
|
571 |
backgroundColorHolder addDependent:self. |
|
572 |
]. |
|
573 |
newValue := backgroundColorHolder value. |
|
574 |
oldValue ~~ newValue ifTrue:[ |
|
575 |
self update:#value with:newValue from:backgroundColorHolder. |
|
576 |
]. |
|
577 |
! |
|
578 |
||
579 |
backgroundColorOrDefaultHolder |
|
580 |
"return/create the 'backgroundColorOrDefaultHolder' value holder (automatically generated)" |
|
581 |
||
582 |
backgroundColorOrDefaultHolder isNil ifTrue:[ |
|
583 |
backgroundColorOrDefaultHolder := ValueHolder new. |
|
584 |
backgroundColorOrDefaultHolder addDependent:self. |
|
585 |
]. |
|
586 |
^ backgroundColorOrDefaultHolder |
|
587 |
! |
|
588 |
||
9987 | 589 |
messageHolder |
590 |
<resource: #uiAspect> |
|
591 |
||
592 |
messageHolder isNil ifTrue:[ |
|
593 |
messageHolder := ValueHolder new. |
|
594 |
]. |
|
595 |
^ messageHolder. |
|
11509 | 596 |
|
597 |
"Modified (comment): / 15-05-2012 / 11:08:35 / cg" |
|
9987 | 598 |
! |
599 |
||
11248 | 600 |
panelHiddenHolder |
601 |
"return/create the 'panelHiddenHolder' value holder (automatically generated)" |
|
602 |
||
603 |
panelHiddenHolder isNil ifTrue:[ |
|
604 |
panelHiddenHolder := ValueHolder new. |
|
605 |
]. |
|
606 |
^ panelHiddenHolder |
|
607 |
! |
|
608 |
||
609 |
panelHiddenHolder:aValueModel |
|
610 |
"set the 'panelHiddenHolder' value holder (automatically generated)" |
|
611 |
||
612 |
panelHiddenHolder := aValueModel. |
|
613 |
! |
|
614 |
||
615 |
panelShownHolder |
|
616 |
"return/create the 'panelShownHolder' value holder (automatically generated)" |
|
617 |
||
618 |
panelShownHolder isNil ifTrue:[ |
|
619 |
panelShownHolder := ValueHolder new. |
|
620 |
]. |
|
621 |
^ panelShownHolder |
|
622 |
! |
|
623 |
||
624 |
panelShownHolder:aValueModel |
|
625 |
"set the 'panelShownHolder' value holder (automatically generated)" |
|
626 |
||
627 |
panelShownHolder := aValueModel. |
|
628 |
! |
|
629 |
||
9987 | 630 |
progressHolder |
631 |
"automatically generated by UIPainter ..." |
|
632 |
||
16187 | 633 |
<resource: #uiAspect> |
9987 | 634 |
|
635 |
progressHolder isNil ifTrue:[ |
|
636 |
progressHolder := ValueHolder new. |
|
637 |
]. |
|
638 |
^ progressHolder. |
|
639 |
! |
|
640 |
||
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
641 |
progressIndicatorForegroundHolder |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
642 |
progressIndicatorForegroundHolder isNil ifTrue:[ |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
643 |
progressIndicatorForegroundHolder := ValueHolder new. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
644 |
]. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
645 |
^ progressIndicatorForegroundHolder |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
646 |
! |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
647 |
|
9987 | 648 |
specHolder |
649 |
"return/create the 'specHolder' value holder (automatically generated)" |
|
650 |
||
651 |
specHolder isNil ifTrue:[ |
|
652 |
specHolder := ValueHolder with: #messageInfoSpec. |
|
653 |
]. |
|
654 |
^ specHolder |
|
655 |
||
656 |
"Modified: / 28-10-2010 / 18:29:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
657 |
! ! |
|
658 |
||
11518 | 659 |
!InlineMessageDialog methodsFor:'change & update'! |
660 |
||
661 |
update:aspect with:parameter from:changedObject |
|
662 |
"Invoked when an object that I depend upon sends a change notification." |
|
663 |
||
664 |
changedObject == backgroundColorHolder ifTrue:[ |
|
665 |
self backgroundColorOrDefaultHolder value: backgroundColorHolder value. |
|
666 |
^ self. |
|
667 |
]. |
|
668 |
super update:aspect with:parameter from:changedObject |
|
669 |
||
670 |
"Modified: / 10-04-2012 / 19:36:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
671 |
! ! |
|
672 |
||
11249 | 673 |
!InlineMessageDialog methodsFor:'hooks'! |
674 |
||
11518 | 675 |
commonPostBuild |
676 |
panelViewComponents notEmptyOrNil ifTrue:[ |
|
15741
7269057cc08d
class: Tools::InlineMessageDialog
Stefan Vogel <sv@exept.de>
parents:
15500
diff
changeset
|
677 |
panelViewComponents do:[:each| panelView addSubView: each]. |
7269057cc08d
class: Tools::InlineMessageDialog
Stefan Vogel <sv@exept.de>
parents:
15500
diff
changeset
|
678 |
panelViewComponents := nil. |
11518 | 679 |
"/ "/Correction view, dunno why the layout is bad without it... |
680 |
"/ correctionView := View new. |
|
681 |
"/ correctionView extent: (panelView subViews size * 3)@24. |
|
682 |
"/ correctionView backgroundChannel: self backgroundColorOrDefaultHolder. |
|
683 |
"/ panelView addComponent: correctionView |
|
684 |
] |
|
685 |
||
686 |
"Created: / 10-04-2012 / 21:02:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
687 |
! |
|
688 |
||
689 |
postBuildPanelView: aPanelView |
|
690 |
panelView := aPanelView. |
|
691 |
||
692 |
"Created: / 10-04-2012 / 20:47:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
693 |
! |
|
694 |
||
11249 | 695 |
postBuildProgressView: aProgressIndicator |
696 |
progressView := aProgressIndicator |
|
697 |
||
698 |
"Created: / 10-02-2012 / 10:42:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
699 |
! ! |
|
700 |
||
9987 | 701 |
!InlineMessageDialog methodsFor:'private'! |
702 |
||
703 |
getMyView |
|
704 |
||
705 |
| v | |
|
706 |
||
11518 | 707 |
builder isNil ifTrue:[ ^ nil ]. |
9987 | 708 |
v := builder window. |
709 |
^(v superView isKindOf: SubCanvas) |
|
710 |
ifTrue:[v superView] |
|
711 |
ifFalse:[v] |
|
712 |
||
713 |
"Created: / 29-10-2010 / 11:49:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
714 |
! |
|
715 |
||
716 |
getOtherView |
|
717 |
||
718 |
| myView | |
|
719 |
||
720 |
myView := self getMyView. |
|
11518 | 721 |
^ (myView isNil or:[myView superView isNil]) ifTrue:[ |
11248 | 722 |
nil. |
723 |
] ifFalse: [ |
|
724 |
myView superView subViews after: myView |
|
725 |
]. |
|
9987 | 726 |
|
727 |
"Created: / 29-10-2010 / 11:49:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
728 |
! |
|
729 |
||
730 |
hide |
|
731 |
||
732 |
| myView otherView | |
|
12416
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
733 |
builder isNil ifTrue:[ ^ self ]. |
9987 | 734 |
myView := self getMyView. |
735 |
otherView := self getOtherView. |
|
736 |
||
11518 | 737 |
myView isVisible ifFalse:[ "/already hidden" |
738 |
self reset. |
|
739 |
^self |
|
740 |
]. |
|
9987 | 741 |
myView isVisible: false. |
11248 | 742 |
panelShownHolder notNil ifTrue:[ |
743 |
panelShownHolder value: false |
|
744 |
]. |
|
745 |
panelHiddenHolder notNil ifTrue:[ |
|
746 |
panelHiddenHolder value: true |
|
747 |
]. |
|
11518 | 748 |
changeLayoutUponShowHide ~~ false ifTrue:[ |
12416
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
749 |
otherView layout: layout. |
11518 | 750 |
]. |
11248 | 751 |
|
11518 | 752 |
self reset. |
9987 | 753 |
|
754 |
"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
|
755 |
"Modified (format): / 17-01-2013 / 23:35:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9987 | 756 |
! |
757 |
||
11518 | 758 |
show |
9987 | 759 |
|
760 |
| myView otherView | |
|
761 |
myView := self getMyView. |
|
762 |
otherView := self getOtherView. |
|
11518 | 763 |
(myView isNil or:[myView isVisible]) ifTrue:[ |
764 |
^self. |
|
765 |
]. |
|
9987 | 766 |
myView isVisible: true. |
11248 | 767 |
panelShownHolder notNil ifTrue:[ |
768 |
panelShownHolder value: true |
|
769 |
]. |
|
770 |
panelHiddenHolder notNil ifTrue:[ |
|
771 |
panelHiddenHolder value: false |
|
772 |
]. |
|
773 |
||
11518 | 774 |
changeLayoutUponShowHide ~~ false ifTrue:[ |
775 |
otherView notNil ifTrue:[ |
|
776 |
layout := otherView layout copy. |
|
777 |
otherView layout: |
|
778 |
(layout copy topOffset: layout topOffset + 40; yourself). |
|
779 |
]. |
|
780 |
]. |
|
781 |
||
782 |
"Created: / 11-04-2012 / 11:43:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
783 |
! |
|
784 |
||
785 |
show: spec |
|
786 |
<resource: #obsolete> |
|
787 |
||
788 |
self obsoleteMethodWarning. |
|
789 |
self breakPoint: #jv. |
|
790 |
||
791 |
spec == #warningInfoSpec ifTrue:[ self beWarning ]. |
|
792 |
spec == #messageInfoSpec ifTrue:[ self beInformation ]. |
|
793 |
spec == #progressInfoSpec ifTrue:[ self beProgress ]. |
|
794 |
self show. |
|
9987 | 795 |
|
796 |
"Created: / 29-10-2010 / 11:48:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
797 |
! ! |
|
798 |
||
14525
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
799 |
!InlineMessageDialog methodsFor:'testing'! |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
800 |
|
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
801 |
isMessageOrWarning |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
802 |
^ self specHolder value == #messageInfoSpec. |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
803 |
|
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
804 |
"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
|
805 |
! |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
806 |
|
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
807 |
isProgress |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
808 |
^ self specHolder value == #progressInfoSpec. |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
809 |
|
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
810 |
"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
|
811 |
! |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
812 |
|
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
813 |
isVisible |
14813
0fa22b6fe63a
Hack in Tools::InlineMessageDialog>>isVisible
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14525
diff
changeset
|
814 |
| myView | |
0fa22b6fe63a
Hack in Tools::InlineMessageDialog>>isVisible
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14525
diff
changeset
|
815 |
|
0fa22b6fe63a
Hack in Tools::InlineMessageDialog>>isVisible
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14525
diff
changeset
|
816 |
myView := self getMyView. |
0fa22b6fe63a
Hack in Tools::InlineMessageDialog>>isVisible
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14525
diff
changeset
|
817 |
^ myView notNil and:[ myView isVisible ] |
14525
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
818 |
|
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
819 |
"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
|
820 |
"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
|
821 |
! ! |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
822 |
|
11518 | 823 |
!InlineMessageDialog methodsFor:'utilities'! |
824 |
||
825 |
reset |
|
826 |
"Resets the dialog to initial state, removes all |
|
827 |
user supplied components." |
|
828 |
||
829 |
self removeComponents. |
|
830 |
||
831 |
"Created: / 11-04-2012 / 00:51:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
832 |
! |
|
833 |
||
834 |
showMessage: aString |
|
835 |
"Shows given message and OK button (which closes the dialog |
|
836 |
when clicked" |
|
837 |
||
838 |
self showMessage: aString closeAfter: nil |
|
839 |
||
840 |
"Created: / 11-04-2012 / 13:11:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
841 |
! |
|
842 |
||
843 |
showMessage: aString closeAfter: aTimeDurationOrIntegerOrNil |
|
844 |
"Shows given message and OK button (which closes the dialog |
|
845 |
when clicked). The dialog closes automaticaly after |
|
846 |
aTimeDurationOrIntegerOrNil (integer value means secons, nil |
|
847 |
means do not close automatically)" |
|
848 |
||
849 |
||
850 |
self reset. |
|
851 |
self beInformation. |
|
852 |
self message: aString. |
|
853 |
self addButtonOK. |
|
854 |
self show. |
|
855 |
aTimeDurationOrIntegerOrNil notNil ifTrue:[ |
|
856 |
worker := |
|
857 |
[ |
|
858 |
aTimeDurationOrIntegerOrNil isInteger ifTrue:[ |
|
859 |
Delay waitForSeconds: aTimeDurationOrIntegerOrNil. |
|
860 |
] ifFalse:[ |
|
861 |
Delay waitForMilliseconds: aTimeDurationOrIntegerOrNil milliseconds |
|
862 |
]. |
|
863 |
self hide. |
|
864 |
] newProcess. |
|
865 |
worker addExitAction:[ worker := nil ]. |
|
866 |
worker resume. |
|
867 |
]. |
|
868 |
||
869 |
"Created: / 11-04-2012 / 13:13:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
870 |
! |
|
871 |
||
872 |
showProgressLabeled: aString while: aBlock |
|
873 |
"During an execution of aBlock, show a label with given |
|
874 |
string, a progressbar showing the progress and an 'Abort' button. |
|
875 |
||
17052 | 876 |
If the block raises a ProgressNotification, then the percentage |
877 |
progress is updated accordingly. If it raises an ActivityNotification, |
|
878 |
then the label is updated and progress bar is changed to be an |
|
879 |
activity notificator. |
|
11518 | 880 |
|
17052 | 881 |
When an 'Abort' button is pressed, the block is interrupted by AbortOperationRequest. |
11518 | 882 |
|
17052 | 883 |
When aBlock terminates (either normally or abruptly, the inline-dialog is closed). |
11518 | 884 |
" |
885 |
||
886 |
worker := [ |
|
887 |
self reset. |
|
888 |
self beProgress. |
|
889 |
self message: aString. |
|
890 |
self addButtonAbort. |
|
891 |
self progress: nil. |
|
892 |
self show. |
|
893 |
[ |
|
894 |
aBlock value. |
|
895 |
] on: ProgressNotification , ActivityNotification do:[:ex| |
|
17052 | 896 |
|status color| |
897 |
||
898 |
ex creator == ProgressNotification ifTrue:[ |
|
899 |
status := ex statusInfo. |
|
900 |
status notNil ifTrue:[ |
|
901 |
status == #error ifTrue:[ |
|
902 |
color := Color red. |
|
903 |
] ifFalse:[ |
|
904 |
status == #warning ifTrue:[ |
|
905 |
color := Color orange. |
|
906 |
] ifFalse:[ |
|
907 |
color := Color yellow. |
|
908 |
]. |
|
909 |
]. |
|
910 |
self progressIndicatorForegroundHolder value:color. |
|
911 |
]. |
|
912 |
]. |
|
11518 | 913 |
self progress: ex parameter. |
914 |
ex messageText notNil ifTrue:[ |
|
915 |
self message: ex messageText. |
|
916 |
]. |
|
917 |
ex proceed. |
|
918 |
]. |
|
919 |
] newProcess. |
|
920 |
worker addExitAction:[ |
|
921 |
"This check is required, since somebody may want to show |
|
922 |
info/warning from within the action block" |
|
923 |
self specHolder value == #progressInfoSpec ifTrue:[ |
|
924 |
self hide. |
|
925 |
]. |
|
926 |
worker := nil. |
|
927 |
]. |
|
928 |
worker resume. |
|
929 |
||
930 |
"Created: / 11-04-2012 / 13:38:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
931 |
! ! |
|
932 |
||
933 |
!InlineMessageDialog methodsFor:'utilities-obsolete'! |
|
934 |
||
935 |
information: message |
|
936 |
||
937 |
self information: message timeout: nil |
|
938 |
||
939 |
"Created: / 11-02-2012 / 23:14:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
940 |
! |
|
941 |
||
942 |
information: message timeout: timeoutOrNil |
|
943 |
||
944 |
self reset. |
|
945 |
self beInformation. |
|
946 |
self message: message. |
|
947 |
self addButtonOK. |
|
948 |
self show. |
|
949 |
timeoutOrNil isInteger ifTrue:[ |
|
950 |
[ |
|
951 |
Delay waitForSeconds: timeoutOrNil. |
|
952 |
self hide. |
|
953 |
] fork. |
|
954 |
] |
|
955 |
||
956 |
"Created: / 11-02-2012 / 23:14:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
957 |
! |
|
958 |
||
959 |
progress: label while: block |
|
960 |
||
961 |
worker := [ |
|
962 |
self reset. |
|
963 |
self beProgress. |
|
964 |
self message: label. |
|
965 |
self addButtonAbort. |
|
966 |
self progress: nil. |
|
967 |
self show. |
|
968 |
[ |
|
969 |
block value. |
|
970 |
] on: ProgressNotification , ActivityNotification do:[:ex| |
|
971 |
self progress: ex parameter. |
|
972 |
ex messageText notNil ifTrue:[ |
|
973 |
self message: ex messageText. |
|
974 |
]. |
|
975 |
ex proceed. |
|
976 |
]. |
|
977 |
] newProcess. |
|
978 |
worker addExitAction:[ |
|
979 |
self specHolder value == #progressInfoSpec ifTrue:[ |
|
980 |
self hide. |
|
981 |
]. |
|
982 |
worker := nil. |
|
983 |
]. |
|
984 |
worker resume. |
|
985 |
||
986 |
"Created: / 10-02-2012 / 10:34:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
987 |
! |
|
988 |
||
989 |
warning: message action: block labeled: label |
|
990 |
||
991 |
self reset. |
|
992 |
self beWarning. |
|
993 |
self message: message. |
|
994 |
self addButtonWithLabel: label action: block. |
|
995 |
self addButtonOK. |
|
996 |
self show |
|
997 |
||
998 |
"Created: / 13-02-2012 / 16:59:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
999 |
! ! |
|
1000 |
||
9987 | 1001 |
!InlineMessageDialog class methodsFor:'documentation'! |
1002 |
||
11249 | 1003 |
version |
15741
7269057cc08d
class: Tools::InlineMessageDialog
Stefan Vogel <sv@exept.de>
parents:
15500
diff
changeset
|
1004 |
^ '$Header$' |
12462
7466535c9b47
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12416
diff
changeset
|
1005 |
! |
7466535c9b47
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12416
diff
changeset
|
1006 |
|
16439 | 1007 |
version_CVS |
1008 |
^ '$Header$' |
|
1009 |
! |
|
1010 |
||
12462
7466535c9b47
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12416
diff
changeset
|
1011 |
version_HG |
7466535c9b47
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12416
diff
changeset
|
1012 |
|
13853 | 1013 |
^ '$Changeset: <not expanded> $' |
11249 | 1014 |
! |
1015 |
||
9987 | 1016 |
version_SVN |
15741
7269057cc08d
class: Tools::InlineMessageDialog
Stefan Vogel <sv@exept.de>
parents:
15500
diff
changeset
|
1017 |
^ '$Id$' |
9987 | 1018 |
! ! |
12416
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
1019 |