diff -r acfbc051149f -r b7d62f6f5485 Tools__ToDoListBrowser.st --- a/Tools__ToDoListBrowser.st Fri Feb 16 14:37:24 2007 +0100 +++ b/Tools__ToDoListBrowser.st Mon Feb 19 16:05:35 2007 +0100 @@ -3,7 +3,8 @@ "{ NameSpace: Tools }" ApplicationModel subclass:#ToDoListBrowser - instanceVariableNames:'toDoList selectionIndexHolder currentSortOrder' + instanceVariableNames:'toDoList shownCopyOfToDoList selectionIndexHolder + currentSortOrder' classVariableNames:'TheOneAndOnlyToDoListBrowser' poolDictionaries:'' category:'Interface-Smalltalk-ToDo' @@ -112,7 +113,7 @@ menu: itemMenu hasHorizontalScrollBar: true hasVerticalScrollBar: true - dataList: toDoList + dataList: shownCopyOfToDoList doubleClickSelector: itemDoubleClicked: columnHolder: tableColumns ) @@ -120,6 +121,8 @@ ) ) + + "Modified: / 18-02-2007 / 12:55:32 / cg" ! ! !ToDoListBrowser class methodsFor:'menu specs'! @@ -323,6 +326,15 @@ "Created: / 22-10-2006 / 02:00:41 / cg" ! +shownCopyOfToDoList + shownCopyOfToDoList isNil ifTrue:[ + shownCopyOfToDoList := List new + ]. + ^ shownCopyOfToDoList + + "Created: / 18-02-2007 / 12:53:01 / cg" +! + toDoList toDoList isNil ifTrue:[ toDoList := ToDoList theOneAndOnlyToDoList. @@ -332,6 +344,25 @@ "Created: / 21-10-2006 / 20:57:18 / cg" ! ! +!ToDoListBrowser methodsFor:'change & update'! + +update:something with:aParameter from:changedObject + changedObject == toDoList ifTrue:[ + self updateShownToDoList. + ^ self + ]. + ^ super update:something with:aParameter from:changedObject + + "Created: / 18-02-2007 / 12:54:32 / cg" +! + +updateShownToDoList + self shownCopyOfToDoList contents:(self toDoList). + self resort. + + "Created: / 18-02-2007 / 12:54:58 / cg" +! ! + !ToDoListBrowser methodsFor:'initialization & release'! closeDownViews @@ -373,16 +404,16 @@ ! postBuildWith:aBuilder - "This is a hook method generated by the Browser. - It will be invoked during the initialization of your app/dialog, - after all of the visual components have been built, - but BEFORE the top window is made visible. - Add any app-specific actions here (reading files, setting up values etc.) - See also #postOpenWith:, which is invoked after opening." + self toDoList addDependent:self. + self updateShownToDoList. - "/ add any code here ... + ToDoList autoload. + ToDoListEntry autoload. + CompilerWarningToDoListEntry autoload. ^ super postBuildWith:aBuilder + + "Modified: / 18-02-2007 / 12:55:57 / cg" ! postOpenWith:aBuilder @@ -397,12 +428,14 @@ ! release + self toDoList removeDependent:self. self == TheOneAndOnlyToDoListBrowser ifTrue:[ TheOneAndOnlyToDoListBrowser := nil ]. super release. "Created: / 21-10-2006 / 20:40:31 / cg" + "Modified: / 18-02-2007 / 12:57:07 / cg" ! ! !ToDoListBrowser methodsFor:'menu actions'! @@ -454,28 +487,33 @@ !ToDoListBrowser methodsFor:'menu actions-item'! browseItem - (toDoList at:self selectionIndexHolder value) browse + (shownCopyOfToDoList at:self selectionIndexHolder value) browse "Created: / 22-10-2006 / 02:00:20 / cg" + "Modified: / 18-02-2007 / 12:56:49 / cg" ! removeItem - (toDoList removeIndex:self selectionIndexHolder value) + toDoList remove:(shownCopyOfToDoList at:self selectionIndexHolder value) "Created: / 22-10-2006 / 10:45:52 / cg" + "Modified: / 18-02-2007 / 12:57:58 / cg" ! ! !ToDoListBrowser methodsFor:'user actions'! itemDoubleClicked:itemIndex - (toDoList at:itemIndex) browse + (shownCopyOfToDoList at:itemIndex) browse "Created: / 22-10-2006 / 01:49:13 / cg" + "Modified: / 18-02-2007 / 12:56:30 / cg" ! resort |sortBlock sortBlock1 col| + currentSortOrder isNil ifTrue:[^ self ]. + col := currentSortOrder at:#column. sortBlock := sortBlock1 := [:a :b | (a perform:col) < (b perform:col)]. @@ -485,9 +523,10 @@ ]. "/ temporary hack - should make a copy of the real list - self toDoList sort:sortBlock + self shownCopyOfToDoList sort:sortBlock "Created: / 25-10-2006 / 01:01:26 / cg" + "Modified: / 18-02-2007 / 13:02:19 / cg" ! sortBy:instanceName @@ -526,5 +565,5 @@ !ToDoListBrowser class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libtool/Tools__ToDoListBrowser.st,v 1.5 2006-10-24 23:06:33 cg Exp $' + ^ '$Header: /cvs/stx/stx/libtool/Tools__ToDoListBrowser.st,v 1.6 2007-02-19 15:05:35 cg Exp $' ! !