1 "{ Package: 'stx:libtool' }" |
1 "{ Package: 'stx:libtool' }" |
2 |
2 |
3 "{ NameSpace: Tools }" |
3 "{ NameSpace: Tools }" |
4 |
4 |
5 ApplicationModel subclass:#ToDoListBrowser |
5 ApplicationModel subclass:#ToDoListBrowser |
6 instanceVariableNames:'toDoList selectionIndexHolder currentSortOrder' |
6 instanceVariableNames:'toDoList shownCopyOfToDoList selectionIndexHolder |
|
7 currentSortOrder' |
7 classVariableNames:'TheOneAndOnlyToDoListBrowser' |
8 classVariableNames:'TheOneAndOnlyToDoListBrowser' |
8 poolDictionaries:'' |
9 poolDictionaries:'' |
9 category:'Interface-Smalltalk-ToDo' |
10 category:'Interface-Smalltalk-ToDo' |
10 ! |
11 ! |
11 |
12 |
110 layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
111 layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
111 model: selectionIndexHolder |
112 model: selectionIndexHolder |
112 menu: itemMenu |
113 menu: itemMenu |
113 hasHorizontalScrollBar: true |
114 hasHorizontalScrollBar: true |
114 hasVerticalScrollBar: true |
115 hasVerticalScrollBar: true |
115 dataList: toDoList |
116 dataList: shownCopyOfToDoList |
116 doubleClickSelector: itemDoubleClicked: |
117 doubleClickSelector: itemDoubleClicked: |
117 columnHolder: tableColumns |
118 columnHolder: tableColumns |
118 ) |
119 ) |
119 ) |
120 ) |
120 |
121 |
121 ) |
122 ) |
122 ) |
123 ) |
|
124 |
|
125 "Modified: / 18-02-2007 / 12:55:32 / cg" |
123 ! ! |
126 ! ! |
124 |
127 |
125 !ToDoListBrowser class methodsFor:'menu specs'! |
128 !ToDoListBrowser class methodsFor:'menu specs'! |
126 |
129 |
127 itemMenu |
130 itemMenu |
321 ^ selectionIndexHolder |
324 ^ selectionIndexHolder |
322 |
325 |
323 "Created: / 22-10-2006 / 02:00:41 / cg" |
326 "Created: / 22-10-2006 / 02:00:41 / cg" |
324 ! |
327 ! |
325 |
328 |
|
329 shownCopyOfToDoList |
|
330 shownCopyOfToDoList isNil ifTrue:[ |
|
331 shownCopyOfToDoList := List new |
|
332 ]. |
|
333 ^ shownCopyOfToDoList |
|
334 |
|
335 "Created: / 18-02-2007 / 12:53:01 / cg" |
|
336 ! |
|
337 |
326 toDoList |
338 toDoList |
327 toDoList isNil ifTrue:[ |
339 toDoList isNil ifTrue:[ |
328 toDoList := ToDoList theOneAndOnlyToDoList. |
340 toDoList := ToDoList theOneAndOnlyToDoList. |
329 ]. |
341 ]. |
330 ^ toDoList |
342 ^ toDoList |
331 |
343 |
332 "Created: / 21-10-2006 / 20:57:18 / cg" |
344 "Created: / 21-10-2006 / 20:57:18 / cg" |
|
345 ! ! |
|
346 |
|
347 !ToDoListBrowser methodsFor:'change & update'! |
|
348 |
|
349 update:something with:aParameter from:changedObject |
|
350 changedObject == toDoList ifTrue:[ |
|
351 self updateShownToDoList. |
|
352 ^ self |
|
353 ]. |
|
354 ^ super update:something with:aParameter from:changedObject |
|
355 |
|
356 "Created: / 18-02-2007 / 12:54:32 / cg" |
|
357 ! |
|
358 |
|
359 updateShownToDoList |
|
360 self shownCopyOfToDoList contents:(self toDoList). |
|
361 self resort. |
|
362 |
|
363 "Created: / 18-02-2007 / 12:54:58 / cg" |
333 ! ! |
364 ! ! |
334 |
365 |
335 !ToDoListBrowser methodsFor:'initialization & release'! |
366 !ToDoListBrowser methodsFor:'initialization & release'! |
336 |
367 |
337 closeDownViews |
368 closeDownViews |
371 |
402 |
372 "Modified: / 21-10-2006 / 19:21:02 / cg" |
403 "Modified: / 21-10-2006 / 19:21:02 / cg" |
373 ! |
404 ! |
374 |
405 |
375 postBuildWith:aBuilder |
406 postBuildWith:aBuilder |
376 "This is a hook method generated by the Browser. |
407 self toDoList addDependent:self. |
377 It will be invoked during the initialization of your app/dialog, |
408 self updateShownToDoList. |
378 after all of the visual components have been built, |
409 |
379 but BEFORE the top window is made visible. |
410 ToDoList autoload. |
380 Add any app-specific actions here (reading files, setting up values etc.) |
411 ToDoListEntry autoload. |
381 See also #postOpenWith:, which is invoked after opening." |
412 CompilerWarningToDoListEntry autoload. |
382 |
|
383 "/ add any code here ... |
|
384 |
413 |
385 ^ super postBuildWith:aBuilder |
414 ^ super postBuildWith:aBuilder |
|
415 |
|
416 "Modified: / 18-02-2007 / 12:55:57 / cg" |
386 ! |
417 ! |
387 |
418 |
388 postOpenWith:aBuilder |
419 postOpenWith:aBuilder |
389 "This is a hook method generated by the Browser. |
420 "This is a hook method generated by the Browser. |
390 It will be invoked right after the applications window has been opened. |
421 It will be invoked right after the applications window has been opened. |
395 |
426 |
396 ^ super postOpenWith:aBuilder |
427 ^ super postOpenWith:aBuilder |
397 ! |
428 ! |
398 |
429 |
399 release |
430 release |
|
431 self toDoList removeDependent:self. |
400 self == TheOneAndOnlyToDoListBrowser ifTrue:[ |
432 self == TheOneAndOnlyToDoListBrowser ifTrue:[ |
401 TheOneAndOnlyToDoListBrowser := nil |
433 TheOneAndOnlyToDoListBrowser := nil |
402 ]. |
434 ]. |
403 super release. |
435 super release. |
404 |
436 |
405 "Created: / 21-10-2006 / 20:40:31 / cg" |
437 "Created: / 21-10-2006 / 20:40:31 / cg" |
|
438 "Modified: / 18-02-2007 / 12:57:07 / cg" |
406 ! ! |
439 ! ! |
407 |
440 |
408 !ToDoListBrowser methodsFor:'menu actions'! |
441 !ToDoListBrowser methodsFor:'menu actions'! |
409 |
442 |
410 clearList |
443 clearList |
452 ! ! |
485 ! ! |
453 |
486 |
454 !ToDoListBrowser methodsFor:'menu actions-item'! |
487 !ToDoListBrowser methodsFor:'menu actions-item'! |
455 |
488 |
456 browseItem |
489 browseItem |
457 (toDoList at:self selectionIndexHolder value) browse |
490 (shownCopyOfToDoList at:self selectionIndexHolder value) browse |
458 |
491 |
459 "Created: / 22-10-2006 / 02:00:20 / cg" |
492 "Created: / 22-10-2006 / 02:00:20 / cg" |
|
493 "Modified: / 18-02-2007 / 12:56:49 / cg" |
460 ! |
494 ! |
461 |
495 |
462 removeItem |
496 removeItem |
463 (toDoList removeIndex:self selectionIndexHolder value) |
497 toDoList remove:(shownCopyOfToDoList at:self selectionIndexHolder value) |
464 |
498 |
465 "Created: / 22-10-2006 / 10:45:52 / cg" |
499 "Created: / 22-10-2006 / 10:45:52 / cg" |
|
500 "Modified: / 18-02-2007 / 12:57:58 / cg" |
466 ! ! |
501 ! ! |
467 |
502 |
468 !ToDoListBrowser methodsFor:'user actions'! |
503 !ToDoListBrowser methodsFor:'user actions'! |
469 |
504 |
470 itemDoubleClicked:itemIndex |
505 itemDoubleClicked:itemIndex |
471 (toDoList at:itemIndex) browse |
506 (shownCopyOfToDoList at:itemIndex) browse |
472 |
507 |
473 "Created: / 22-10-2006 / 01:49:13 / cg" |
508 "Created: / 22-10-2006 / 01:49:13 / cg" |
|
509 "Modified: / 18-02-2007 / 12:56:30 / cg" |
474 ! |
510 ! |
475 |
511 |
476 resort |
512 resort |
477 |sortBlock sortBlock1 col| |
513 |sortBlock sortBlock1 col| |
478 |
514 |
|
515 currentSortOrder isNil ifTrue:[^ self ]. |
|
516 |
479 col := currentSortOrder at:#column. |
517 col := currentSortOrder at:#column. |
480 |
518 |
481 sortBlock := sortBlock1 := [:a :b | (a perform:col) < (b perform:col)]. |
519 sortBlock := sortBlock1 := [:a :b | (a perform:col) < (b perform:col)]. |
482 |
520 |
483 (currentSortOrder at:#reverse) ifTrue:[ |
521 (currentSortOrder at:#reverse) ifTrue:[ |
484 sortBlock := [:a :b | (sortBlock1 value:a value:b) not ]. |
522 sortBlock := [:a :b | (sortBlock1 value:a value:b) not ]. |
485 ]. |
523 ]. |
486 |
524 |
487 "/ temporary hack - should make a copy of the real list |
525 "/ temporary hack - should make a copy of the real list |
488 self toDoList sort:sortBlock |
526 self shownCopyOfToDoList sort:sortBlock |
489 |
527 |
490 "Created: / 25-10-2006 / 01:01:26 / cg" |
528 "Created: / 25-10-2006 / 01:01:26 / cg" |
|
529 "Modified: / 18-02-2007 / 13:02:19 / cg" |
491 ! |
530 ! |
492 |
531 |
493 sortBy:instanceName |
532 sortBy:instanceName |
494 self sortBy:instanceName withReverse:true |
533 self sortBy:instanceName withReverse:true |
495 |
534 |