--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/BookmarkListEditor.st Fri Jul 01 15:15:24 2011 +0200
@@ -0,0 +1,494 @@
+"
+ COPYRIGHT (c) 2006 by eXept Software AG
+ All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
+"{ Package: 'stx:libtool' }"
+
+ApplicationModel subclass:#BookmarkListEditor
+ instanceVariableNames:'selectionHolder bookmarkListHolder'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Interface-Bookmarks'
+!
+
+!BookmarkListEditor class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 2006 by eXept Software AG
+ All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
+! !
+
+!BookmarkListEditor 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:BookmarkListEditor andSelector:#windowSpec
+ BookmarkListEditor new openInterface:#windowSpec
+ BookmarkListEditor open
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(FullSpec
+ name: windowSpec
+ window:
+ (WindowSpec
+ label: 'Bookmark Editor'
+ name: 'Bookmark Editor'
+ min: (Point 10 10)
+ bounds: (Rectangle 0 0 509 430)
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (MenuPanelSpec
+ name: 'ToolBar'
+ layout: (LayoutFrame 0 0 0 0 0 1 30 0)
+ menu: toolbarMenu
+ textDefault: true
+ )
+ (VariableHorizontalPanelSpec
+ name: 'Panel'
+ layout: (LayoutFrame 0 0 30 0 0 1 0 1)
+ component:
+ (SpecCollection
+ collection: (
+ (HierarchicalListViewSpec
+ name: 'BookmarkList'
+ model: selectionHolder
+ menu: contextMenu
+ hasHorizontalScrollBar: true
+ hasVerticalScrollBar: true
+ listModel: bookmarkListHolder
+ useIndex: false
+ highlightMode: line
+ doubleClickSelector: menuRename
+ useDefaultIcons: false
+ )
+ )
+
+ )
+ handles: (Any 1.0)
+ )
+ )
+
+ )
+ )
+! !
+
+!BookmarkListEditor class methodsFor:'menu specs'!
+
+contextMenu
+ "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:BookmarkListEditor andSelector:#contextMenu
+ (Menu new fromLiteralArrayEncoding:(BookmarkListEditor contextMenu)) startUp
+ "
+
+ <resource: #menu>
+
+ ^
+ #(Menu
+ (
+ (MenuItem
+ label: 'New...'
+ itemValue: menuNewFolder
+ translateLabel: true
+ submenuChannel: newMenu
+ labelImage: (ResourceRetriever ToolbarIconLibrary newDirectory22x22Icon 'New...')
+ )
+ (MenuItem
+ label: 'Rename'
+ itemValue: menuRename
+ translateLabel: true
+ shortcutKey: Rename
+ )
+ (MenuItem
+ enabled: hasSelectionHolder
+ label: 'Remove'
+ itemValue: menuRemove
+ translateLabel: true
+ labelImage: (ResourceRetriever ToolbarIconLibrary deleteIcon 'Remove')
+ )
+ (MenuItem
+ label: '-'
+ )
+ (MenuItem
+ enabled: hasSelectionHolder
+ label: 'Move Up'
+ itemValue: menuMoveUp
+ translateLabel: true
+ isButton: true
+ labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetUpIcon 'Move Up')
+ )
+ (MenuItem
+ enabled: hasSelectionHolder
+ label: 'Move Down'
+ itemValue: menuMoveDown
+ translateLabel: true
+ isButton: true
+ labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetDownIcon 'Move Down')
+ )
+ (MenuItem
+ enabled: hasSelectionHolder
+ label: 'Move In'
+ itemValue: menuMoveIn
+ translateLabel: true
+ isButton: true
+ labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetDownRightIcon 'Move In')
+ )
+ (MenuItem
+ enabled: hasSelectionHolder
+ label: 'Move Out'
+ itemValue: menuMoveOut
+ translateLabel: true
+ isButton: true
+ labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetLeftDownIcon 'Move Out')
+ )
+ )
+ nil
+ nil
+ )
+!
+
+newMenu
+ "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:BookmarkListEditor andSelector:#newMenu
+ (Menu new fromLiteralArrayEncoding:(BookmarkListEditor newMenu)) startUp
+ "
+
+ <resource: #menu>
+
+ ^
+ #(Menu
+ (
+ (MenuItem
+ label: 'New Folder'
+ itemValue: menuNew:
+ translateLabel: true
+ labelImage: (ResourceRetriever ToolbarIconLibrary newDirectory22x22Icon 'New Folder')
+ argument: #'Bookmark::Folder'
+ )
+ (MenuItem
+ label: 'New Separator'
+ itemValue: menuNew:
+ translateLabel: true
+ argument: #'Bookmark::Separator'
+ )
+ )
+ nil
+ nil
+ )
+!
+
+toolbarMenu
+ "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:BookmarkListEditor andSelector:#toolbarMenu
+ (Menu new fromLiteralArrayEncoding:(BookmarkListEditor toolbarMenu)) startUp
+ "
+
+ <resource: #menu>
+
+ ^
+ #(Menu
+ (
+ (MenuItem
+ label: 'New...'
+ itemValue: menuNewFolder
+ translateLabel: true
+ isButton: true
+ submenuChannel: newMenu
+ labelImage: (ResourceRetriever ToolbarIconLibrary newDirectory22x22Icon)
+ )
+ (MenuItem
+ enabled: hasSelectionHolder
+ label: 'Remove'
+ itemValue: menuRemove
+ translateLabel: true
+ isButton: true
+ shortcutKey: Delete
+ labelImage: (ResourceRetriever ToolbarIconLibrary deleteIcon)
+ )
+ (MenuItem
+ label: '-'
+ )
+ (MenuItem
+ label: 'Save'
+ itemValue: menuSave
+ translateLabel: true
+ isButton: true
+ labelImage: (ResourceRetriever ToolbarIconLibrary saveToFileIcon)
+ )
+ (MenuItem
+ label: '-'
+ )
+ (MenuItem
+ enabled: hasSelectionHolder
+ label: 'Move Up'
+ itemValue: menuMoveUp
+ translateLabel: true
+ isButton: true
+ labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetUpIcon)
+ )
+ (MenuItem
+ enabled: hasSelectionHolder
+ label: 'Move Down'
+ itemValue: menuMoveDown
+ translateLabel: true
+ isButton: true
+ labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetDownIcon)
+ )
+ (MenuItem
+ enabled: hasSelectionHolder
+ label: 'Move In'
+ itemValue: menuMoveIn
+ translateLabel: true
+ isButton: true
+ labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetDownRightIcon)
+ )
+ (MenuItem
+ enabled: hasSelectionHolder
+ label: 'Move Out'
+ itemValue: menuMoveOut
+ translateLabel: true
+ isButton: true
+ labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetLeftDownIcon)
+ )
+ )
+ nil
+ nil
+ )
+! !
+
+!BookmarkListEditor methodsFor:'accessing'!
+
+bookmarkList
+
+ ^self bookmarkListHolder value
+
+ "Created: / 02-06-2011 / 10:40:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+bookmarkList: aBookmarkList
+
+ self bookmarkListHolder value: aBookmarkList
+
+ "Created: / 02-06-2011 / 10:40:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+selection
+
+ ^self selectionHolder value
+
+ "Created: / 02-06-2011 / 10:57:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+selection: anObject
+
+ ^self selectionHolder value: anObject
+
+ "Created: / 02-06-2011 / 11:46:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!BookmarkListEditor methodsFor:'aspects'!
+
+bookmarkListHolder
+ <resource: #uiAspect>
+
+ "automatically generated by UIPainter ..."
+
+ "*** the code below creates a default model when invoked."
+ "*** (which may not be the one you wanted)"
+ "*** Please change as required and accept it in the browser."
+ "*** (and replace this comment by something more useful ;-)"
+
+ bookmarkListHolder isNil ifTrue:[
+ bookmarkListHolder := ValueHolder new.
+"/ if your app needs to be notified of changes, uncomment one of the lines below:
+"/ bookmarkListHolder addDependent:self.
+"/ bookmarkListHolder onChangeSend:#bookmarkListHolderChanged to:self.
+ ].
+ ^ bookmarkListHolder.
+
+ "Modified: / 02-06-2011 / 10:39:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+hasSelectionHolder
+
+ ^BlockValue
+ with:[:selectionHolder|selectionHolder value notNil]
+ argument: self selectionHolder
+
+ "Created: / 02-06-2011 / 10:55:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+selectionHolder
+ <resource: #uiAspect>
+
+ "automatically generated by UIPainter ..."
+
+ "*** the code below creates a default model when invoked."
+ "*** (which may not be the one you wanted)"
+ "*** Please change as required and accept it in the browser."
+ "*** (and replace this comment by something more useful ;-)"
+
+ selectionHolder isNil ifTrue:[
+ selectionHolder := ValueHolder new.
+"/ if your app needs to be notified of changes, uncomment one of the lines below:
+"/ selectionHolder addDependent:self.
+"/ selectionHolder onChangeSend:#selectionHolderChanged to:self.
+ ].
+ ^ selectionHolder.
+! !
+
+!BookmarkListEditor methodsFor:'hooks'!
+
+commonPostOpen
+
+ | root |
+
+ self bookmarkList ifNil:
+ [self bookmarkList: BookmarkList forSystemBrowser].
+ root := self bookmarkList root.
+ root isExpanded ifFalse:[root expand].
+
+ "Created: / 02-06-2011 / 10:41:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 02-06-2011 / 13:33:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!BookmarkListEditor methodsFor:'menu actions'!
+
+menuMoveDown
+
+ | sel |
+
+ (sel := self selection) parent moveDown: sel.
+ self selection: sel.
+
+ "Modified: / 02-06-2011 / 11:45:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+menuMoveIn
+
+ | sel |
+
+ (sel := self selection) parent moveIn: sel.
+ self selection: sel.
+
+ "Modified: / 03-06-2011 / 10:27:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+menuMoveOut
+
+ | sel |
+
+ (sel := self selection) parent moveOut: sel.
+ self selection: sel.
+
+ "Modified: / 03-06-2011 / 10:28:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+menuMoveUp
+
+ | sel |
+
+ (sel := self selection) parent moveUp: sel.
+ self selection: sel.
+
+ "Modified: / 02-06-2011 / 11:46:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+menuNew: className
+
+ | folder new |
+ folder := self selection.
+ folder ifNil:[folder := self bookmarkList root].
+ folder isFolderBookmark ifFalse: [folder := folder parent].
+ new := (Smalltalk at: className) new.
+ folder add: new.
+
+ "Created: / 02-06-2011 / 11:49:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 02-06-2011 / 13:24:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+menuNewFolder
+
+ self menuNew: #'Bookmark::Folder'
+
+ "Modified: / 02-06-2011 / 12:00:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+menuRemove
+
+ self selection parent remove: self selection.
+
+ "Modified: / 02-06-2011 / 13:18:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+menuRename
+
+ | sel name |
+ sel := self selection.
+ name := Dialog request: 'Enter new name' initialAnswer: sel label asString.
+ name ifNil:[^self].
+ sel label: name.
+
+ "Modified: / 03-06-2011 / 10:43:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+menuSave
+
+ self bookmarkList save.
+
+ "Modified: / 02-06-2011 / 22:53:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!BookmarkListEditor class methodsFor:'documentation'!
+
+version_CVS
+ ^ '$Header: /cvs/stx/stx/libtool/BookmarkListEditor.st,v 1.1 2011-07-01 13:15:24 cg Exp $'
+!
+
+version_SVN
+ ^ '§Id§'
+! !