--- a/ResourceSpecEditor.st Mon Apr 06 10:35:20 1998 +0200
+++ b/ResourceSpecEditor.st Wed Apr 08 15:29:02 1998 +0200
@@ -1,5 +1,5 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
+ COPYRIGHT (c) 1997-1998 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
@@ -15,7 +15,7 @@
ToolApplicationModel subclass:#ResourceSpecEditor
- instanceVariableNames:'modified aspects specClass specSelector tabSelection hasSaved'
+ instanceVariableNames:'specClass specSelector aspects modified hasSaved tabSelection'
classVariableNames:''
poolDictionaries:''
category:'Interface-Framework'
@@ -25,7 +25,7 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
+ COPYRIGHT (c) 1997-1998 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
@@ -43,8 +43,24 @@
documentation
"
- Abstract super class for the MenuEditor, DataSetBuilder,
- HierarchicalListEditor, and the TabListEditor.
+ Abstract super class for the MenuEditor, HierarchicalListEditor,
+ and the TabListEditor.
+ It provides common behavior for initializing, loading, saving, and
+ asking for modifications of the resource specs (#menu, #hierarchicalList,
+ #tabList) for the concrete subclasses.
+
+ [instance variables:]
+ specClass <Symbol> class implementing the resource spec
+ specSelector <Symbol> selector returning the resource spec
+ aspects <IdentityDictionary> dictionary with the attributes of the resource spec
+ modified <Boolean> flag whether the resource spec was modified
+ hasSaved <Boolean> flag whether the resource spec was saved
+ tabSelection <Integer> index of the tab selection
+
+ [see also:]
+ MenuEditor
+ HierarchicalListEditor
+ TabListEditor
[author:]
Thomas Zwick, eXept Software AG
@@ -54,14 +70,14 @@
!ResourceSpecEditor class methodsFor:'instance creation'!
openModalOnClass:aClass andSelector:aSelector
- "Open modal a ListSpecEditor on aClass and aSelector"
+ "opens modal the Resource Spec Editor on aClass and aSelector"
^self new openModalOnClass:aClass andSelector:aSelector
!
openOnClass:aClass andSelector:aSelector
- "Open a ListSpecEditor on aClass and aSelector"
+ "opens the Resource Spec Editor on aClass and aSelector"
^self new openOnClass:aClass andSelector:aSelector
! !
@@ -69,6 +85,7 @@
!ResourceSpecEditor class methodsFor:'accessing'!
codeGenerationComment
+ "returns a comment for the method code generated by myself"
^self codeGenerationCommentForClass: self
@@ -78,6 +95,7 @@
!
codeGenerationCommentForClass: aClass
+ "returns a comment for the method code generated by aClass"
^' "This resource specification was automatically generated\',
' by the ', aClass name, ' of ST/X."\\',
@@ -92,6 +110,8 @@
!
resourceType
+ "returns the type of resource of the method generated by the Resource Spec Editor;
+ concrete subclasses has to reimplement this method"
^self subclassResponsibility
! !
@@ -99,14 +119,27 @@
!ResourceSpecEditor class methodsFor:'aspects'!
aspects
- "get the aspects for the attributes of the list spec components"
+ "returns the aspects for the attributes of the resource spec components;
+ concrete subclasses might reimplement this method in order to return an array"
^#()
! !
+!ResourceSpecEditor class methodsFor:'queries'!
+
+isVisualStartable
+ "returns whether this application class can be started via #open"
+
+ self == ResourceSpecEditor ifTrue:[^false].
+ ^super isVisualStartable
+
+! !
+
!ResourceSpecEditor class methodsFor:'startup / release'!
preSnapshot
+ "before a snapshot; updates the channels,
+ because the clipboard has removed"
super preSnapshot.
@@ -130,7 +163,7 @@
!
modified: aBoolean
- "set the resource spec modified as aBoolean"
+ "sets the resource spec modified as aBoolean"
modified := aBoolean
!
@@ -144,8 +177,8 @@
specClass:aClass
"sets the class (or name) where the resource spec is (or should be) implemented"
- aClass isBehavior ifTrue:[specClass := aClass name]
- ifFalse:[specClass := aClass]
+ aClass isClass ifTrue: [specClass := aClass name]
+ ifFalse:[specClass := aClass asSymbol]
!
specSelector
@@ -182,6 +215,7 @@
!
valueOfCanPaste
+ "returns whether the application can paste as value holder"
|holder|
holder := super valueOfCanPaste.
@@ -192,6 +226,7 @@
!
valueOfEnableMovingIn
+ "returns whether the selected item can move into next item as child as value holder"
^builder booleanValueAspectFor: #valueOfEnableMovingIn
@@ -200,6 +235,7 @@
!
valueOfEnableMovingOut
+ "returns whether the selected item can move out from its parent item as value holder"
^builder booleanValueAspectFor: #valueOfEnableMovingOut
@@ -208,6 +244,7 @@
!
valueOfEnableMovingUpOrDown
+ "returns whether the selected item can move up or down as value holder"
^builder booleanValueAspectFor: #valueOfEnableMovingUpOrDown
@@ -235,12 +272,14 @@
!
updateAllToolInstances
+ "updates the channels of all other instances of my class"
self allToolInstances do: [:inst| inst updateChannels]
!
updateChannels
+ "updates my channels"
self valueOfCanPaste
@@ -276,8 +315,8 @@
super initialize.
- hasSaved := modified := false.
- aspects := IdentityDictionary new.
+ hasSaved := modified := false.
+ aspects := IdentityDictionary new.
tabSelection := 0.
self class aspects do:
@@ -285,7 +324,7 @@
|holder|
aspects at:aKey put: (holder := ValueHolder new).
holder addDependent: self
- ].
+ ]
! !
!ResourceSpecEditor methodsFor:'private'!
@@ -363,7 +402,7 @@
!
updateHistory
- "if there was loaded a resource spec, it updates the history"
+ "updates the history, if there was loaded a resource spec"
|cls|
((cls := self resolveClassNamed) notNil and: [cls class implements: specSelector])
@@ -380,14 +419,14 @@
!ResourceSpecEditor methodsFor:'queries'!
hasSaved
- "return true if resource spec has saved"
+ "returns true if resource spec has saved"
^hasSaved
!
isStandAlone
- "return true if the editor was not started from another tool"
+ "returns true if the editor was not started from another tool"
^self masterApplication isNil
! !
@@ -404,6 +443,8 @@
!ResourceSpecEditor methodsFor:'startup / release'!
allButOpenInterface:aSymbol
+ "after creating the views and before opening,
+ adds myself to the instances dictionary in the settings"
super allButOpenInterface:aSymbol.
@@ -416,14 +457,14 @@
!
closeRequest
- "first ask for modification then send close request to super"
+ "asks first for modification, then sends close request to super"
self askForModification ifTrue: [super closeRequest]
!
loadFromMessage:aString
- "load a spec from class and selector"
+ "builds by evaluating aString the resource spec for editing"
(aString notNil and: [self askForModification])
ifTrue:
@@ -445,8 +486,9 @@
!
openModalOnClass:aClass andSelector:aSelector
+ "sets the specClass and specSelector and opens modal the interface"
- specClass := aClass isClass ifTrue: [aClass name] ifFalse: [aClass].
+ specClass := aClass isClass ifTrue: [aClass name] ifFalse: [aClass asSymbol].
specSelector := aSelector.
super openInterfaceModal.
@@ -454,6 +496,8 @@
!
openModalOnResourceSpec: aListSpec
+ "builds first from specClass and specSelector the resource spec for editing,
+ then opens modal the interface"
self buildFromResourceSpec: aListSpec.
@@ -462,22 +506,25 @@
!
openOnClass:aClass andSelector:aSelector
+ "sets the specClass and specSelector and opens the interface"
- specClass := aClass isClass ifTrue: [aClass name] ifFalse: [aClass].
+ specClass := aClass isClass ifTrue: [aClass name] ifFalse: [aClass asSymbol].
specSelector := aSelector.
super openInterface.
!
postOpenWith:aBuilder
+ "after opening, builds from specClass and specSelector the resource spec for editing"
super postOpenWith:aBuilder.
- self buildFromClass: specClass andSelector: specSelector.
+ self buildFromClass: specClass andSelector: specSelector
!
uninitialize
+ "uninitializes; removes myself from the instances dictionary in the settings"
super uninitialize.
@@ -488,7 +535,7 @@
!ResourceSpecEditor methodsFor:'user actions'!
accept
- "invoked by the OK button; disable the commit buttons and set modified"
+ "invoked by the OK button; disables the commit buttons and sets myself modified"
self valueOfEnablingCommitButtons value: false.
modified := true
@@ -505,7 +552,7 @@
!
doEditImage
- "opens a Image Editor on a resource retriever and icon selector"
+ "opens a Image Editor on the resource retriever and the icon selector"
|cls resourceClass resourceSelector imageResourceMessage readStream|
@@ -607,5 +654,5 @@
!ResourceSpecEditor class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/ResourceSpecEditor.st,v 1.5 1998-04-01 15:21:53 tz Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/ResourceSpecEditor.st,v 1.6 1998-04-08 13:29:02 tz Exp $'
! !