--- a/HierarchicalListEditor.st Fri Mar 13 22:25:13 1998 +0100
+++ b/HierarchicalListEditor.st Fri Mar 13 22:33:35 1998 +0100
@@ -13,9 +13,9 @@
-ToolApplicationModel subclass:#HierarchicalListEditor
- instanceVariableNames:'isModified didInstall treeView specClass specSelector'
- classVariableNames:'CopyBuffer'
+ListSpecEditor subclass:#HierarchicalListEditor
+ instanceVariableNames:'treeView'
+ classVariableNames:''
poolDictionaries:''
category:'Interface-UIPainter'
!
@@ -41,8 +41,8 @@
documentation
"
- HierarchicalListEditor is used by the UIPainter to
- create or maintain a hierarchical list.
+ The HierarchicalListEditor allows you to create, modify or just inspect
+ (statical) hierarchical lists for the SelectionInListView.
[start with:]
HierarchicalListEditor open
@@ -52,12 +52,32 @@
[author:]
Claus Atzkern, eXept Software AG
+ Thomas Zwick, eXept Software AG
"
! !
+!HierarchicalListEditor class methodsFor:'instance creation'!
+
+openModalOnTreeItem: aTreeItem
+ "Open a HierarchicalListEditor modal on aTreeItem"
+ "self openModalOnTreeItem: (TreeItem name: 'Label' contents: #Contents)"
+
+ ^self new openModalOnTreeItem: aTreeItem
+
+! !
+
+!HierarchicalListEditor class methodsFor:'accessing'!
+
+resourceType
+ "get the type of resource of the method generated by the HierarchicalListEditor"
+
+ ^#hierarchicalList
+
+! !
+
!HierarchicalListEditor class methodsFor:'help specs'!
helpSpec
@@ -79,14 +99,17 @@
#contents
'Contents of the tree item.'
+#fileLoad
+'Opens a dialog for selecting and loading a hierarchical list spec from a class.'
+
#fileNew
'Creates a new hierarchical list.'
-#fileReload
-'Reload hierarchical list from current class and selector.'
+#fileSave
+'Saves current hierarchical list spec.'
-#fileSave
-'Saves current hierarchical list.'
+#fileSaveAs
+'Opens a dialog to save current hierarchical list spec.'
#label
'Label of the tree item.'
@@ -94,82 +117,33 @@
)
! !
-!HierarchicalListEditor class methodsFor:'interface specs'!
-
-classAndMethodSpec
- "this window spec was automatically generated by the ST/X UIPainter"
+!HierarchicalListEditor class methodsFor:'image specs'!
- "do not manually edit this - the painter/builder may not be able to
- handle the specification if its corrupted."
-
+createChildIcon
+ "Generated by the Image Editor"
"
- UIPainter new openOnClass:HierarchicalListEditor andSelector:#classAndMethodSpec
- HierarchicalListEditor new openInterface:#classAndMethodSpec
+ ImageEditor openOnClass:self andSelector:#createChildIcon
"
- <resource: #canvas>
+ <resource: #image>
+
+ ^Icon
+ constantNamed:#'HierarchicalListEditor createChildIcon'
+ ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@AUUUUP@@A????2@@A????2 @A????0@@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A<3L308@A33L33H@A30L33H@A33L33H@A<3L008@A?????8@C*****(@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@_??@_?? _??0_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8') ; yourself); yourself]!
- ^
-
- #(#FullSpec
- #'window:'
- #(#WindowSpec
- #'name:' 'Hierarchical List Editor'
- #'layout:' #(#LayoutFrame 213 0 373 0 513 0 501 0)
- #'label:' 'Hierarchical List Editor'
- #'min:' #(#Point 10 10)
- #'max:' #(#Point 1160 870)
- #'bounds:' #(#Rectangle 213 373 514 502)
- #'usePreferredExtent:' false
- )
- #'component:'
- #(#SpecCollection
- #'collection:'
- #(
- #(#FramedBoxSpec
- #'name:' 'framedBox1'
- #'layout:' #(#LayoutFrame 0 0.0 3 0.0 0 1.0 -33 1.0)
- #'label:' 'Class and selector for code'
- #'labelPosition:' #topLeft
- )
- #(#LabelSpec
- #'name:' 'classLabel'
- #'layout:' #(#AlignmentOrigin 53 0.11 39 0 1 0.5)
- #'label:' 'Class:'
- #'adjust:' #right
- #'resizeForLabel:' true
- )
- #(#InputFieldSpec
- #'name:' 'classField'
- #'layout:' #(#LayoutFrame 57 0.11 27 0 -19 1.0 49 0)
- #'enableChannel:' #canChangeClassName
- #'tabable:' true
- #'model:' #specClassChannel
- )
- #(#LabelSpec
- #'name:' 'methodLabel'
- #'layout:' #(#AlignmentOrigin 53 0.11 64 0 1 0.5)
- #'label:' 'Selector:'
- #'adjust:' #right
- #'resizeForLabel:' true
- )
- #(#InputFieldSpec
- #'name:' 'methodField'
- #'layout:' #(#LayoutFrame 57 0.11 52 0 -19 1.0 74 0)
- #'tabable:' true
- #'model:' #specSelectorChannel
- #'type:' #string
- )
- #(#UISubSpecification
- #'name:' 'SubSpecification'
- #'layout:' #(#LayoutFrame 0 0.0 -29 1 0 1.0 -5 1.0)
- #'majorKey:' #ToolApplicationModel
- #'minorKey:' #windowSpecForCommitWithoutChannels
- )
- )
- )
- )
-!
+createSisterIcon
+ "Generated by the Image Editor"
+ "
+ ImageEditor openOnClass:self andSelector:#createSisterIcon
+ "
+
+ <resource: #image>
+
+ ^Icon
+ constantNamed:#'HierarchicalListEditor createSisterIcon'
+ ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@AUUUUP@@A????2@@A????2 @A????0@@A?????8@A?????8@A?????8@A<L<O?8@A3<3??8@A<<<<C8@A?L?O?8@A0<0??8@A?????8@A0LCC?8@A<<?L?8@A<<CC?8@A<<?L?8@A<<CL?8@A?????8@C*****(@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@_??@_?? _??0_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8') ; yourself); yourself]! !
+
+!HierarchicalListEditor class methodsFor:'interface specs'!
windowSpec
"this window spec was automatically generated by the ST/X UIPainter"
@@ -188,96 +162,96 @@
^
#(#FullSpec
- #'window:'
+ #window:
#(#WindowSpec
- #'name:' 'Hierarchical List Editor'
- #'layout:' #(#LayoutFrame 92 0 328 0 566 0 640 0)
- #'label:' 'Hierarchical List Editor'
- #'min:' #(#Point 10 10)
- #'max:' #(#Point 1160 870)
- #'bounds:' #(#Rectangle 92 328 567 641)
- #'menu:' #menu
- #'usePreferredExtent:' false
+ #name: 'Hierarchical List Editor'
+ #layout: #(#LayoutFrame 140 0 249 0 614 0 561 0)
+ #label: 'Hierarchical List Editor'
+ #min: #(#Point 10 10)
+ #max: #(#Point 1160 870)
+ #bounds: #(#Rectangle 140 249 615 562)
+ #menu: #menu
+ #usePreferredExtent: false
)
- #'component:'
+ #component:
#(#SpecCollection
- #'collection:'
+ #collection:
#(
#(#MenuPanelSpec
- #'name:' 'menuToolbarView'
- #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 32 0)
- #'menu:' #menuToolbar
+ #name: 'menuToolbarView'
+ #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 32 0)
+ #menu: #menuToolbar
)
#(#VariableHorizontalPanelSpec
- #'name:' 'variableHorizontalPanel'
- #'layout:' #(#LayoutFrame 0 0.0 34 0.0 0 1.0 -26 1.0)
- #'component:'
+ #name: 'VariableHorizontalPanel'
+ #layout: #(#LayoutFrame 0 0.0 34 0.0 0 1.0 -26 1.0)
+ #component:
#(#SpecCollection
- #'collection:'
+ #collection:
#(
#(#ArbitraryComponentSpec
- #'name:' 'treeView'
- #'menu:' #menuEdit
- #'hasHorizontalScrollBar:' true
- #'hasVerticalScrollBar:' true
- #'miniScrollerHorizontal:' true
- #'miniScrollerVertical:' true
- #'component:' #treeView
- #'hasBorder:' false
+ #name: 'TreeView'
+ #menu: #menuEdit
+ #hasHorizontalScrollBar: true
+ #hasVerticalScrollBar: true
+ #miniScrollerHorizontal: true
+ #miniScrollerVertical: true
+ #component: #treeView
+ #hasBorder: false
)
#(#ViewSpec
- #'name:' 'specView'
- #'component:'
+ #name: 'SpecView'
+ #component:
#(#SpecCollection
- #'collection:'
+ #collection:
#(
#(#LabelSpec
- #'name:' 'nameLabel'
- #'layout:' #(#AlignmentOrigin 107 0 25 0 1 0.5)
- #'label:' 'Label:'
- #'resizeForLabel:' true
+ #name: 'nameLabel'
+ #layout: #(#AlignmentOrigin 108 0 26 0 1 0.5)
+ #label: 'Label:'
+ #resizeForLabel: true
)
#(#InputFieldSpec
- #'name:' 'labelInputField'
- #'layout:' #(#LayoutFrame 110 0 15 0 -5 1.0 37 0)
- #'activeHelpKey:' #label
- #'tabable:' true
- #'model:' #itemName
+ #name: 'labelInputField'
+ #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0)
+ #activeHelpKey: #label
+ #tabable: true
+ #model: #itemName
)
#(#LabelSpec
- #'name:' 'valueLabel'
- #'layout:' #(#AlignmentOrigin 107 0 51 0 1 0.5)
- #'activeHelpKey:' #contents
- #'label:' 'Contents:'
- #'resizeForLabel:' true
+ #name: 'valueLabel'
+ #layout: #(#AlignmentOrigin 108 0 52 0 1 0.5)
+ #activeHelpKey: #contents
+ #label: 'Contents:'
+ #resizeForLabel: true
)
#(#InputFieldSpec
- #'name:' 'valueInputField'
- #'layout:' #(#LayoutFrame 110 0 41 0 -5 1.0 63 0)
- #'activeHelpKey:' #contents
- #'tabable:' true
- #'model:' #itemValue
- #'type:' #symbolOrNil
+ #name: 'valueInputField'
+ #layout: #(#LayoutFrame 110 0 41 0 -5 1.0 63 0)
+ #activeHelpKey: #contents
+ #tabable: true
+ #model: #itemValue
+ #type: #symbolOrNil
)
#(#UISubSpecification
- #'name:' 'SubSpecification'
- #'layout:' #(#LayoutFrame 2 0.0 -26 1.0 -2 1.0 -2 1.0)
- #'majorKey:' #ToolApplicationModel
- #'minorKey:' #windowSpecForCommit
+ #name: 'SubSpecification'
+ #layout: #(#LayoutFrame 2 0.0 -26 1.0 -2 1.0 -2 1.0)
+ #majorKey: #ToolApplicationModel
+ #minorKey: #windowSpecForCommit
)
)
)
- #'level:' -1
+ #level: -1
)
)
)
- #'handles:' #(#Any 0.368421 1.0)
+ #handles: #(#Any 0.368421 1.0)
)
#(#UISubSpecification
- #'name:' 'infoBarSubSpec'
- #'layout:' #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0)
- #'majorKey:' #ToolApplicationModel
- #'minorKey:' #windowSpecForInfoBar
+ #name: 'InfoBarSubSpec'
+ #layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0)
+ #majorKey: #ToolApplicationModel
+ #minorKey: #windowSpecForInfoBar
)
)
)
@@ -305,99 +279,100 @@
#(
#(#MenuItem
- #'label:' 'About'
- #'labelImage:' #(#ResourceRetriever nil #menuIcon)
- #'submenuChannel:' #menuAbout
+ #label: 'About'
+ #labelImage: #(#ResourceRetriever nil #menuIcon)
+ #submenuChannel: #menuAbout
)
#(#MenuItem
- #'label:' 'File'
- #'submenu:'
+ #label: 'File'
+ #submenu:
#(#Menu
#(
#(#MenuItem
- #'label:' 'New'
- #'value:' #doNew
- #'activeHelpKey:' #fileNew
+ #label: 'New'
+ #value: #doNew
+ #activeHelpKey: #fileNew
)
#(#MenuItem
- #'label:' '-'
+ #label: '-'
)
#(#MenuItem
- #'label:' 'Reload'
- #'value:' #doReload
- #'activeHelpKey:' #fileReload
+ #label: 'Load...'
+ #translateLabel: true
+ #value: #doLoad
+ #activeHelpKey: #fileLoad
)
#(#MenuItem
- #'label:' '-'
- )
- #(#MenuItem
- #'label:' 'Save'
- #'value:' #doInstall
- #'activeHelpKey:' #fileSave
- #'enabled:' #hasValidClass
+ #label: '-'
)
#(#MenuItem
- #'label:' '-'
+ #label: 'Save'
+ #value: #doSave
+ #activeHelpKey: #fileSave
)
#(#MenuItem
- #'label:' 'Define Class And Selector...'
- #'value:' #doDefineClass
- #'activeHelpKey:' #fileDefineClassAndSelector
+ #label: 'Save As...'
+ #value: #doSaveAs
+ #activeHelpKey: #fileSaveAs
)
#(#MenuItem
- #'label:' '-'
+ #label: '-'
)
#(#MenuItem
- #'label:' 'Browse Class'
- #'value:' #doBrowse
- #'activeHelpKey:' #fileBrowseClass
- #'enabled:' #hasValidClass
+ #label: 'Browse Class'
+ #value: #doBrowseClass
+ #activeHelpKey: #fileBrowseClass
+ #enabled: #hasValidClass
)
#(#MenuItem
- #'label:' '-'
+ #label: '-'
)
#(#MenuItem
- #'label:' 'Exit'
- #'value:' #closeRequest
- #'activeHelpKey:' #fileExit
+ #label: 'Exit'
+ #value: #closeRequest
+ #activeHelpKey: #fileExit
)
) nil
nil
)
)
#(#MenuItem
- #'label:' 'Edit'
- #'submenuChannel:' #menuEdit
+ #label: 'Edit'
+ #submenuChannel: #menuEdit
)
#(#MenuItem
- #'label:' 'Add'
- #'submenu:'
+ #label: 'Add'
+ #submenu:
#(#Menu
#(
#(#MenuItem
- #'label:' 'Child'
- #'value:' #doCreateChild
- #'activeHelpKey:' #addChild
- #'enabled:' #canCreateChildChannel
- #'labelImage:' #(#ResourceRetriever #HierarchicalListEditor #createChildIcon 'Child')
+ #label: 'Child'
+ #value: #doCreateChild
+ #activeHelpKey: #addChild
+ #enabled: #canCreateChildChannel
+ #labelImage: #(#ResourceRetriever #HierarchicalListEditor #createChildIcon 'Child')
)
#(#MenuItem
- #'label:' 'Sister'
- #'value:' #doCreateSister
- #'activeHelpKey:' #addSister
- #'enabled:' #canCreateSisterChannel
- #'labelImage:' #(#ResourceRetriever #HierarchicalListEditor #createSisterIcon 'Sister')
+ #label: 'Sister'
+ #value: #doCreateSister
+ #activeHelpKey: #addSister
+ #enabled: #canCreateSisterChannel
+ #labelImage: #(#ResourceRetriever #HierarchicalListEditor #createSisterIcon 'Sister')
)
) nil
nil
)
)
#(#MenuItem
- #'label:' 'Help'
- #'startGroup:' #right
- #'submenuChannel:' #menuHelp
+ #label: 'History'
+ #submenuChannel: #menuHistory
+ )
+ #(#MenuItem
+ #label: 'Help'
+ #startGroup: #right
+ #submenuChannel: #menuHelp
)
) nil
nil
@@ -423,53 +398,59 @@
#(
#(#MenuItem
- #'label:' 'Cut'
- #'value:' #doCut
- #'activeHelpKey:' #editCut
- #'enabled:' #canCut
+ #label: 'Cut'
+ #value: #doCut
+ #activeHelpKey: #editCut
+ #enabled: #valueOfCanCut
+ )
+ #(#MenuItem
+ #label: 'Copy'
+ #value: #doCopy
+ #activeHelpKey: #editCopy
+ #enabled: #valueOfCanCopy
)
#(#MenuItem
- #'label:' 'Copy'
- #'value:' #doCopy
- #'activeHelpKey:' #editCopy
- #'enabled:' #canCopy
+ #label: 'Paste'
+ #value: #doPaste
+ #activeHelpKey: #editPaste
+ #enabled: #valueOfCanPaste
)
#(#MenuItem
- #'label:' 'Paste'
- #'value:' #doPaste
- #'activeHelpKey:' #editPaste
- #'enabled:' #canPaste
+ #label: 'Delete'
+ #value: #doDelete
+ #activeHelpKey: #editPaste
+ #enabled: #valueOfCanCut
)
#(#MenuItem
- #'label:' '-'
+ #label: '-'
)
#(#MenuItem
- #'label:' 'Move Up'
- #'value:' #doStepUp
- #'activeHelpKey:' #editMoveUp
- #'enabled:' #canStepOverChannel
- #'labelImage:' #(#ResourceRetriever #ToolApplicationModel #upIcon 'Move Up')
+ #label: 'Move Up'
+ #value: #doStepUp
+ #activeHelpKey: #editMoveUp
+ #enabled: #canStepOverChannel
+ #labelImage: #(#ResourceRetriever #ToolApplicationModel #upIcon 'Move Up')
)
#(#MenuItem
- #'label:' 'Move Down'
- #'value:' #doStepDown
- #'activeHelpKey:' #editMoveDown
- #'enabled:' #canStepOverChannel
- #'labelImage:' #(#ResourceRetriever #ToolApplicationModel #downIcon 'Move Down')
+ #label: 'Move Down'
+ #value: #doStepDown
+ #activeHelpKey: #editMoveDown
+ #enabled: #canStepOverChannel
+ #labelImage: #(#ResourceRetriever #ToolApplicationModel #downIcon 'Move Down')
)
#(#MenuItem
- #'label:' 'Move In'
- #'value:' #doStepIn
- #'activeHelpKey:' #editMoveIn
- #'enabled:' #canStepInChannel
- #'labelImage:' #(#ResourceRetriever #ToolApplicationModel #downRightIcon 'Move In')
+ #label: 'Move In'
+ #value: #doStepIn
+ #activeHelpKey: #editMoveIn
+ #enabled: #canStepInChannel
+ #labelImage: #(#ResourceRetriever #ToolApplicationModel #downRightIcon 'Move In')
)
#(#MenuItem
- #'label:' 'Move Out'
- #'value:' #doStepOut
- #'activeHelpKey:' #editMoveOut
- #'enabled:' #canStepOutChannel
- #'labelImage:' #(#ResourceRetriever #ToolApplicationModel #leftDownIcon 'Move Out')
+ #label: 'Move Out'
+ #value: #doStepOut
+ #activeHelpKey: #editMoveOut
+ #enabled: #canStepOutChannel
+ #labelImage: #(#ResourceRetriever #ToolApplicationModel #leftDownIcon 'Move Out')
)
) nil
nil
@@ -495,73 +476,114 @@
#(
#(#MenuItem
- #'label:' 'New'
- #'isButton:' true
- #'value:' #doNew
- #'activeHelpKey:' #fileNew
- #'labelImage:' #(#ResourceRetriever nil #newIcon)
+ #label: 'New'
+ #isButton: true
+ #value: #doNew
+ #activeHelpKey: #fileNew
+ #labelImage: #(#ResourceRetriever nil #newIcon)
)
#(#MenuItem
- #'label:' 'Save'
- #'isButton:' true
- #'value:' #doInstall
- #'activeHelpKey:' #fileSave
- #'enabled:' #hasValidClass
- #'labelImage:' #(#ResourceRetriever nil #saveIcon)
+ #label: 'Load'
+ #isButton: true
+ #value: #doLoad
+ #activeHelpKey: #fileLoad
+ #labelImage: #(#ResourceRetriever nil #loadIcon)
+ )
+ #(#MenuItem
+ #label: 'Save'
+ #isButton: true
+ #value: #doSave
+ #activeHelpKey: #fileSave
+ #labelImage: #(#ResourceRetriever nil #saveIcon)
)
#(#MenuItem
- #'label:' ''
+ #label: ''
+ )
+ #(#MenuItem
+ #label: 'Cut'
+ #isButton: true
+ #value: #doCut
+ #activeHelpKey: #editCut
+ #enabled: #valueOfCanCut
+ #labelImage: #(#ResourceRetriever nil #cutIcon)
)
#(#MenuItem
- #'label:' 'Add Child'
- #'isButton:' true
- #'value:' #doCreateChild
- #'activeHelpKey:' #addChild
- #'enabled:' #canCreateChildChannel
- #'labelImage:' #(#ResourceRetriever nil #createChildIcon)
+ #label: 'Copy'
+ #isButton: true
+ #value: #doCopy
+ #activeHelpKey: #editCopy
+ #enabled: #valueOfCanCopy
+ #labelImage: #(#ResourceRetriever nil #copyIcon)
)
#(#MenuItem
- #'label:' 'Add Sister'
- #'isButton:' true
- #'value:' #doCreateSister
- #'activeHelpKey:' #addSister
- #'enabled:' #canCreateSisterChannel
- #'labelImage:' #(#ResourceRetriever nil #createSisterIcon)
+ #label: 'Paste'
+ #isButton: true
+ #value: #doPaste
+ #activeHelpKey: #editPaste
+ #enabled: #valueOfCanPaste
+ #labelImage: #(#ResourceRetriever nil #pasteIcon)
)
#(#MenuItem
- #'label:' ''
+ #label: 'Delete'
+ #isButton: true
+ #value: #doDelete
+ #activeHelpKey: #editDelete
+ #enabled: #valueOfCanCut
+ #labelImage: #(#ResourceRetriever nil #deleteIcon)
+ )
+ #(#MenuItem
+ #label: ''
)
#(#MenuItem
- #'label:' 'Move Up'
- #'isButton:' true
- #'value:' #doStepUp
- #'activeHelpKey:' #editMoveUp
- #'enabled:' #canStepOverChannel
- #'labelImage:' #(#ResourceRetriever nil #upIcon)
+ #label: 'Add Child'
+ #isButton: true
+ #value: #doCreateChild
+ #activeHelpKey: #addChild
+ #enabled: #canCreateChildChannel
+ #labelImage: #(#ResourceRetriever nil #createChildIcon)
+ )
+ #(#MenuItem
+ #label: 'Add Sister'
+ #isButton: true
+ #value: #doCreateSister
+ #activeHelpKey: #addSister
+ #enabled: #canCreateSisterChannel
+ #labelImage: #(#ResourceRetriever nil #createSisterIcon)
+ )
+ #(#MenuItem
+ #label: ''
)
#(#MenuItem
- #'label:' 'Move Down'
- #'isButton:' true
- #'value:' #doStepDown
- #'activeHelpKey:' #editMoveDown
- #'enabled:' #canStepOverChannel
- #'labelImage:' #(#ResourceRetriever nil #downIcon)
+ #label: 'Move Up'
+ #isButton: true
+ #value: #doStepUp
+ #activeHelpKey: #editMoveUp
+ #enabled: #canStepOverChannel
+ #labelImage: #(#ResourceRetriever nil #upIcon)
)
#(#MenuItem
- #'label:' 'Move In'
- #'isButton:' true
- #'value:' #doStepIn
- #'activeHelpKey:' #editMoveIn
- #'enabled:' #canStepInChannel
- #'labelImage:' #(#ResourceRetriever nil #downRightIcon)
+ #label: 'Move Down'
+ #isButton: true
+ #value: #doStepDown
+ #activeHelpKey: #editMoveDown
+ #enabled: #canStepOverChannel
+ #labelImage: #(#ResourceRetriever nil #downIcon)
)
#(#MenuItem
- #'label:' 'Move Out'
- #'isButton:' true
- #'value:' #doStepOut
- #'activeHelpKey:' #editMoveOut
- #'enabled:' #canStepOutChannel
- #'labelImage:' #(#ResourceRetriever nil #leftDownIcon)
+ #label: 'Move In'
+ #isButton: true
+ #value: #doStepIn
+ #activeHelpKey: #editMoveIn
+ #enabled: #canStepInChannel
+ #labelImage: #(#ResourceRetriever nil #downRightIcon)
+ )
+ #(#MenuItem
+ #label: 'Move Out'
+ #isButton: true
+ #value: #doStepOut
+ #activeHelpKey: #editMoveOut
+ #enabled: #canStepOutChannel
+ #labelImage: #(#ResourceRetriever nil #leftDownIcon)
)
) nil
nil
@@ -621,92 +643,39 @@
aStream cr.
! !
-!HierarchicalListEditor class methodsFor:'resources'!
-
-createChildIcon
- "Generated by the Image Editor"
- "
- ImageEditor openOnClass:self andSelector:#createChildIcon
- "
-
- <resource: #image>
-
- ^Icon
- constantNamed:#'HierarchicalListEditor createChildIcon'
- ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@AUUUUP@@A????2@@A????2 @A????0@@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A<3L308@A33L33H@A30L33H@A33L33H@A<3L008@A?????8@C*****(@@@@@@@@@'); colorMap:(((Array new:4) at:1 put:((Color black)); at:2 put:((Color white)); at:3 put:((Color grey:49.9962)); at:4 put:((Color grey:66.9978)); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@_??@_?? _??0_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8'); yourself); yourself]!
-
-createSisterIcon
- "Generated by the Image Editor"
- "
- ImageEditor openOnClass:self andSelector:#createSisterIcon
- "
-
- <resource: #image>
-
- ^Icon
- constantNamed:#'HierarchicalListEditor createSisterIcon'
- ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@AUUUUP@@A????2@@A????2 @A????0@@A?????8@A?????8@A?????8@A<L<O?8@A3<3??8@A<<<<C8@A?L?O?8@A0<0??8@A?????8@A0LCC?8@A<<?L?8@A<<CC?8@A<<?L?8@A<<CL?8@A?????8@C*****(@@@@@@@@@'); colorMap:(((Array new:4) at:1 put:((Color black)); at:2 put:((Color white)); at:3 put:((Color grey:49.9962)); at:4 put:((Color grey:66.9978)); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@_??@_?? _??0_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8'); yourself); yourself]! !
-
-!HierarchicalListEditor methodsFor:'accessing'!
-
-didInstall
- "returns true if spec was installed by operator"
-
- ^didInstall ? false
-!
-
-selectorName
- "returns current spec. selector"
-
- ^specSelector
-! !
-
!HierarchicalListEditor methodsFor:'aspects'!
canCreateChildChannel
- "automatically generated by UIPainter ..."
^builder booleanValueAspectFor:#canCreateChildChannel
!
canCreateSisterChannel
- "automatically generated by UIPainter ..."
^builder booleanValueAspectFor:#canCreateSisterChannel
!
canStepInChannel
- "automatically generated by UIPainter ..."
^builder booleanValueAspectFor:#canStepInChannel
!
canStepOutChannel
- "automatically generated by UIPainter ..."
^builder booleanValueAspectFor:#canStepOutChannel
!
canStepOverChannel
- "automatically generated by UIPainter ..."
^builder booleanValueAspectFor:#canStepOverChannel
!
-hasValidClass
- "automatically generated by UIPainter ..."
-
- ^builder booleanValueAspectFor:#hasValidClass
-
-!
-
itemName
- "automatically generated by UIPainter ..."
|holder|
@@ -718,7 +687,6 @@
!
itemValue
- "automatically generated by UIPainter ..."
|holder|
@@ -730,60 +698,85 @@
!
treeView
- "automatically generated by UIPainter ..."
^treeView
! !
-!HierarchicalListEditor methodsFor:'change & update'!
+!HierarchicalListEditor methodsFor:'building'!
+
+buildFromClass:aClass andSelector:aSelector
+ "rebuild window from a class and selector"
+
+ |cls sel anchor|
-update:something with:aParameter from:someObject
- "one of my models changed"
+ cls := self resolveName:aClass.
+ specSelector := nil.
- self valueOfEnablingCommitButtons value: true
-! !
+ aSelector size ~~ 0
+ ifTrue:
+ [
+ sel := aSelector asString withoutSeparators.
+ sel size ~~ 0 ifTrue:[specSelector := sel asSymbol]
+ ].
+ treeView selection:nil.
-!HierarchicalListEditor methodsFor:'help'!
+ (specSelector notNil and:[cls notNil])
+ ifTrue:
+ [
+ (cls respondsTo:specSelector)
+ ifTrue:
+ [
+ anchor := cls perform:specSelector.
+ anchor isArray ifTrue:[anchor := anchor decodeAsLiteralArray]
+ ].
+ ].
+ anchor notNil
+ ifTrue: [anchor expand. treeView root:anchor]
+ ifFalse: [treeView root isNil ifTrue: [self buildRoot]].
-defaultInfoLabel
+ treeView selection: 1.
- specClass isNil ifTrue: [^'No hierarchical list class defined'].
- ^specClass name, ' >> ', specSelector printString
+ self updateHistory.
+ self updateInfoLabel.
+
+
+
+!
+
+buildFromListSpec: aListSpec
+ treeView root: aListSpec
+
+!
+
+buildRoot
+ "build just a root"
+
+ treeView root:(TreeItem name:'Root' contents:#Anchor).
+ treeView selection:1.
! !
!HierarchicalListEditor methodsFor:'private'!
-checkMenuItemModified
- "check item modification"
+getDepthAndSistersNumberOfNode: aNode onParentNode: aParentNode
+ "return depth of selected node"
+
+ |parent childNode depthAndSistersNumbers str|
- self valueOfEnablingCommitButtons value
- ifTrue:
+ depthAndSistersNumbers := OrderedCollection new.
+ childNode := aNode.
+ parent := aParentNode.
+ [parent notNil]
+ whileTrue:
[
- ((YesNoBox title:'Item was modified!!\Save it?\' withCRs)
- noText:'No';
- yesText:'Yes';
- showAtPointer;
- accepted) ifFalse: [self valueOfEnablingCommitButtons value: false. ^true].
- self accept
+ depthAndSistersNumbers add: (parent children indexOf: childNode).
+ childNode := parent.
+ parent := parent parent.
].
- ^true
-!
-
-checkModified
- "check menu modification
- "
- isModified
- ifTrue:
- [
- ((YesNoBox title:'Hierarchical list was modified!!')
- noText:'Cancel';
- yesText:'Waste it and proceed';
- showAtPointer;
- accepted) ifFalse: [^false].
- isModified := false
- ].
- ^true
+ depthAndSistersNumbers removeFirst; addFirst: aParentNode children size.
+ str := ''.
+ depthAndSistersNumbers reverseDo: [:n| str := str, n printString, '.'].
+ ^str copyFrom: 1 to: str size - 1
!
newItem
@@ -802,7 +795,7 @@
(node := treeView selectedNode) notNil
ifTrue:
[
- (builder componentAt: #specView) beVisible.
+ (builder componentAt: #SpecView) beVisible.
chnChild := true.
(parent := node parent) notNil
ifTrue:
@@ -815,7 +808,7 @@
]
ifFalse:
[
- (builder componentAt: #specView) beInvisible
+ (builder componentAt: #SpecView) beInvisible
].
self canCreateChildChannel value:chnChild.
self canCreateSisterChannel value:chnSister.
@@ -823,7 +816,13 @@
self canStepOutChannel value:chnStepOut.
self canStepInChannel value:chnStepIn.
+ self valueOfCanCut value: (treeView selection notNil
+ ifTrue:[(treeView isInSelection:1) not]
+ ifFalse: [false]).
+ self valueOfCanCopy value: self valueOfCanCut value.
+
+ self valueOfCanPaste value: (self class clipboard notNil and:[treeView selectedNode notNil]).
!
updateInputFields
@@ -845,102 +844,8 @@
self valueOfEnablingCommitButtons value: false
! !
-!HierarchicalListEditor methodsFor:'queries'!
-
-canChangeClassName
- "returns true if current class could be changed which is dependent on
- the mode: standalone or started by UIPainter"
-
- ^masterApplication isNil
-!
-
-canCopy
- "returns true if any selection exists"
-
- ^treeView selection notNil
-!
-
-canCut
- "returns true if any selection exists and not includes
- the anchor (first element into list)."
-
- treeView selection notNil ifTrue:[^(treeView isInSelection:1) not].
- ^false
-!
-
-canPaste
- "returns true if something to be paste exists and a
- single selection exists"
-
- ^CopyBuffer notNil and:[treeView selectedNode notNil]
-!
-
-hasValidMethodSelector
- "returns true if the class and the instance selector defined
- allready exists."
-
- (specSelector notNil and:[self hasValidClass])
- ifTrue:
- [
- ^(specClass compiledMethodAt:specSelector) notNil
- ].
- ^false
-!
-
-hasValidSpecSelector
- "returns true if the class and the class selector defined
- allready exists."
-
- (specSelector notNil and:[self hasValidClass])
- ifTrue:
- [
- ^(specClass class compiledMethodAt:specSelector) notNil
- ].
- ^false
-! !
-
!HierarchicalListEditor methodsFor:'startup / release'!
-buildFrom:aClass andSelector:aSelector
- "rebuild window from a class and selector"
-
- |sel anchor|
-
- specClass := self resolveName:aClass.
- specSelector := nil.
-
- aSelector size ~~ 0
- ifTrue:
- [
- sel := aSelector asString withoutSeparators.
- sel size ~~ 0 ifTrue:[specSelector := sel asSymbol]
- ].
- treeView selection:nil.
-
- (specSelector notNil and:[specClass notNil])
- ifTrue:
- [
- (specClass respondsTo:specSelector)
- ifTrue:
- [
- anchor := specClass perform:specSelector.
- anchor isArray ifTrue:[anchor := anchor decodeAsLiteralArray]
- ].
- self hasValidClass value: true
- ].
- anchor notNil
- ifTrue: [anchor expand. treeView root:anchor]
- ifFalse:[self doNew]
-!
-
-closeRequest
- "close request"
-
- (self checkMenuItemModified and: [self checkModified]) ifTrue: [super closeRequest]
-
-
-!
-
initialize
"setup default values"
@@ -951,40 +856,14 @@
treeView showDirectoryIndicator: true.
treeView showDirectoryIndicatorForRoot: false.
treeView action:[:aNr| self updateChannels. self updateInputFields].
- treeView selectConditionBlock: [:i|self checkMenuItemModified].
+ treeView selectConditionBlock: [:i|self askForItemModification].
treeView validateDoubleClickBlock: [:node| node ~~ treeView model list first].
!
-openModalOnClass:aClass andSelector:aSelector
- "open modal on class and selector"
-
- specClass := Association key:aClass value:aSelector.
- super openInterfaceModal.
-
-
-!
-
-openOnClass:aClass andSelector:aSelector
- "open on class and selector"
-
- specClass := Association key:aClass value:aSelector.
- super openInterface.
+openModalOnTreeItem: aTreeItem
+ "build a tree from aTreeItem and open it modal"
-!
-
-postBuildWith:builder
- "setup view"
-
- |cls sel|
-
- specClass isAssociation ifTrue:[
- cls := specClass key.
- sel := specClass value.
- ].
- self buildFrom:cls andSelector:sel.
-
- isModified := false
-
+ super openModalOnListSpec: aTreeItem
! !
!HierarchicalListEditor methodsFor:'user actions'!
@@ -1002,7 +881,7 @@
node contents: self itemValue value.
treeView redrawLine:index.
].
- isModified := true.
+ modified := true.
self valueOfEnablingCommitButtons value: false
!
@@ -1011,22 +890,15 @@
self updateInputFields.
- isModified := false.
+ modified := false.
self valueOfEnablingCommitButtons value: false
!
-doBrowse
- "open a system browser"
-
- SystemBrowser openInClass: specClass class selector: specSelector
-
-!
-
doCopy
"copy current selected nodes into copy buffer"
- CopyBuffer := OrderedCollection new.
- treeView selectedNodesDo:[:aNode| CopyBuffer add: aNode copy]
+ self class clipboard: OrderedCollection new.
+ treeView selectedNodesDo:[:aNode| self class clipboard add: aNode copy]
!
@@ -1035,7 +907,7 @@
|node newItem|
- ((node := treeView selectedNode) notNil and: [self checkMenuItemModified])
+ ((node := treeView selectedNode) notNil and: [self askForItemModification])
ifTrue:
[
treeView model add: (newItem := self newItem) afterIndex: node children size below:node.
@@ -1043,7 +915,7 @@
treeView selectedNodeExpand:true.
treeView selectNode: newItem.
self updateChannels.
- isModified := true
+ modified := true
]
!
@@ -1052,7 +924,7 @@
"
|node newItem|
- ((node := treeView selectedNode) notNil and: [self checkMenuItemModified])
+ ((node := treeView selectedNode) notNil and: [self askForItemModification])
ifTrue:
[
newItem := self newItem.
@@ -1063,7 +935,7 @@
newItem name: 'Child ', (self getDepthAndSistersNumberOfNode: newItem onParentNode: node parent).
treeView selectNode: newItem.
self updateChannels.
- isModified := true
+ modified := true
]
!
@@ -1071,7 +943,7 @@
"cut current selected nodes"
|selection|
- (treeView hasSelection and: [self checkMenuItemModified])
+ (treeView hasSelection and: [self askForItemModification])
ifTrue:
[
self doCopy.
@@ -1079,79 +951,90 @@
treeView selectedNodesRemove.
treeView selection: selection first - 1.
self updateChannels.
- isModified := true
+ modified := true
+ ]
+!
+
+doDelete
+ "delete current selected nodes"
+
+ |selection|
+ (treeView hasSelection and: [self askForItemModification])
+ ifTrue:
+ [
+ selection := treeView selection asSortedCollection.
+ treeView selectedNodesRemove.
+ treeView selection: selection first - 1.
+ self updateChannels.
+ modified := true
]
!
-doDefineClass
- "define class and selector"
-
- |sel cls bindings accepted|
-
- accepted := true.
- bindings := IdentityDictionary new.
+doNew
+ "remove all items; restart"
- specClass notNil ifTrue:[cls := specClass name asString]
- ifFalse:[cls := ''].
-
- specSelector notNil ifTrue:[sel := specSelector asString]
- ifFalse:[sel := ''].
-
- bindings at:#specSelectorChannel put: sel asValue.
- bindings at:#specClassChannel put: cls asValue.
-
- [accepted]
- whileTrue:
+ self askForModification
+ ifTrue:
[
- (accepted := self openDialogInterface:#classAndMethodSpec withBindings:bindings)
- ifTrue:
- [
- (cls := self resolveName:(bindings at:#specClassChannel) value) notNil
- ifTrue:
- [
- (sel := (bindings at:#specSelectorChannel) value withoutSeparators) size ~~ 0
- ifTrue:
- [
- specClass := cls.
- specSelector := sel asSymbol.
- self hasValidClass value: true.
- isModified := true.
- self updateInfoLabel.
- ^self
- ]
- ]
- ]
+ self isStandAlone ifTrue: [specClass := specSelector := nil].
+ self buildRoot
]
+
+
!
-doInstall
+doPaste
+ "paste after current selected item"
+
+ self askForItemModification
+ ifTrue:
+ [
+ |copiedNode|
+ self class clipboard do:
+ [:node|
+ copiedNode := node copy.
+ treeView selectedNodeAdd: copiedNode.
+ treeView selectNode: copiedNode.
+ ].
+ self updateChannels.
+ modified := true
+ ]
+!
+
+doReload
+ "reload spec from current class and selector"
+
+ self buildFrom:specClass andSelector:specSelector
+
+!
+
+doSave
"install code"
- |code spec category mthd stream|
+ |cls code spec category mthd stream|
(specClass notNil and:[specSelector notNil])
ifFalse:
[
- ^self information:'No valid class and method defined!!'
+ ^self doSaveAs
].
+ cls := self resolveName: specClass.
spec := (treeView nodeAtIndex:1) literalArrayEncoding.
stream := WriteStream on:String new.
self class prettyPrintArray:spec on:stream indent:4.
spec := stream contents.
- category := 'interface specs'.
- didInstall := true.
- isModified := false.
+ category := 'list specs'.
- (mthd := specClass class compiledMethodAt:specSelector) notNil
+ (mthd := cls class compiledMethodAt:specSelector) notNil
ifTrue:
[
category := mthd category
].
code := Character excla asString
- , specClass name , ' class methodsFor:' , category storeString
+ , cls name , ' class methodsFor:' , category storeString
, Character excla asString , '\\'
, specSelector , '\'
@@ -1159,7 +1042,7 @@
, ' "do not manually edit this - the builder may not be able to\'
, ' handle the specification if its corrupted."\\'
, ' "\'
- , ' HierarchicalListEditor new openOnClass:' , specClass name , ' andSelector:#' , specSelector , '\'
+ , ' HierarchicalListEditor openOnClass:' , cls name , ' andSelector:#' , specSelector , '\'
, ' "\'.
code := code
@@ -1176,60 +1059,9 @@
code := code withCRs.
(ReadStream on:code) fileIn.
- (specClass compiledMethodAt:specSelector) isNil
- ifTrue:
- [
- category := 'aspects'.
-
- code := Character excla asString
- , specClass name , ' methodsFor:' , category storeString
- , Character excla asString , '\\'
-
- , specSelector , '\'
- , ' "this window spec was automatically generated by the ST/X HierarchicalListEditor"\\'
- , ' ^ self class ', specSelector
- , '\'
- , Character excla asString
- , ' '
- , Character excla asString
- , '\\'.
-
- code := code withCRs.
- (ReadStream on:code) fileIn
- ]
-
-
-!
-
-doNew
- "remove all items; restart"
-
- treeView root:(TreeItem name:'Root' contents:#anchor).
- treeView selection:1.
- isModified := true.
-
-
-
-!
-
-doPaste
- "paste after current selected item"
-
- self checkMenuItemModified
- ifTrue:
- [
- treeView selectedNodeAdd:CopyBuffer.
- CopyBuffer isCollection ifFalse: [treeView selectNode: CopyBuffer] ifTrue: [treeView selection: (CopyBuffer collect: [:node| treeView indexOfNode: node])].
- self updateChannels.
- isModified := true
- ]
-!
-
-doReload
- "reload spec from current class and selector"
-
- self buildFrom:specClass andSelector:specSelector
-
+ self updateHistory.
+ hasSaved := true.
+ modified := false.
!
doStepDown
@@ -1237,7 +1069,7 @@
treeView selectedNodeChangeSequenceOrder:1.
self updateChannels.
- isModified := true
+ modified := true
!
@@ -1246,7 +1078,7 @@
treeView selectedNodeBecomeChildOfNext.
self updateChannels.
- isModified := true
+ modified := true
@@ -1257,7 +1089,7 @@
treeView selectedNodeBecomeSisterOfParent.
self updateChannels.
- isModified := true
+ modified := true
@@ -1268,31 +1100,10 @@
treeView selectedNodeChangeSequenceOrder:-1.
self updateChannels.
- isModified := true
+ modified := true
-!
-
-getDepthAndSistersNumberOfNode: aNode onParentNode: aParentNode
- "return depth of selected node"
-
- |parent childNode depthAndSistersNumbers str|
-
- depthAndSistersNumbers := OrderedCollection new.
- childNode := aNode.
- parent := aParentNode.
- [parent notNil]
- whileTrue:
- [
- depthAndSistersNumbers add: (parent children indexOf: childNode).
- childNode := parent.
- parent := parent parent.
- ].
- depthAndSistersNumbers removeFirst; addFirst: aParentNode children size.
- str := ''.
- depthAndSistersNumbers reverseDo: [:n| str := str, n printString, '.'].
- ^str copyFrom: 1 to: str size - 1
! !
!HierarchicalListEditor class methodsFor:'documentation'!