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