9987
|
1 |
"
|
10099
|
2 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
|
|
3 |
Copyright (c) 2009-2010 eXept Software AG
|
9987
|
4 |
|
10099
|
5 |
Permission is hereby granted, free of charge, to any person
|
|
6 |
obtaining a copy of this software and associated documentation
|
|
7 |
files (the 'Software'), to deal in the Software without
|
|
8 |
restriction, including without limitation the rights to use,
|
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10 |
copies of the Software, and to permit persons to whom the
|
|
11 |
Software is furnished to do so, subject to the following
|
|
12 |
conditions:
|
|
13 |
|
|
14 |
The above copyright notice and this permission notice shall be
|
|
15 |
included in all copies or substantial portions of the Software.
|
|
16 |
|
|
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
24 |
OTHER DEALINGS IN THE SOFTWARE.
|
9987
|
25 |
"
|
|
26 |
"{ Package: 'stx:libtool' }"
|
|
27 |
|
|
28 |
"{ NameSpace: Tools }"
|
|
29 |
|
|
30 |
ApplicationModel subclass:#InlineMessageDialog
|
|
31 |
instanceVariableNames:'messageHolder progressHolder specHolder'
|
|
32 |
classVariableNames:''
|
|
33 |
poolDictionaries:''
|
|
34 |
category:'Interface-Tools'
|
|
35 |
!
|
|
36 |
|
|
37 |
!InlineMessageDialog class methodsFor:'documentation'!
|
|
38 |
|
|
39 |
copyright
|
|
40 |
"
|
10099
|
41 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
|
|
42 |
Copyright (c) 2009-2010 eXept Software AG
|
|
43 |
|
|
44 |
Permission is hereby granted, free of charge, to any person
|
|
45 |
obtaining a copy of this software and associated documentation
|
|
46 |
files (the 'Software'), to deal in the Software without
|
|
47 |
restriction, including without limitation the rights to use,
|
|
48 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
49 |
copies of the Software, and to permit persons to whom the
|
|
50 |
Software is furnished to do so, subject to the following
|
|
51 |
conditions:
|
9987
|
52 |
|
10099
|
53 |
The above copyright notice and this permission notice shall be
|
|
54 |
included in all copies or substantial portions of the Software.
|
|
55 |
|
|
56 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
57 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
58 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
59 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
60 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
61 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
62 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
63 |
OTHER DEALINGS IN THE SOFTWARE.
|
9987
|
64 |
"
|
|
65 |
! !
|
|
66 |
|
|
67 |
!InlineMessageDialog class methodsFor:'interface specs'!
|
|
68 |
|
|
69 |
messageInfoSpec
|
|
70 |
"This resource specification was automatically generated
|
|
71 |
by the UIPainter of ST/X."
|
|
72 |
|
|
73 |
"Do not manually edit this!! If it is corrupted,
|
|
74 |
the UIPainter may not be able to read the specification."
|
|
75 |
|
|
76 |
"
|
|
77 |
UIPainter new openOnClass:Tools::NewSystemBrowser andSelector:#messageInfoSpec
|
|
78 |
Tools::NewSystemBrowser new openInterface:#messageInfoSpec
|
|
79 |
"
|
|
80 |
|
|
81 |
<resource: #canvas>
|
|
82 |
|
|
83 |
^
|
|
84 |
#(FullSpec
|
|
85 |
name: messageInfoSpec
|
|
86 |
window:
|
|
87 |
(WindowSpec
|
|
88 |
label: 'MessageInfo'
|
|
89 |
name: 'MessageInfo'
|
|
90 |
min: (Point 10 10)
|
|
91 |
bounds: (Rectangle 0 0 800 40)
|
|
92 |
backgroundColor: (Color 100.0 78.0392156862745 22.7450980392157)
|
|
93 |
forceRecursiveBackgroundOfDefaultBackground: true
|
|
94 |
)
|
|
95 |
component:
|
|
96 |
(SpecCollection
|
|
97 |
collection: (
|
|
98 |
(LabelSpec
|
|
99 |
label: 'Label'
|
|
100 |
name: 'Message'
|
|
101 |
layout: (LayoutFrame 10 0 -10 0.5 -90 1 10 0.5)
|
|
102 |
backgroundColor: (Color 100.0 78.0392156862745 22.7450980392157)
|
|
103 |
translateLabel: true
|
|
104 |
labelChannel: messageHolder
|
|
105 |
adjust: left
|
|
106 |
)
|
|
107 |
(ActionButtonSpec
|
|
108 |
label: 'OK'
|
|
109 |
name: 'OK'
|
|
110 |
layout: (LayoutFrame -80 1 -12 0.5 -12 1 12 0.5)
|
|
111 |
translateLabel: true
|
|
112 |
model: doOK
|
|
113 |
)
|
|
114 |
)
|
|
115 |
|
|
116 |
)
|
|
117 |
)
|
|
118 |
|
|
119 |
"Modified: / 28-10-2010 / 18:30:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
120 |
!
|
|
121 |
|
|
122 |
progressInfoSpec
|
|
123 |
"This resource specification was automatically generated
|
|
124 |
by the UIPainter of ST/X."
|
|
125 |
|
|
126 |
"Do not manually edit this!! If it is corrupted,
|
|
127 |
the UIPainter may not be able to read the specification."
|
|
128 |
|
|
129 |
"
|
|
130 |
UIPainter new openOnClass:Tools::InlineMessageDialog andSelector:#progressInfoSpec
|
|
131 |
Tools::InlineMessageDialog new openInterface:#progressInfoSpec
|
|
132 |
"
|
|
133 |
|
|
134 |
<resource: #canvas>
|
|
135 |
|
|
136 |
^
|
|
137 |
#(FullSpec
|
|
138 |
name: progressInfoSpec
|
|
139 |
window:
|
|
140 |
(WindowSpec
|
|
141 |
label: 'ProgressInfo'
|
|
142 |
name: 'ProgressInfo'
|
|
143 |
min: (Point 10 10)
|
|
144 |
bounds: (Rectangle 0 0 800 40)
|
|
145 |
backgroundColor: (Color 100.0 78.0392156862745 22.7450980392157)
|
|
146 |
forceRecursiveBackgroundOfDefaultBackground: true
|
|
147 |
)
|
|
148 |
component:
|
|
149 |
(SpecCollection
|
|
150 |
collection: (
|
|
151 |
(LabelSpec
|
|
152 |
label: 'Label'
|
|
153 |
name: 'Message'
|
|
154 |
layout: (LayoutFrame 10 0 0 0 -90 1 20 0)
|
|
155 |
backgroundColor: (Color 100.0 78.0392156862745 22.7450980392157)
|
|
156 |
translateLabel: true
|
|
157 |
labelChannel: messageHolder
|
|
158 |
adjust: left
|
|
159 |
)
|
|
160 |
(ProgressIndicatorSpec
|
|
161 |
name: 'ProgressIndicator'
|
|
162 |
layout: (LayoutFrame 10 0 -20 1 -90 1 -3 1)
|
|
163 |
model: progressHolder
|
|
164 |
foregroundColor: (Color 52.156862745098 37.2549019607843 0.0)
|
|
165 |
backgroundColor: (Color 100.0 91.3725490196078 70.1960784313726)
|
|
166 |
)
|
|
167 |
(ActionButtonSpec
|
|
168 |
label: 'Abort'
|
|
169 |
name: 'Abort'
|
|
170 |
layout: (LayoutFrame -80 1 -12 0.5 -12 1 12 0.5)
|
|
171 |
translateLabel: true
|
|
172 |
model: doAbort
|
|
173 |
)
|
|
174 |
)
|
|
175 |
|
|
176 |
)
|
|
177 |
)
|
|
178 |
!
|
|
179 |
|
|
180 |
windowSpec
|
|
181 |
"This resource specification was automatically generated
|
|
182 |
by the UIPainter of ST/X."
|
|
183 |
|
|
184 |
"Do not manually edit this!! If it is corrupted,
|
|
185 |
the UIPainter may not be able to read the specification."
|
|
186 |
|
|
187 |
"
|
|
188 |
UIPainter new openOnClass:Tools::InlineMessageDialog andSelector:#windowSpec
|
|
189 |
Tools::InlineMessageDialog new openInterface:#windowSpec
|
|
190 |
Tools::InlineMessageDialog open
|
|
191 |
"
|
|
192 |
|
|
193 |
<resource: #canvas>
|
|
194 |
|
|
195 |
^
|
|
196 |
#(FullSpec
|
|
197 |
name: windowSpec
|
|
198 |
window:
|
|
199 |
(WindowSpec
|
|
200 |
label: 'Tools::InlineMessageDialog'
|
|
201 |
name: 'Tools::InlineMessageDialog'
|
|
202 |
min: (Point 10 10)
|
|
203 |
bounds: (Rectangle 0 0 800 40)
|
|
204 |
backgroundColor: (Color 100.0 78.0392156862745 22.7450980392157)
|
|
205 |
forceRecursiveBackgroundOfDefaultBackground: true
|
|
206 |
)
|
|
207 |
component:
|
|
208 |
(SpecCollection
|
|
209 |
collection: (
|
|
210 |
(SubCanvasSpec
|
|
211 |
name: 'InfoSpec'
|
|
212 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1)
|
|
213 |
hasHorizontalScrollBar: false
|
|
214 |
hasVerticalScrollBar: false
|
|
215 |
miniScrollerHorizontal: false
|
|
216 |
specHolder: specHolder
|
|
217 |
createNewBuilder: false
|
|
218 |
)
|
|
219 |
)
|
|
220 |
|
|
221 |
)
|
|
222 |
)
|
|
223 |
! !
|
|
224 |
|
|
225 |
!InlineMessageDialog methodsFor:'accessing'!
|
|
226 |
|
|
227 |
message: aString
|
|
228 |
|
|
229 |
self messageHolder value: aString
|
|
230 |
|
|
231 |
"Created: / 28-10-2010 / 18:23:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
232 |
!
|
|
233 |
|
|
234 |
progress: aNumberOrNil
|
|
235 |
|
|
236 |
self progressHolder value: aNumberOrNil
|
|
237 |
|
|
238 |
"Created: / 28-10-2010 / 18:24:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
239 |
! !
|
|
240 |
|
|
241 |
!InlineMessageDialog methodsFor:'actions'!
|
|
242 |
|
|
243 |
doAbort
|
|
244 |
<resource: #uiCallback>
|
|
245 |
|
|
246 |
"automatically generated by UIPainter..."
|
|
247 |
|
|
248 |
"*** the code below performs no action"
|
|
249 |
"*** (except for some feedback on the Transcript)"
|
|
250 |
"*** Please change as required and accept in the browser."
|
|
251 |
"*** (and replace this comment by something more useful ;-)"
|
|
252 |
|
|
253 |
"action to be defined here..."
|
|
254 |
|
|
255 |
Transcript showCR:self class name, ': action for doAbort ...'.
|
|
256 |
!
|
|
257 |
|
|
258 |
doOK
|
|
259 |
<resource: #uiCallback>
|
|
260 |
|
|
261 |
self hide.
|
|
262 |
|
|
263 |
"Modified: / 28-10-2010 / 18:21:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
264 |
! !
|
|
265 |
|
|
266 |
!InlineMessageDialog methodsFor:'aspects'!
|
|
267 |
|
|
268 |
messageHolder
|
|
269 |
<resource: #uiAspect>
|
|
270 |
|
|
271 |
"automatically generated by UIPainter ..."
|
|
272 |
|
|
273 |
"*** the code below creates a default model when invoked."
|
|
274 |
"*** (which may not be the one you wanted)"
|
|
275 |
"*** Please change as required and accept it in the browser."
|
|
276 |
"*** (and replace this comment by something more useful ;-)"
|
|
277 |
|
|
278 |
messageHolder isNil ifTrue:[
|
|
279 |
messageHolder := ValueHolder new.
|
|
280 |
"/ if your app needs to be notified of changes, uncomment one of the lines below:
|
|
281 |
"/ messageHolder addDependent:self.
|
|
282 |
"/ messageHolder onChangeSend:#messageHolderChanged to:self.
|
|
283 |
].
|
|
284 |
^ messageHolder.
|
|
285 |
!
|
|
286 |
|
|
287 |
progressHolder
|
|
288 |
<resource: #uiAspect>
|
|
289 |
|
|
290 |
"automatically generated by UIPainter ..."
|
|
291 |
|
|
292 |
"*** the code below creates a default model when invoked."
|
|
293 |
"*** (which may not be the one you wanted)"
|
|
294 |
"*** Please change as required and accept it in the browser."
|
|
295 |
"*** (and replace this comment by something more useful ;-)"
|
|
296 |
|
|
297 |
progressHolder isNil ifTrue:[
|
|
298 |
progressHolder := ValueHolder new.
|
|
299 |
"/ if your app needs to be notified of changes, uncomment one of the lines below:
|
|
300 |
"/ progressHolder addDependent:self.
|
|
301 |
"/ progressHolder onChangeSend:#progressHolderChanged to:self.
|
|
302 |
].
|
|
303 |
^ progressHolder.
|
|
304 |
!
|
|
305 |
|
|
306 |
specHolder
|
|
307 |
"return/create the 'specHolder' value holder (automatically generated)"
|
|
308 |
|
|
309 |
specHolder isNil ifTrue:[
|
|
310 |
specHolder := ValueHolder with: #messageInfoSpec.
|
|
311 |
].
|
|
312 |
^ specHolder
|
|
313 |
|
|
314 |
"Modified: / 28-10-2010 / 18:29:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
315 |
! !
|
|
316 |
|
|
317 |
!InlineMessageDialog methodsFor:'private'!
|
|
318 |
|
|
319 |
getMyView
|
|
320 |
|
|
321 |
| v |
|
|
322 |
|
|
323 |
v := builder window.
|
|
324 |
^(v superView isKindOf: SubCanvas)
|
|
325 |
ifTrue:[v superView]
|
|
326 |
ifFalse:[v]
|
|
327 |
|
|
328 |
"Created: / 29-10-2010 / 11:49:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
329 |
!
|
|
330 |
|
|
331 |
getOtherView
|
|
332 |
|
|
333 |
| myView |
|
|
334 |
|
|
335 |
myView := self getMyView.
|
|
336 |
^myView superView subViews after: myView
|
|
337 |
|
|
338 |
"Created: / 29-10-2010 / 11:49:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
339 |
!
|
|
340 |
|
|
341 |
hide
|
|
342 |
|
|
343 |
| myView otherView |
|
|
344 |
myView := self getMyView.
|
|
345 |
otherView := self getOtherView.
|
|
346 |
|
|
347 |
myView isVisible ifFalse:[^self]."/already hidden"
|
|
348 |
myView isVisible: false.
|
|
349 |
otherView layout:
|
|
350 |
(otherView layout topOffset: 0; yourself)
|
|
351 |
|
|
352 |
"Created: / 29-10-2010 / 11:55:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
353 |
!
|
|
354 |
|
|
355 |
show: spec
|
|
356 |
|
|
357 |
| myView otherView |
|
|
358 |
myView := self getMyView.
|
|
359 |
otherView := self getOtherView.
|
|
360 |
myView isVisible ifTrue:[^self]."/already shown"
|
|
361 |
myView isVisible: true.
|
|
362 |
otherView layout:
|
|
363 |
(otherView layout topOffset: 40; yourself).
|
|
364 |
self specHolder value: spec.
|
|
365 |
|
|
366 |
"Created: / 29-10-2010 / 11:48:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
367 |
! !
|
|
368 |
|
|
369 |
!InlineMessageDialog class methodsFor:'documentation'!
|
|
370 |
|
|
371 |
version_CVS
|
10099
|
372 |
^ '$Header: /cvs/stx/stx/libtool/Tools__InlineMessageDialog.st,v 1.2 2011-07-03 19:42:45 cg Exp $'
|
9987
|
373 |
!
|
|
374 |
|
|
375 |
version_SVN
|
|
376 |
^ '§Id: Tools__InlineMessageDialog.st 7646 2010-10-29 14:44:02Z vranyj1 §'
|
|
377 |
! !
|