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