author | Patrik Svestka <patrik.svestka@gmail.com> |
Mon, 22 Nov 2021 12:32:59 +0100 | |
branch | jv |
changeset 19621 | 1cb1e6ba9f20 |
parent 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 |
|
19612
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
4 |
Copyright (c) 2021 LabWare |
9987 | 5 |
|
10099 | 6 |
Permission is hereby granted, free of charge, to any person |
7 |
obtaining a copy of this software and associated documentation |
|
8 |
files (the 'Software'), to deal in the Software without |
|
9 |
restriction, including without limitation the rights to use, |
|
10 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
11 |
copies of the Software, and to permit persons to whom the |
|
12 |
Software is furnished to do so, subject to the following |
|
13 |
conditions: |
|
14 |
||
15 |
The above copyright notice and this permission notice shall be |
|
16 |
included in all copies or substantial portions of the Software. |
|
17 |
||
18 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
19 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
20 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
21 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
22 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
23 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
24 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
25 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9987 | 26 |
" |
27 |
"{ Package: 'stx:libtool' }" |
|
28 |
||
29 |
"{ NameSpace: Tools }" |
|
30 |
||
31 |
ApplicationModel subclass:#InlineMessageDialog |
|
12686
0920976ce7ef
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
12603
diff
changeset
|
32 |
instanceVariableNames:'messageHolder progressHolder backgroundColorHolder |
0920976ce7ef
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
12603
diff
changeset
|
33 |
backgroundColorOrDefaultHolder progressView panelView |
0920976ce7ef
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
12603
diff
changeset
|
34 |
panelViewComponents specHolder panelShownHolder panelHiddenHolder |
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
35 |
worker layout changeLayoutUponShowHide |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
36 |
progressIndicatorForegroundHolder' |
12686
0920976ce7ef
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
12603
diff
changeset
|
37 |
classVariableNames:'' |
0920976ce7ef
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
12603
diff
changeset
|
38 |
poolDictionaries:'' |
0920976ce7ef
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
12603
diff
changeset
|
39 |
category:'Interface-Tools' |
9987 | 40 |
! |
41 |
||
42 |
!InlineMessageDialog class methodsFor:'documentation'! |
|
43 |
||
44 |
copyright |
|
45 |
" |
|
10099 | 46 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
47 |
Copyright (c) 2009-2010 eXept Software AG |
|
19612
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
48 |
Copyright (c) 2021 LabWare |
10099 | 49 |
|
50 |
Permission is hereby granted, free of charge, to any person |
|
51 |
obtaining a copy of this software and associated documentation |
|
52 |
files (the 'Software'), to deal in the Software without |
|
53 |
restriction, including without limitation the rights to use, |
|
54 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
55 |
copies of the Software, and to permit persons to whom the |
|
56 |
Software is furnished to do so, subject to the following |
|
57 |
conditions: |
|
9987 | 58 |
|
10099 | 59 |
The above copyright notice and this permission notice shall be |
60 |
included in all copies or substantial portions of the Software. |
|
61 |
||
62 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
63 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
64 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
65 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
66 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
67 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
68 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
69 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9987 | 70 |
" |
11518 | 71 |
! |
72 |
||
73 |
documentation |
|
74 |
" |
|
75 |
A simple info/warning dialog to embed into application window - |
|
76 |
much like information panel in Firefox or other applications. |
|
77 |
Use it when a modal dialog might be too disturbing. |
|
78 |
||
79 |
||
80 |
[author:] |
|
81 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
|
82 |
||
83 |
[instance variables:] |
|
84 |
||
85 |
[class variables:] |
|
86 |
||
87 |
[see also:] |
|
88 |
||
89 |
" |
|
90 |
! |
|
91 |
||
92 |
examples |
|
93 |
" |
|
94 |
Starting the application: |
|
95 |
[exBegin] |
|
96 |
Tools::InlineMessageDialog new |
|
97 |
open; |
|
98 |
message: 'Hello World'; |
|
99 |
show: #messageInfoSpec. |
|
100 |
||
101 |
||
102 |
[exEnd] |
|
103 |
||
104 |
more examples to be added: |
|
105 |
[exBegin] |
|
106 |
... add code fragment for |
|
107 |
... executable example here ... |
|
108 |
[exEnd] |
|
109 |
" |
|
110 |
! ! |
|
111 |
||
9987 | 112 |
!InlineMessageDialog class methodsFor:'interface specs'! |
113 |
||
114 |
messageInfoSpec |
|
115 |
"This resource specification was automatically generated |
|
116 |
by the UIPainter of ST/X." |
|
117 |
||
118 |
"Do not manually edit this!! If it is corrupted, |
|
119 |
the UIPainter may not be able to read the specification." |
|
120 |
||
121 |
" |
|
11518 | 122 |
UIPainter new openOnClass:Tools::InlineMessageDialog andSelector:#messageInfoSpec |
123 |
Tools::InlineMessageDialog new openInterface:#messageInfoSpec |
|
9987 | 124 |
" |
125 |
||
126 |
<resource: #canvas> |
|
127 |
||
128 |
^ |
|
129 |
#(FullSpec |
|
130 |
name: messageInfoSpec |
|
131 |
window: |
|
132 |
(WindowSpec |
|
133 |
label: 'MessageInfo' |
|
134 |
name: 'MessageInfo' |
|
135 |
min: (Point 10 10) |
|
136 |
bounds: (Rectangle 0 0 800 40) |
|
137 |
) |
|
138 |
component: |
|
139 |
(SpecCollection |
|
140 |
collection: ( |
|
141 |
(LabelSpec |
|
142 |
label: 'Label' |
|
143 |
name: 'Message' |
|
11518 | 144 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
145 |
backgroundChannel: backgroundColorOrDefaultHolder |
|
9987 | 146 |
translateLabel: true |
147 |
labelChannel: messageHolder |
|
148 |
adjust: left |
|
149 |
) |
|
150 |
) |
|
151 |
||
152 |
) |
|
153 |
) |
|
154 |
! |
|
155 |
||
156 |
progressInfoSpec |
|
157 |
"This resource specification was automatically generated |
|
158 |
by the UIPainter of ST/X." |
|
159 |
||
160 |
"Do not manually edit this!! If it is corrupted, |
|
161 |
the UIPainter may not be able to read the specification." |
|
162 |
||
163 |
" |
|
164 |
UIPainter new openOnClass:Tools::InlineMessageDialog andSelector:#progressInfoSpec |
|
165 |
Tools::InlineMessageDialog new openInterface:#progressInfoSpec |
|
166 |
" |
|
167 |
||
168 |
<resource: #canvas> |
|
169 |
||
170 |
^ |
|
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
171 |
#(FullSpec |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
172 |
name: progressInfoSpec |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
173 |
window: |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
174 |
(WindowSpec |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
175 |
label: 'ProgressInfo' |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
176 |
name: 'ProgressInfo' |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
177 |
min: (Point 10 10) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
178 |
bounds: (Rectangle 0 0 800 40) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
179 |
forceRecursiveBackgroundOfDefaultBackground: true |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
180 |
) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
181 |
component: |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
182 |
(SpecCollection |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
183 |
collection: ( |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
184 |
(ViewSpec |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
185 |
name: 'Box1' |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
186 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
187 |
level: 0 |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
188 |
backgroundChannel: backgroundColorOrDefaultHolder |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
189 |
component: |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
190 |
(SpecCollection |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
191 |
collection: ( |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
192 |
(LabelSpec |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
193 |
label: 'Label' |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
194 |
name: 'Message' |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
195 |
layout: (LayoutFrame 0 0 0 0 -20 1 20 0) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
196 |
backgroundChannel: backgroundColorOrDefaultHolder |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
197 |
translateLabel: true |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
198 |
labelChannel: messageHolder |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
199 |
adjust: left |
11518 | 200 |
) |
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
201 |
(ProgressIndicatorSpec |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
202 |
name: 'ProgressIndicator' |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
203 |
layout: (LayoutFrame 0 0 -20 1 -20 1 -3 1) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
204 |
level: 0 |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
205 |
backgroundChannel: backgroundColorOrDefaultHolder |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
206 |
foregroundChannel: progressIndicatorForegroundHolder |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
207 |
model: progressHolder |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
208 |
postBuildCallback: postBuildProgressView: |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
209 |
) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
210 |
) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
211 |
|
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
212 |
) |
9987 | 213 |
) |
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
214 |
) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
215 |
|
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
216 |
) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
217 |
) |
9987 | 218 |
! |
219 |
||
11518 | 220 |
warningInfoSpec |
221 |
||
222 |
<resource: #canvas> |
|
223 |
||
224 |
^self messageInfoSpec |
|
225 |
||
226 |
"Modified: / 10-04-2012 / 19:40:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
227 |
! |
|
228 |
||
9987 | 229 |
windowSpec |
230 |
"This resource specification was automatically generated |
|
231 |
by the UIPainter of ST/X." |
|
232 |
||
233 |
"Do not manually edit this!! If it is corrupted, |
|
234 |
the UIPainter may not be able to read the specification." |
|
235 |
||
236 |
" |
|
237 |
UIPainter new openOnClass:Tools::InlineMessageDialog andSelector:#windowSpec |
|
238 |
Tools::InlineMessageDialog new openInterface:#windowSpec |
|
239 |
Tools::InlineMessageDialog open |
|
240 |
" |
|
241 |
||
242 |
<resource: #canvas> |
|
243 |
||
244 |
^ |
|
245 |
#(FullSpec |
|
246 |
name: windowSpec |
|
247 |
window: |
|
248 |
(WindowSpec |
|
249 |
label: 'Tools::InlineMessageDialog' |
|
250 |
name: 'Tools::InlineMessageDialog' |
|
251 |
min: (Point 10 10) |
|
252 |
bounds: (Rectangle 0 0 800 40) |
|
253 |
) |
|
254 |
component: |
|
255 |
(SpecCollection |
|
256 |
collection: ( |
|
11518 | 257 |
(ViewSpec |
258 |
name: 'Layout' |
|
9987 | 259 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
11518 | 260 |
backgroundChannel: backgroundColorOrDefaultHolder |
261 |
component: |
|
262 |
(SpecCollection |
|
263 |
collection: ( |
|
264 |
(HorizontalPanelViewSpec |
|
265 |
name: 'ComponentPanel' |
|
266 |
layout: (LayoutFrame 12 0 0 0 -10 1 0 1) |
|
267 |
backgroundChannel: backgroundColorOrDefaultHolder |
|
268 |
horizontalLayout: rightSpaceFit |
|
269 |
verticalLayout: fit |
|
270 |
horizontalSpace: 0 |
|
271 |
verticalSpace: 3 |
|
272 |
elementsChangeSize: true |
|
273 |
component: |
|
274 |
(SpecCollection |
|
275 |
collection: ( |
|
276 |
(SubCanvasSpec |
|
277 |
name: 'InfoSpec' |
|
278 |
level: 0 |
|
279 |
hasHorizontalScrollBar: false |
|
280 |
hasVerticalScrollBar: false |
|
281 |
miniScrollerHorizontal: false |
|
282 |
specHolder: specHolder |
|
283 |
createNewBuilder: false |
|
284 |
usePreferredHeight: true |
|
285 |
useDynamicPreferredWidth: true |
|
286 |
useDynamicPreferredHeight: true |
|
287 |
useDefaultExtent: true |
|
288 |
usePreferredWidth: true |
|
289 |
) |
|
290 |
) |
|
291 |
||
292 |
) |
|
293 |
postBuildCallback: postBuildPanelView: |
|
294 |
) |
|
295 |
) |
|
296 |
||
297 |
) |
|
9987 | 298 |
) |
299 |
) |
|
300 |
||
301 |
) |
|
302 |
) |
|
303 |
! ! |
|
304 |
||
305 |
!InlineMessageDialog methodsFor:'accessing'! |
|
306 |
||
11518 | 307 |
backgroundColor: aColor |
308 |
"Sets the background color, but only iff backgroundColorHolder is |
|
309 |
not set" |
|
310 |
||
311 |
backgroundColorHolder isNil ifTrue:[ |
|
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
312 |
self backgroundColorOrDefaultHolder value: aColor. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
313 |
self progressIndicatorForegroundHolder value:(aColor darkened). |
11518 | 314 |
] |
315 |
||
316 |
"Created: / 10-04-2012 / 19:38:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
317 |
! |
|
318 |
||
15500
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
319 |
buttons |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
320 |
panelView isNil ifTrue:[ ^ #() ]. |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
321 |
^ OrderedCollection streamContents:[ :s | |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
322 |
panelView allSubViewsDo:[:v | |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
323 |
(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
|
324 |
s nextPut: v |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
325 |
]. |
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 |
"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
|
330 |
! |
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 |
message |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
333 |
^ self messageHolder value |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
334 |
|
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
335 |
"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
|
336 |
! |
3822905f9e58
Added accessors #message and #buttons.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15054
diff
changeset
|
337 |
|
9987 | 338 |
message: aString |
339 |
||
340 |
self messageHolder value: aString |
|
341 |
||
342 |
"Created: / 28-10-2010 / 18:23:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
343 |
! |
|
344 |
||
345 |
progress: aNumberOrNil |
|
346 |
||
11249 | 347 |
aNumberOrNil isNumber ifTrue:[ |
348 |
progressView notNil ifTrue:[ |
|
349 |
progressView showBusyIndication: false. |
|
350 |
]. |
|
351 |
self progressHolder value: aNumberOrNil |
|
352 |
] ifFalse:[ |
|
353 |
progressView notNil ifTrue:[ |
|
354 |
progressView showBusyIndication: true. |
|
355 |
] |
|
356 |
||
357 |
] |
|
9987 | 358 |
|
359 |
"Created: / 28-10-2010 / 18:24:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
360 |
! ! |
|
361 |
||
19612
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
362 |
!InlineMessageDialog methodsFor:'accessing-look'! |
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
363 |
|
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
364 |
infoBackgroundColor |
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
365 |
<resource: #style (#'inlineMessageDialog.info.backgroundColor')> |
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
366 |
|
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
367 |
^ self styleSheet |
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
368 |
colorAt: #'inlineMessageDialog.info.backgroundColor' |
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
369 |
default: [ Color blue lighter ] |
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
370 |
|
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
371 |
"Created: / 17-09-2021 / 21:08:04 / Jan Vrany <jan.vrany@labware.com>" |
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
372 |
! |
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
373 |
|
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
374 |
warnBackgroundColor |
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
375 |
<resource: #style (#'inlineMessageDialog.warning.backgroundColor')> |
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
376 |
|
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
377 |
^ self styleSheet |
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
378 |
colorAt: #'inlineMessageDialog.warning.backgroundColor' |
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
379 |
default: [ Color red:76 green:43 blue:43 ] |
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
380 |
|
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
381 |
"Created: / 17-09-2021 / 21:09:19 / Jan Vrany <jan.vrany@labware.com>" |
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
382 |
! ! |
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
383 |
|
11518 | 384 |
!InlineMessageDialog methodsFor:'accessing-presentation'! |
385 |
||
386 |
changeLayoutUponShowHide: aBoolean |
|
387 |
"If set to false, no changes to compokent layout is done |
|
388 |
when panel is shown/hidden. This effectively means, that |
|
389 |
that panel is shown over the normal content. |
|
390 |
||
391 |
Default value is true (i.e., relayout components)" |
|
392 |
||
393 |
changeLayoutUponShowHide := aBoolean |
|
394 |
||
395 |
"Modified (comment): / 17-05-2012 / 13:56:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
396 |
! ! |
|
397 |
||
9987 | 398 |
!InlineMessageDialog methodsFor:'actions'! |
399 |
||
400 |
doAbort |
|
401 |
||
11248 | 402 |
worker isNil ifTrue:[ self hide. ^ self ]. |
403 |
worker interruptWith:[ |
|
404 |
NoHandlerError handle:[:ex | |
|
12686
0920976ce7ef
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
12603
diff
changeset
|
405 |
ex exception creator == AbortOperationRequest ifTrue:[ |
11248 | 406 |
ex return. |
407 |
]. |
|
408 |
ex reject. |
|
409 |
] do:[ |
|
410 |
AbortOperationRequest raise. |
|
411 |
]. |
|
13853 | 412 |
]. |
413 |
(worker notNil and:[worker isDead not]) ifTrue:[ |
|
414 |
worker terminate. |
|
415 |
"/ raise its prio to make it terminate quickly |
|
12462
7466535c9b47
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12416
diff
changeset
|
416 |
worker priority:(Processor userSchedulingPriority + 1). |
11518 | 417 |
worker := nil. |
418 |
]. |
|
419 |
||
13853 | 420 |
"Modified: / 11-04-2012 / 16:24:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11518 | 421 |
! |
422 |
||
12416
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
423 |
doAbortIfWorking |
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
424 |
worker notNil ifTrue:[ self doAbort ]. |
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
425 |
|
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
426 |
"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
|
427 |
! |
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
428 |
|
11518 | 429 |
doOK |
430 |
<resource: #uiCallback> |
|
431 |
||
432 |
(worker notNil and:[worker isDead not]) ifTrue:[ |
|
13853 | 433 |
worker terminate. |
12416
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
434 |
"/ raise its prio to make it terminate quickly |
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
435 |
worker priority:(Processor userSchedulingPriority + 1). |
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
436 |
worker := nil. |
11248 | 437 |
]. |
11518 | 438 |
self hide. |
9987 | 439 |
|
13853 | 440 |
"Modified: / 31-03-2013 / 18:02:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11518 | 441 |
! ! |
442 |
||
443 |
!InlineMessageDialog methodsFor:'adding & removing components'! |
|
444 |
||
445 |
addButton: aButton |
|
446 |
| layoutView | |
|
447 |
||
448 |
aButton preferredExtent: ((aButton width + 20) max: 70"px") @ 24. |
|
449 |
layoutView := View new. |
|
450 |
layoutView backgroundChannel: self backgroundColorOrDefaultHolder. |
|
451 |
layoutView addComponent: aButton. |
|
452 |
aButton layout: |
|
453 |
( LayoutFrame fractions:(0 @ 0.5 corner:1.0 @ 0.5) offsets:(3 @ -12 corner:-3 @ 12) ). |
|
454 |
layoutView preferredExtent: (aButton preferredExtent x + 12) @ 24. |
|
455 |
||
456 |
^self addComponent: layoutView |
|
457 |
||
458 |
"Created: / 10-04-2012 / 20:49:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
459 |
! |
|
460 |
||
461 |
addButtonAbort |
|
462 |
||
463 |
^self addButtonWithLabel: (self resources string:'Abort') action: [ self doAbort ] |
|
464 |
||
465 |
"Created: / 10-04-2012 / 21:45:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
466 |
! |
|
467 |
||
468 |
addButtonOK |
|
469 |
||
470 |
^self addButtonWithLabel: (self resources string:'OK') action: [ self doOK ] |
|
471 |
||
472 |
"Created: / 10-04-2012 / 21:44:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
473 |
! |
|
474 |
||
475 |
addButtonWithLabel: label action: action |
|
476 |
^self addButton: (Button label: label action: action) |
|
477 |
||
478 |
"Created: / 10-04-2012 / 20:50:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9987 | 479 |
! |
480 |
||
11518 | 481 |
addComponent: aView |
482 |
panelView isNil ifTrue:[ |
|
483 |
panelViewComponents isNil ifTrue:[ |
|
484 |
panelViewComponents := OrderedCollection new |
|
485 |
]. |
|
486 |
panelViewComponents add: aView |
|
487 |
] ifFalse:[ |
|
488 |
panelView addSubView: aView. |
|
489 |
aView isVisible: true. |
|
490 |
]. |
|
491 |
^aView. |
|
492 |
||
493 |
"Created: / 10-04-2012 / 20:50:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
494 |
! |
|
495 |
||
496 |
beInformation |
|
19612
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
497 |
self backgroundColor: self infoBackgroundColor. |
11518 | 498 |
self specHolder value: #messageInfoSpec |
499 |
||
500 |
"Created: / 11-04-2012 / 11:39:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
19612
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
501 |
"Modified (format): / 17-09-2021 / 21:12:42 / Jan Vrany <jan.vrany@labware.com>" |
11518 | 502 |
! |
503 |
||
504 |
beProgress |
|
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
505 |
|colorOrNil| |
11518 | 506 |
|
15054
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
507 |
"/ never, ever use explicit colors. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
508 |
"/ 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
|
509 |
"/ (Don't expect otherss to also like your color preferences) |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
510 |
"/ colorOrNil := self class defaultInformationBackground. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
511 |
|
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
512 |
colorOrNil := View styleSheet colorAt:'inlineMessageDialog.information.backgroundColor' default:View defaultBackgroundColor. |
98d0d360d297
class: Tools::InlineMessageDialog
Claus Gittinger <cg@exept.de>
parents:
14813
diff
changeset
|
513 |
self backgroundColor: colorOrNil. |
11518 | 514 |
self specHolder value: #progressInfoSpec |
515 |
||
516 |
"Created: / 11-04-2012 / 11:41:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
517 |
! |
|
9987 | 518 |
|
11518 | 519 |
beWarning |
19612
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
520 |
self backgroundColor: self warnBackgroundColor. |
11518 | 521 |
self specHolder value: #messageInfoSpec |
522 |
||
523 |
"Created: / 11-04-2012 / 11:41:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
19612
9f2e3136aa4d
Themes: use stylesheet to define colors in `InlineMessageDialog` and test runners
Jan Vrany <jan.vrany@labware.com>
parents:
17136
diff
changeset
|
524 |
"Modified: / 17-09-2021 / 21:12:30 / Jan Vrany <jan.vrany@labware.com>" |
11518 | 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. |
|
11518 | 723 |
^ (myView isNil or:[myView superView isNil]) ifTrue:[ |
11248 | 724 |
nil. |
725 |
] ifFalse: [ |
|
726 |
myView superView subViews after: myView |
|
727 |
]. |
|
9987 | 728 |
|
729 |
"Created: / 29-10-2010 / 11:49:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
730 |
! |
|
731 |
||
732 |
hide |
|
733 |
||
734 |
| myView otherView | |
|
12416
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
735 |
builder isNil ifTrue:[ ^ self ]. |
9987 | 736 |
myView := self getMyView. |
737 |
otherView := self getOtherView. |
|
738 |
||
11518 | 739 |
myView isVisible ifFalse:[ "/already hidden" |
740 |
self reset. |
|
741 |
^self |
|
742 |
]. |
|
9987 | 743 |
myView isVisible: false. |
11248 | 744 |
panelShownHolder notNil ifTrue:[ |
745 |
panelShownHolder value: false |
|
746 |
]. |
|
747 |
panelHiddenHolder notNil ifTrue:[ |
|
748 |
panelHiddenHolder value: true |
|
749 |
]. |
|
11518 | 750 |
changeLayoutUponShowHide ~~ false ifTrue:[ |
12416
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
751 |
otherView layout: layout. |
11518 | 752 |
]. |
11248 | 753 |
|
11518 | 754 |
self reset. |
9987 | 755 |
|
756 |
"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
|
757 |
"Modified (format): / 17-01-2013 / 23:35:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9987 | 758 |
! |
759 |
||
11518 | 760 |
show |
9987 | 761 |
|
762 |
| myView otherView | |
|
763 |
myView := self getMyView. |
|
764 |
otherView := self getOtherView. |
|
11518 | 765 |
(myView isNil or:[myView isVisible]) ifTrue:[ |
766 |
^self. |
|
767 |
]. |
|
9987 | 768 |
myView isVisible: true. |
11248 | 769 |
panelShownHolder notNil ifTrue:[ |
770 |
panelShownHolder value: true |
|
771 |
]. |
|
772 |
panelHiddenHolder notNil ifTrue:[ |
|
773 |
panelHiddenHolder value: false |
|
774 |
]. |
|
775 |
||
11518 | 776 |
changeLayoutUponShowHide ~~ false ifTrue:[ |
777 |
otherView notNil ifTrue:[ |
|
778 |
layout := otherView layout copy. |
|
779 |
otherView layout: |
|
780 |
(layout copy topOffset: layout topOffset + 40; yourself). |
|
781 |
]. |
|
782 |
]. |
|
783 |
||
784 |
"Created: / 11-04-2012 / 11:43:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
785 |
! |
|
786 |
||
787 |
show: spec |
|
788 |
<resource: #obsolete> |
|
789 |
||
790 |
self obsoleteMethodWarning. |
|
791 |
self breakPoint: #jv. |
|
792 |
||
793 |
spec == #warningInfoSpec ifTrue:[ self beWarning ]. |
|
794 |
spec == #messageInfoSpec ifTrue:[ self beInformation ]. |
|
795 |
spec == #progressInfoSpec ifTrue:[ self beProgress ]. |
|
796 |
self show. |
|
9987 | 797 |
|
798 |
"Created: / 29-10-2010 / 11:48:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
799 |
! ! |
|
800 |
||
14525
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
801 |
!InlineMessageDialog methodsFor:'testing'! |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
802 |
|
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
803 |
isMessageOrWarning |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
804 |
^ self specHolder value == #messageInfoSpec. |
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 |
"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
|
807 |
! |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
808 |
|
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
809 |
isProgress |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
810 |
^ self specHolder value == #progressInfoSpec. |
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 |
"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
|
813 |
! |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
814 |
|
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
815 |
isVisible |
14813
0fa22b6fe63a
Hack in Tools::InlineMessageDialog>>isVisible
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14525
diff
changeset
|
816 |
| myView | |
0fa22b6fe63a
Hack in Tools::InlineMessageDialog>>isVisible
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14525
diff
changeset
|
817 |
|
0fa22b6fe63a
Hack in Tools::InlineMessageDialog>>isVisible
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14525
diff
changeset
|
818 |
myView := self getMyView. |
0fa22b6fe63a
Hack in Tools::InlineMessageDialog>>isVisible
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14525
diff
changeset
|
819 |
^ myView notNil and:[ myView isVisible ] |
14525
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
820 |
|
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
821 |
"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
|
822 |
"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
|
823 |
! ! |
bd238db12086
Added few testing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13853
diff
changeset
|
824 |
|
11518 | 825 |
!InlineMessageDialog methodsFor:'utilities'! |
826 |
||
827 |
reset |
|
828 |
"Resets the dialog to initial state, removes all |
|
829 |
user supplied components." |
|
830 |
||
831 |
self removeComponents. |
|
832 |
||
833 |
"Created: / 11-04-2012 / 00:51:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
834 |
! |
|
835 |
||
836 |
showMessage: aString |
|
837 |
"Shows given message and OK button (which closes the dialog |
|
838 |
when clicked" |
|
839 |
||
840 |
self showMessage: aString closeAfter: nil |
|
841 |
||
842 |
"Created: / 11-04-2012 / 13:11:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
843 |
! |
|
844 |
||
845 |
showMessage: aString closeAfter: aTimeDurationOrIntegerOrNil |
|
846 |
"Shows given message and OK button (which closes the dialog |
|
847 |
when clicked). The dialog closes automaticaly after |
|
848 |
aTimeDurationOrIntegerOrNil (integer value means secons, nil |
|
849 |
means do not close automatically)" |
|
850 |
||
851 |
||
852 |
self reset. |
|
853 |
self beInformation. |
|
854 |
self message: aString. |
|
855 |
self addButtonOK. |
|
856 |
self show. |
|
857 |
aTimeDurationOrIntegerOrNil notNil ifTrue:[ |
|
858 |
worker := |
|
859 |
[ |
|
860 |
aTimeDurationOrIntegerOrNil isInteger ifTrue:[ |
|
861 |
Delay waitForSeconds: aTimeDurationOrIntegerOrNil. |
|
862 |
] ifFalse:[ |
|
863 |
Delay waitForMilliseconds: aTimeDurationOrIntegerOrNil milliseconds |
|
864 |
]. |
|
865 |
self hide. |
|
866 |
] newProcess. |
|
867 |
worker addExitAction:[ worker := nil ]. |
|
868 |
worker resume. |
|
869 |
]. |
|
870 |
||
871 |
"Created: / 11-04-2012 / 13:13:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
872 |
! |
|
873 |
||
874 |
showProgressLabeled: aString while: aBlock |
|
875 |
"During an execution of aBlock, show a label with given |
|
876 |
string, a progressbar showing the progress and an 'Abort' button. |
|
877 |
||
17052 | 878 |
If the block raises a ProgressNotification, then the percentage |
879 |
progress is updated accordingly. If it raises an ActivityNotification, |
|
880 |
then the label is updated and progress bar is changed to be an |
|
881 |
activity notificator. |
|
11518 | 882 |
|
17052 | 883 |
When an 'Abort' button is pressed, the block is interrupted by AbortOperationRequest. |
11518 | 884 |
|
17052 | 885 |
When aBlock terminates (either normally or abruptly, the inline-dialog is closed). |
11518 | 886 |
" |
887 |
||
888 |
worker := [ |
|
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| |
|
17052 | 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. |
|
905 |
] ifFalse:[ |
|
906 |
status == #warning ifTrue:[ |
|
907 |
color := Color orange. |
|
908 |
] ifFalse:[ |
|
909 |
color := Color yellow. |
|
910 |
]. |
|
911 |
]. |
|
912 |
self progressIndicatorForegroundHolder value:color. |
|
913 |
]. |
|
914 |
]. |
|
11518 | 915 |
self progress: ex parameter. |
916 |
ex messageText notNil ifTrue:[ |
|
917 |
self message: ex messageText. |
|
918 |
]. |
|
919 |
ex proceed. |
|
920 |
]. |
|
921 |
] newProcess. |
|
922 |
worker addExitAction:[ |
|
923 |
"This check is required, since somebody may want to show |
|
924 |
info/warning from within the action block" |
|
925 |
self specHolder value == #progressInfoSpec ifTrue:[ |
|
926 |
self hide. |
|
927 |
]. |
|
928 |
worker := nil. |
|
929 |
]. |
|
930 |
worker resume. |
|
931 |
||
932 |
"Created: / 11-04-2012 / 13:38:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
933 |
! ! |
|
934 |
||
935 |
!InlineMessageDialog methodsFor:'utilities-obsolete'! |
|
936 |
||
937 |
information: message |
|
938 |
||
939 |
self information: message timeout: nil |
|
940 |
||
941 |
"Created: / 11-02-2012 / 23:14:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
942 |
! |
|
943 |
||
944 |
information: message timeout: timeoutOrNil |
|
945 |
||
946 |
self reset. |
|
947 |
self beInformation. |
|
948 |
self message: message. |
|
949 |
self addButtonOK. |
|
950 |
self show. |
|
951 |
timeoutOrNil isInteger ifTrue:[ |
|
952 |
[ |
|
953 |
Delay waitForSeconds: timeoutOrNil. |
|
954 |
self hide. |
|
955 |
] fork. |
|
956 |
] |
|
957 |
||
958 |
"Created: / 11-02-2012 / 23:14:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
959 |
! |
|
960 |
||
961 |
progress: label while: block |
|
962 |
||
963 |
worker := [ |
|
964 |
self reset. |
|
965 |
self beProgress. |
|
966 |
self message: label. |
|
967 |
self addButtonAbort. |
|
968 |
self progress: nil. |
|
969 |
self show. |
|
970 |
[ |
|
971 |
block value. |
|
972 |
] on: ProgressNotification , ActivityNotification do:[:ex| |
|
973 |
self progress: ex parameter. |
|
974 |
ex messageText notNil ifTrue:[ |
|
975 |
self message: ex messageText. |
|
976 |
]. |
|
977 |
ex proceed. |
|
978 |
]. |
|
979 |
] newProcess. |
|
980 |
worker addExitAction:[ |
|
981 |
self specHolder value == #progressInfoSpec ifTrue:[ |
|
982 |
self hide. |
|
983 |
]. |
|
984 |
worker := nil. |
|
985 |
]. |
|
986 |
worker resume. |
|
987 |
||
988 |
"Created: / 10-02-2012 / 10:34:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
989 |
! |
|
990 |
||
991 |
warning: message action: block labeled: label |
|
992 |
||
993 |
self reset. |
|
994 |
self beWarning. |
|
995 |
self message: message. |
|
996 |
self addButtonWithLabel: label action: block. |
|
997 |
self addButtonOK. |
|
998 |
self show |
|
999 |
||
1000 |
"Created: / 13-02-2012 / 16:59:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1001 |
! ! |
|
1002 |
||
9987 | 1003 |
!InlineMessageDialog class methodsFor:'documentation'! |
1004 |
||
11249 | 1005 |
version |
15741
7269057cc08d
class: Tools::InlineMessageDialog
Stefan Vogel <sv@exept.de>
parents:
15500
diff
changeset
|
1006 |
^ '$Header$' |
12462
7466535c9b47
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12416
diff
changeset
|
1007 |
! |
7466535c9b47
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12416
diff
changeset
|
1008 |
|
16439 | 1009 |
version_CVS |
1010 |
^ '$Header$' |
|
1011 |
! |
|
1012 |
||
12462
7466535c9b47
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12416
diff
changeset
|
1013 |
version_HG |
7466535c9b47
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12416
diff
changeset
|
1014 |
|
13853 | 1015 |
^ '$Changeset: <not expanded> $' |
11249 | 1016 |
! |
1017 |
||
9987 | 1018 |
version_SVN |
15741
7269057cc08d
class: Tools::InlineMessageDialog
Stefan Vogel <sv@exept.de>
parents:
15500
diff
changeset
|
1019 |
^ '$Id$' |
9987 | 1020 |
! ! |
12416
1171d0e7a363
class: Tools::InlineMessageDialog
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11518
diff
changeset
|
1021 |