7443
|
1 |
"{ Package: 'stx:libtool' }"
|
|
2 |
|
|
3 |
"{ NameSpace: Tools }"
|
|
4 |
|
|
5 |
ApplicationModel subclass:#ToDoListBrowser
|
|
6 |
instanceVariableNames:'toDoList selectionIndexHolder'
|
|
7 |
classVariableNames:'TheOneAndOnlyToDoListBrowser'
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'Interface-Smalltalk-ToDo'
|
|
10 |
!
|
|
11 |
|
|
12 |
!ToDoListBrowser class methodsFor:'documentation'!
|
|
13 |
|
|
14 |
documentation
|
|
15 |
"
|
|
16 |
documentation to be added.
|
|
17 |
|
|
18 |
[author:]
|
|
19 |
cg (cg@FUSI)
|
|
20 |
|
|
21 |
[instance variables:]
|
|
22 |
|
|
23 |
[class variables:]
|
|
24 |
|
|
25 |
[see also:]
|
|
26 |
|
|
27 |
"
|
|
28 |
!
|
|
29 |
|
|
30 |
examples
|
|
31 |
"
|
|
32 |
Starting the application:
|
|
33 |
[exBegin]
|
|
34 |
ToDoListBrowser open
|
|
35 |
|
|
36 |
[exEnd]
|
|
37 |
|
|
38 |
more examples to be added:
|
|
39 |
[exBegin]
|
|
40 |
... add code fragment for
|
|
41 |
... executable example here ...
|
|
42 |
[exEnd]
|
|
43 |
"
|
|
44 |
!
|
|
45 |
|
|
46 |
history
|
|
47 |
"Created: / 21-10-2006 / 15:05:53 / cg"
|
|
48 |
! !
|
|
49 |
|
|
50 |
!ToDoListBrowser class methodsFor:'class initialization'!
|
|
51 |
|
|
52 |
current
|
|
53 |
^ TheOneAndOnlyToDoListBrowser
|
|
54 |
|
|
55 |
"Created: / 21-10-2006 / 20:37:48 / cg"
|
|
56 |
!
|
|
57 |
|
|
58 |
current:aBrowser
|
|
59 |
TheOneAndOnlyToDoListBrowser := aBrowser.
|
|
60 |
|
|
61 |
"Created: / 21-10-2006 / 20:38:08 / cg"
|
|
62 |
!
|
|
63 |
|
|
64 |
new
|
|
65 |
|b|
|
|
66 |
|
|
67 |
b := super new.
|
|
68 |
TheOneAndOnlyToDoListBrowser isNil ifTrue:[
|
|
69 |
TheOneAndOnlyToDoListBrowser := b.
|
|
70 |
].
|
|
71 |
^ b
|
|
72 |
|
|
73 |
"Created: / 21-10-2006 / 20:39:03 / cg"
|
|
74 |
! !
|
|
75 |
|
|
76 |
!ToDoListBrowser class methodsFor:'interface specs'!
|
|
77 |
|
|
78 |
windowSpec
|
|
79 |
"This resource specification was automatically generated
|
|
80 |
by the UIPainter of ST/X."
|
|
81 |
|
|
82 |
"Do not manually edit this!! If it is corrupted,
|
|
83 |
the UIPainter may not be able to read the specification."
|
|
84 |
|
|
85 |
"
|
|
86 |
UIPainter new openOnClass:ToDoListBrowser andSelector:#windowSpec
|
|
87 |
ToDoListBrowser new openInterface:#windowSpec
|
|
88 |
ToDoListBrowser open
|
|
89 |
"
|
|
90 |
|
|
91 |
<resource: #canvas>
|
|
92 |
|
|
93 |
^
|
|
94 |
#(FullSpec
|
|
95 |
name: windowSpec
|
|
96 |
window:
|
|
97 |
(WindowSpec
|
|
98 |
label: 'ToDoListBrowser'
|
|
99 |
name: 'ToDoListBrowser'
|
|
100 |
min: (Point 10 10)
|
|
101 |
max: (Point 1024 768)
|
|
102 |
bounds: (Rectangle 0 0 577 395)
|
|
103 |
menu: mainMenu
|
|
104 |
)
|
|
105 |
component:
|
|
106 |
(SpecCollection
|
|
107 |
collection: (
|
|
108 |
(DataSetSpec
|
|
109 |
name: 'Table1'
|
|
110 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1)
|
|
111 |
model: selectionIndexHolder
|
|
112 |
menu: itemMenu
|
|
113 |
hasHorizontalScrollBar: true
|
|
114 |
hasVerticalScrollBar: true
|
|
115 |
dataList: toDoList
|
|
116 |
doubleClickSelector: itemDoubleClicked:
|
|
117 |
columnHolder: tableColumns
|
|
118 |
)
|
|
119 |
)
|
|
120 |
|
|
121 |
)
|
|
122 |
)
|
|
123 |
! !
|
|
124 |
|
|
125 |
!ToDoListBrowser class methodsFor:'menu specs'!
|
|
126 |
|
|
127 |
itemMenu
|
|
128 |
"This resource specification was automatically generated
|
|
129 |
by the MenuEditor of ST/X."
|
|
130 |
|
|
131 |
"Do not manually edit this!! If it is corrupted,
|
|
132 |
the MenuEditor may not be able to read the specification."
|
|
133 |
|
|
134 |
"
|
|
135 |
MenuEditor new openOnClass:ToDoListBrowser andSelector:#itemMenu
|
|
136 |
(Menu new fromLiteralArrayEncoding:(ToDoListBrowser itemMenu)) startUp
|
|
137 |
"
|
|
138 |
|
|
139 |
<resource: #menu>
|
|
140 |
|
|
141 |
^
|
|
142 |
#(Menu
|
|
143 |
(
|
|
144 |
(MenuItem
|
|
145 |
label: 'Browse'
|
|
146 |
itemValue: browseItem
|
|
147 |
translateLabel: true
|
|
148 |
)
|
|
149 |
(MenuItem
|
|
150 |
label: '-'
|
|
151 |
)
|
|
152 |
(MenuItem
|
|
153 |
label: 'Remove'
|
|
154 |
itemValue: removeItem
|
|
155 |
translateLabel: true
|
|
156 |
)
|
|
157 |
)
|
|
158 |
nil
|
|
159 |
nil
|
|
160 |
)
|
|
161 |
!
|
|
162 |
|
|
163 |
mainMenu
|
|
164 |
"This resource specification was automatically generated
|
|
165 |
by the MenuEditor of ST/X."
|
|
166 |
|
|
167 |
"Do not manually edit this!! If it is corrupted,
|
|
168 |
the MenuEditor may not be able to read the specification."
|
|
169 |
|
|
170 |
"
|
|
171 |
MenuEditor new openOnClass:ToDoListBrowser andSelector:#mainMenu
|
|
172 |
(Menu new fromLiteralArrayEncoding:(ToDoListBrowser mainMenu)) startUp
|
|
173 |
"
|
|
174 |
|
|
175 |
<resource: #menu>
|
|
176 |
|
|
177 |
^
|
|
178 |
#(Menu
|
|
179 |
(
|
|
180 |
(MenuItem
|
|
181 |
label: 'File'
|
|
182 |
translateLabel: true
|
|
183 |
submenu:
|
|
184 |
(Menu
|
|
185 |
(
|
|
186 |
(MenuItem
|
|
187 |
label: 'Exit'
|
|
188 |
itemValue: closeRequest
|
|
189 |
translateLabel: true
|
|
190 |
)
|
|
191 |
)
|
|
192 |
nil
|
|
193 |
nil
|
|
194 |
)
|
|
195 |
)
|
|
196 |
(MenuItem
|
|
197 |
label: 'List'
|
|
198 |
translateLabel: true
|
|
199 |
submenu:
|
|
200 |
(Menu
|
|
201 |
(
|
|
202 |
(MenuItem
|
|
203 |
label: 'Clear'
|
|
204 |
itemValue: clearList
|
|
205 |
translateLabel: true
|
|
206 |
)
|
|
207 |
)
|
|
208 |
nil
|
|
209 |
nil
|
|
210 |
)
|
|
211 |
)
|
|
212 |
(MenuItem
|
|
213 |
label: 'Help'
|
|
214 |
translateLabel: true
|
|
215 |
startGroup: right
|
|
216 |
submenu:
|
|
217 |
(Menu
|
|
218 |
(
|
|
219 |
(MenuItem
|
|
220 |
label: 'Documentation'
|
|
221 |
itemValue: openDocumentation
|
|
222 |
translateLabel: true
|
|
223 |
)
|
|
224 |
(MenuItem
|
|
225 |
label: '-'
|
|
226 |
)
|
|
227 |
(MenuItem
|
|
228 |
label: 'About this Application...'
|
|
229 |
itemValue: openAboutThisApplication
|
|
230 |
translateLabel: true
|
|
231 |
)
|
|
232 |
)
|
|
233 |
nil
|
|
234 |
nil
|
|
235 |
)
|
|
236 |
)
|
|
237 |
)
|
|
238 |
nil
|
|
239 |
nil
|
|
240 |
)
|
|
241 |
! !
|
|
242 |
|
|
243 |
!ToDoListBrowser class methodsFor:'tableColumns specs'!
|
|
244 |
|
|
245 |
tableColumns
|
|
246 |
"This resource specification was automatically generated
|
|
247 |
by the DataSetBuilder of ST/X."
|
|
248 |
|
|
249 |
"Do not manually edit this!! If it is corrupted,
|
|
250 |
the DataSetBuilder may not be able to read the specification."
|
|
251 |
|
|
252 |
"
|
|
253 |
DataSetBuilder new openOnClass:ToDoListBrowser andSelector:#tableColumns
|
|
254 |
"
|
|
255 |
|
|
256 |
<resource: #tableColumns>
|
|
257 |
|
|
258 |
^#(
|
|
259 |
(DataSetColumnSpec
|
|
260 |
label: 'Type'
|
|
261 |
labelButtonType: Button
|
|
262 |
width: 32
|
|
263 |
model: severity
|
|
264 |
canSelect: false
|
|
265 |
)
|
|
266 |
(DataSetColumnSpec
|
|
267 |
label: 'Prio'
|
|
268 |
labelButtonType: Button
|
|
269 |
width: 30
|
|
270 |
model: priority
|
|
271 |
canSelect: false
|
|
272 |
)
|
|
273 |
(DataSetColumnSpec
|
|
274 |
label: 'Time'
|
|
275 |
labelButtonType: Button
|
|
276 |
width: 50
|
|
277 |
model: time
|
|
278 |
canSelect: false
|
|
279 |
)
|
|
280 |
(DataSetColumnSpec
|
|
281 |
label: 'Where'
|
|
282 |
labelButtonType: Button
|
|
283 |
model: methodOrClassName
|
|
284 |
canSelect: false
|
|
285 |
)
|
|
286 |
(DataSetColumnSpec
|
|
287 |
label: 'Message'
|
|
288 |
labelButtonType: Button
|
|
289 |
model: message
|
|
290 |
canSelect: false
|
|
291 |
)
|
|
292 |
)
|
|
293 |
|
|
294 |
! !
|
|
295 |
|
|
296 |
!ToDoListBrowser methodsFor:'accessing'!
|
|
297 |
|
|
298 |
addEntry:anEntry
|
|
299 |
self toDoList add:anEntry
|
|
300 |
|
|
301 |
"Created: / 21-10-2006 / 15:38:08 / cg"
|
|
302 |
"Modified: / 21-10-2006 / 21:14:31 / cg"
|
|
303 |
!
|
|
304 |
|
|
305 |
selectionIndexHolder
|
|
306 |
selectionIndexHolder isNil ifTrue:[
|
|
307 |
selectionIndexHolder := nil asValue.
|
|
308 |
].
|
|
309 |
^ selectionIndexHolder
|
|
310 |
|
|
311 |
"Created: / 22-10-2006 / 02:00:41 / cg"
|
|
312 |
!
|
|
313 |
|
|
314 |
toDoList
|
|
315 |
toDoList isNil ifTrue:[
|
|
316 |
toDoList := ToDoList theOneAndOnlyToDoList.
|
|
317 |
].
|
|
318 |
^ toDoList
|
|
319 |
|
|
320 |
"Created: / 21-10-2006 / 20:57:18 / cg"
|
|
321 |
! !
|
|
322 |
|
|
323 |
!ToDoListBrowser methodsFor:'initialization & release'!
|
|
324 |
|
|
325 |
closeDownViews
|
|
326 |
"This is a hook method generated by the Browser.
|
|
327 |
It will be invoked when your app/dialog-window is really closed.
|
|
328 |
See also #closeDownViews, which is invoked before and may suppress the close
|
|
329 |
or ask the user for confirmation."
|
|
330 |
|
|
331 |
"/ change the code below as required ...
|
|
332 |
"/ This should cleanup any leftover resources
|
|
333 |
"/ (for example, temporary files)
|
|
334 |
"/ super closeRequest will initiate the closeDown
|
|
335 |
|
|
336 |
"/ add your code here
|
|
337 |
|
|
338 |
"/ do not remove the one below ...
|
|
339 |
^ super closeDownViews
|
|
340 |
!
|
|
341 |
|
|
342 |
closeRequest
|
|
343 |
"This is a hook method generated by the Browser.
|
|
344 |
It will be invoked when your app/dialog-window is about to be
|
|
345 |
closed (this method has a chance to suppress the close).
|
|
346 |
See also #closeDownViews, which is invoked when the close is really done."
|
|
347 |
|
|
348 |
"/ change the code below as required ...
|
|
349 |
"/ Closing can be suppressed, by simply returning.
|
|
350 |
"/ The 'super closeRequest' at the end will initiate the real closeDown
|
|
351 |
|
|
352 |
("self hasUnsavedChanges" false) ifTrue:[
|
|
353 |
(self confirm:(resources string:'Close without saving ?')) ifFalse:[
|
|
354 |
^ self
|
|
355 |
]
|
|
356 |
].
|
|
357 |
|
|
358 |
^ super closeRequest
|
|
359 |
|
|
360 |
"Modified: / 21-10-2006 / 19:21:02 / cg"
|
|
361 |
!
|
|
362 |
|
|
363 |
postBuildWith:aBuilder
|
|
364 |
"This is a hook method generated by the Browser.
|
|
365 |
It will be invoked during the initialization of your app/dialog,
|
|
366 |
after all of the visual components have been built,
|
|
367 |
but BEFORE the top window is made visible.
|
|
368 |
Add any app-specific actions here (reading files, setting up values etc.)
|
|
369 |
See also #postOpenWith:, which is invoked after opening."
|
|
370 |
|
|
371 |
"/ add any code here ...
|
|
372 |
|
|
373 |
^ super postBuildWith:aBuilder
|
|
374 |
!
|
|
375 |
|
|
376 |
postOpenWith:aBuilder
|
|
377 |
"This is a hook method generated by the Browser.
|
|
378 |
It will be invoked right after the applications window has been opened.
|
|
379 |
Add any app-specific actions here (starting background processes etc.).
|
|
380 |
See also #postBuildWith:, which is invoked before opening."
|
|
381 |
|
|
382 |
"/ add any code here ...
|
|
383 |
|
|
384 |
^ super postOpenWith:aBuilder
|
|
385 |
!
|
|
386 |
|
|
387 |
release
|
|
388 |
self == TheOneAndOnlyToDoListBrowser ifTrue:[
|
|
389 |
TheOneAndOnlyToDoListBrowser := nil
|
|
390 |
].
|
|
391 |
super release.
|
|
392 |
|
|
393 |
"Created: / 21-10-2006 / 20:40:31 / cg"
|
|
394 |
! !
|
|
395 |
|
|
396 |
!ToDoListBrowser methodsFor:'menu actions'!
|
|
397 |
|
|
398 |
clearList
|
|
399 |
toDoList removeAll
|
|
400 |
|
|
401 |
"Created: / 22-10-2006 / 00:02:15 / cg"
|
|
402 |
!
|
|
403 |
|
|
404 |
menuSave
|
|
405 |
"This method was generated by the Browser.
|
|
406 |
It will be invoked when the menu-item 'save' is selected."
|
|
407 |
|
|
408 |
"/ change below and add any actions as required here ...
|
|
409 |
self warn:'no action for ''save'' defined.'.
|
|
410 |
!
|
|
411 |
|
|
412 |
menuSaveAs
|
|
413 |
"This method was generated by the Browser.
|
|
414 |
It will be invoked when the menu-item 'saveAs' is selected."
|
|
415 |
|
|
416 |
"/ change below and add any actions as required here ...
|
|
417 |
self warn:'no action for ''saveAs'' defined.'.
|
|
418 |
!
|
|
419 |
|
|
420 |
openAboutThisApplication
|
|
421 |
"This method was generated by the Browser.
|
|
422 |
It will be invoked when the menu-item 'help-about' is selected."
|
|
423 |
|
|
424 |
"/ could open a customized aboutBox here ...
|
|
425 |
super openAboutThisApplication
|
|
426 |
!
|
|
427 |
|
|
428 |
openDocumentation
|
|
429 |
"This method was generated by the Browser.
|
|
430 |
It will be invoked when the menu-item 'help-documentation' is selected."
|
|
431 |
|
|
432 |
"/ change below as required ...
|
|
433 |
|
|
434 |
"/ to open an HTML viewer on some document (under 'doc/online/<language>/' ):
|
|
435 |
HTMLDocumentView openFullOnDocumentationFile:'TOP.html'.
|
|
436 |
|
|
437 |
"/ add application-specific help files under the 'doc/online/<language>/help/appName'
|
|
438 |
"/ directory, and open a viewer with:
|
|
439 |
"/ HTMLDocumentView openFullOnDocumentationFile:'help/<MyApplication>/TOP.html'.
|
|
440 |
! !
|
|
441 |
|
|
442 |
!ToDoListBrowser methodsFor:'menu actions-item'!
|
|
443 |
|
|
444 |
browseItem
|
|
445 |
(toDoList at:self selectionIndexHolder value) browse
|
|
446 |
|
|
447 |
"Created: / 22-10-2006 / 02:00:20 / cg"
|
|
448 |
!
|
|
449 |
|
|
450 |
removeItem
|
|
451 |
(toDoList removeIndex:self selectionIndexHolder value)
|
|
452 |
|
|
453 |
"Created: / 22-10-2006 / 10:45:52 / cg"
|
|
454 |
! !
|
|
455 |
|
|
456 |
!ToDoListBrowser methodsFor:'user actions'!
|
|
457 |
|
|
458 |
itemDoubleClicked:itemIndex
|
|
459 |
(toDoList at:itemIndex) browse
|
|
460 |
|
|
461 |
"Created: / 22-10-2006 / 01:49:13 / cg"
|
|
462 |
! !
|
|
463 |
|
|
464 |
!ToDoListBrowser class methodsFor:'documentation'!
|
|
465 |
|
|
466 |
version
|
|
467 |
^ '$Header: /cvs/stx/stx/libtool/Tools__ToDoListBrowser.st,v 1.1 2006-10-23 08:57:41 cg Exp $'
|
|
468 |
! !
|