"{ Package: 'stx:libtool' }"
"{ NameSpace: Tools }"
ApplicationModel subclass:#ToDoListBrowser
instanceVariableNames:'toDoList selectionIndexHolder currentSortOrder'
classVariableNames:'TheOneAndOnlyToDoListBrowser'
poolDictionaries:''
category:'Interface-Smalltalk-ToDo'
!
!ToDoListBrowser class methodsFor:'documentation'!
documentation
"
documentation to be added.
[author:]
cg (cg@FUSI)
[instance variables:]
[class variables:]
[see also:]
"
!
examples
"
Starting the application:
[exBegin]
ToDoListBrowser open
[exEnd]
more examples to be added:
[exBegin]
... add code fragment for
... executable example here ...
[exEnd]
"
!
history
"Created: / 21-10-2006 / 15:05:53 / cg"
! !
!ToDoListBrowser class methodsFor:'class initialization'!
current
^ TheOneAndOnlyToDoListBrowser
"Created: / 21-10-2006 / 20:37:48 / cg"
!
current:aBrowser
TheOneAndOnlyToDoListBrowser := aBrowser.
"Created: / 21-10-2006 / 20:38:08 / cg"
!
new
|b|
b := super new.
TheOneAndOnlyToDoListBrowser isNil ifTrue:[
TheOneAndOnlyToDoListBrowser := b.
].
^ b
"Created: / 21-10-2006 / 20:39:03 / cg"
! !
!ToDoListBrowser class methodsFor:'interface specs'!
windowSpec
"This resource specification was automatically generated
by the UIPainter of ST/X."
"Do not manually edit this!! If it is corrupted,
the UIPainter may not be able to read the specification."
"
UIPainter new openOnClass:ToDoListBrowser andSelector:#windowSpec
ToDoListBrowser new openInterface:#windowSpec
ToDoListBrowser open
"
<resource: #canvas>
^
#(FullSpec
name: windowSpec
window:
(WindowSpec
label: 'ToDoListBrowser'
name: 'ToDoListBrowser'
min: (Point 10 10)
max: (Point 1024 768)
bounds: (Rectangle 0 0 577 395)
menu: mainMenu
)
component:
(SpecCollection
collection: (
(DataSetSpec
name: 'Table1'
layout: (LayoutFrame 0 0 0 0 0 1 0 1)
model: selectionIndexHolder
menu: itemMenu
hasHorizontalScrollBar: true
hasVerticalScrollBar: true
dataList: toDoList
doubleClickSelector: itemDoubleClicked:
columnHolder: tableColumns
)
)
)
)
! !
!ToDoListBrowser class methodsFor:'menu specs'!
itemMenu
"This resource specification was automatically generated
by the MenuEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the MenuEditor may not be able to read the specification."
"
MenuEditor new openOnClass:ToDoListBrowser andSelector:#itemMenu
(Menu new fromLiteralArrayEncoding:(ToDoListBrowser itemMenu)) startUp
"
<resource: #menu>
^
#(Menu
(
(MenuItem
label: 'Browse'
itemValue: browseItem
translateLabel: true
)
(MenuItem
label: '-'
)
(MenuItem
label: 'Remove'
itemValue: removeItem
translateLabel: true
)
)
nil
nil
)
!
mainMenu
"This resource specification was automatically generated
by the MenuEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the MenuEditor may not be able to read the specification."
"
MenuEditor new openOnClass:Tools::ToDoListBrowser andSelector:#mainMenu
(Menu new fromLiteralArrayEncoding:(Tools::ToDoListBrowser mainMenu)) startUp
"
<resource: #menu>
^
#(Menu
(
(MenuItem
label: 'File'
translateLabel: true
submenu:
(Menu
(
(MenuItem
label: 'Exit'
itemValue: closeRequest
translateLabel: true
)
)
nil
nil
)
)
(MenuItem
label: 'List'
translateLabel: true
submenu:
(Menu
(
(MenuItem
label: 'Clear'
itemValue: clearList
translateLabel: true
)
)
nil
nil
)
)
(MenuItem
label: 'MENU_Help'
translateLabel: true
startGroup: conditionalRight
submenu:
(Menu
(
(MenuItem
label: 'Documentation'
itemValue: openDocumentation
translateLabel: true
)
(MenuItem
label: '-'
)
(MenuItem
label: 'About this Application...'
itemValue: openAboutThisApplication
translateLabel: true
)
)
nil
nil
)
)
)
nil
nil
)
"Modified: / 23-10-2006 / 23:22:45 / cg"
! !
!ToDoListBrowser class methodsFor:'tableColumns specs'!
tableColumns
"This resource specification was automatically generated
by the DataSetBuilder of ST/X."
"Do not manually edit this!! If it is corrupted,
the DataSetBuilder may not be able to read the specification."
"
DataSetBuilder new openOnClass:ToDoListBrowser andSelector:#tableColumns
"
<resource: #tableColumns>
^#(
(DataSetColumnSpec
label: 'Type'
labelButtonType: Button
width: 32
model: severity
canSelect: false
)
(DataSetColumnSpec
label: 'Prio'
labelButtonType: Button
width: 30
model: priority
canSelect: false
)
(DataSetColumnSpec
label: 'Time'
labelButtonType: Button
width: 50
model: time
canSelect: false
labelAlignment: left
labelActionSelector: sortBy:
labelActionArgument: 'timestamp'
)
(DataSetColumnSpec
label: 'Where'
labelButtonType: Button
model: methodOrClassName
canSelect: false
labelAlignment: left
labelActionSelector: sortBy:
labelActionArgument: 'methodOrClassName'
)
(DataSetColumnSpec
label: 'Message'
labelButtonType: Button
model: message
canSelect: false
labelAlignment: left
labelActionSelector: sortBy:
labelActionArgument: 'message'
)
)
"Modified: / 25-10-2006 / 01:05:50 / cg"
! !
!ToDoListBrowser methodsFor:'accessing'!
addEntry:anEntry
self toDoList add:anEntry
"Created: / 21-10-2006 / 15:38:08 / cg"
"Modified: / 21-10-2006 / 21:14:31 / cg"
!
selectionIndexHolder
selectionIndexHolder isNil ifTrue:[
selectionIndexHolder := nil asValue.
].
^ selectionIndexHolder
"Created: / 22-10-2006 / 02:00:41 / cg"
!
toDoList
toDoList isNil ifTrue:[
toDoList := ToDoList theOneAndOnlyToDoList.
].
^ toDoList
"Created: / 21-10-2006 / 20:57:18 / cg"
! !
!ToDoListBrowser methodsFor:'initialization & release'!
closeDownViews
"This is a hook method generated by the Browser.
It will be invoked when your app/dialog-window is really closed.
See also #closeDownViews, which is invoked before and may suppress the close
or ask the user for confirmation."
"/ change the code below as required ...
"/ This should cleanup any leftover resources
"/ (for example, temporary files)
"/ super closeRequest will initiate the closeDown
"/ add your code here
"/ do not remove the one below ...
^ super closeDownViews
!
closeRequest
"This is a hook method generated by the Browser.
It will be invoked when your app/dialog-window is about to be
closed (this method has a chance to suppress the close).
See also #closeDownViews, which is invoked when the close is really done."
"/ change the code below as required ...
"/ Closing can be suppressed, by simply returning.
"/ The 'super closeRequest' at the end will initiate the real closeDown
("self hasUnsavedChanges" false) ifTrue:[
(self confirm:(resources string:'Close without saving ?')) ifFalse:[
^ self
]
].
^ super closeRequest
"Modified: / 21-10-2006 / 19:21:02 / cg"
!
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."
"/ add any code here ...
^ super postBuildWith:aBuilder
!
postOpenWith:aBuilder
"This is a hook method generated by the Browser.
It will be invoked right after the applications window has been opened.
Add any app-specific actions here (starting background processes etc.).
See also #postBuildWith:, which is invoked before opening."
"/ add any code here ...
^ super postOpenWith:aBuilder
!
release
self == TheOneAndOnlyToDoListBrowser ifTrue:[
TheOneAndOnlyToDoListBrowser := nil
].
super release.
"Created: / 21-10-2006 / 20:40:31 / cg"
! !
!ToDoListBrowser methodsFor:'menu actions'!
clearList
toDoList removeAll
"Created: / 22-10-2006 / 00:02:15 / cg"
!
menuSave
"This method was generated by the Browser.
It will be invoked when the menu-item 'save' is selected."
"/ change below and add any actions as required here ...
self warn:'no action for ''save'' defined.'.
!
menuSaveAs
"This method was generated by the Browser.
It will be invoked when the menu-item 'saveAs' is selected."
"/ change below and add any actions as required here ...
self warn:'no action for ''saveAs'' defined.'.
!
openAboutThisApplication
"This method was generated by the Browser.
It will be invoked when the menu-item 'help-about' is selected."
"/ could open a customized aboutBox here ...
super openAboutThisApplication
!
openDocumentation
"This method was generated by the Browser.
It will be invoked when the menu-item 'help-documentation' is selected."
"/ change below as required ...
"/ to open an HTML viewer on some document (under 'doc/online/<language>/' ):
HTMLDocumentView openFullOnDocumentationFile:'TOP.html'.
"/ add application-specific help files under the 'doc/online/<language>/help/appName'
"/ directory, and open a viewer with:
"/ HTMLDocumentView openFullOnDocumentationFile:'help/<MyApplication>/TOP.html'.
! !
!ToDoListBrowser methodsFor:'menu actions-item'!
browseItem
(toDoList at:self selectionIndexHolder value) browse
"Created: / 22-10-2006 / 02:00:20 / cg"
!
removeItem
(toDoList removeIndex:self selectionIndexHolder value)
"Created: / 22-10-2006 / 10:45:52 / cg"
! !
!ToDoListBrowser methodsFor:'user actions'!
itemDoubleClicked:itemIndex
(toDoList at:itemIndex) browse
"Created: / 22-10-2006 / 01:49:13 / cg"
!
resort
|sortBlock sortBlock1 col|
col := currentSortOrder at:#column.
sortBlock := sortBlock1 := [:a :b | (a perform:col) < (b perform:col)].
(currentSortOrder at:#reverse) ifTrue:[
sortBlock := [:a :b | (sortBlock1 value:a value:b) not ].
].
"/ temporary hack - should make a copy of the real list
self toDoList sort:sortBlock
"Created: / 25-10-2006 / 01:01:26 / cg"
!
sortBy:instanceName
self sortBy:instanceName withReverse:true
"Created: / 25-10-2006 / 00:53:55 / cg"
!
sortBy:instanceName withReverse:aBoolean
|aSymbol|
aSymbol := instanceName asSymbol.
currentSortOrder isNil ifTrue:[
currentSortOrder := Dictionary new.
currentSortOrder at:#column put:aSymbol.
currentSortOrder at:#reverse put:false.
] ifFalse:[
(currentSortOrder at:#column) = aSymbol ifTrue:[
"/ same column like before - change sort order ifReverse is true
aBoolean ifTrue:[
| isReverse |
isReverse := currentSortOrder at:#reverse.
currentSortOrder at:#reverse put:(isReverse not).
].
] ifFalse:[
"/ another column - remark column
currentSortOrder at:#column put:aSymbol.
]
].
self resort.
"Created: / 25-10-2006 / 00:54:59 / cg"
! !
!ToDoListBrowser class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/libtool/Tools__ToDoListBrowser.st,v 1.5 2006-10-24 23:06:33 cg Exp $'
! !