UISpecificationTool.st
changeset 172 10e8e0510baa
parent 164 1bc26edd0d3e
child 294 65cb680c74e4
--- a/UISpecificationTool.st	Sat Jun 21 17:04:35 1997 +0200
+++ b/UISpecificationTool.st	Sat Jun 21 17:06:18 1997 +0200
@@ -14,7 +14,7 @@
 
 
 ApplicationModel subclass:#UISpecificationTool
-	instanceVariableNames:'modifiedHolder aspects specClass specEdited specChannel'
+	instanceVariableNames:'modifiedHolder aspects specification selection specChannel'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Interface-UIPainter'
@@ -53,6 +53,27 @@
 "
 ! !
 
+!UISpecificationTool class methodsFor:'help specs'!
+
+helpSpec
+    "return a dictionary filled with helpKey -> helptext associations.
+     These are used by the activeHelp tool.
+    "
+  ^ super helpSpec addPairsFrom:#(
+
+#maxChars
+'set the maximum number of
+characters that are allowed
+in the editfield.'
+
+#id
+'enter the name of the field here. 
+This ID can be used by the application 
+to access components, using #componentAt:<key>'
+
+)
+! !
+
 !UISpecificationTool class methodsFor:'interface specs'!
 
 windowSpec
@@ -94,6 +115,41 @@
 
 !UISpecificationTool methodsFor:'accessing'!
 
+specification
+    "gets current edit specification
+    "
+    ^ specification
+
+
+!
+
+specification:aSpec
+    "sets current edit specification
+    "
+    aSpec isNil ifTrue:[
+        specChannel   := nil.
+        specification := nil.
+        aspects       := nil.
+    ] ifFalse:[
+        specification class == aSpec class ifTrue:[
+            specification := aSpec.
+          ^ specChannel value:specification.
+        ].
+        specification  := aSpec.
+        aspects        := IdentityDictionary new.
+        specChannel    := specification asValue.
+        specification class addBindingsTo:aspects for:specification channel:specChannel.
+        aspects do:[:el| el addDependent:self ].
+    ].
+
+    selection notNil ifTrue:[
+        (builder componentAt:#Frame) destroySubViews.
+        selection := nil.
+    ].
+! !
+
+!UISpecificationTool methodsFor:'accessing channels'!
+
 modifiedHolder:aValueHolder
     "set the value holder set to true in case of modifying attributes
     "
@@ -105,16 +161,6 @@
         modifiedHolder addDependent:self.
     ].
 
-!
-
-update
-    "reload specification
-    "
-    specChannel notNil ifTrue:[
-        specChannel value:specEdited.
-    ]
-
-
 ! !
 
 !UISpecificationTool methodsFor:'bindings'!
@@ -127,43 +173,20 @@
     ].
     ^ super aspectFor:aKey
 
-!
+! !
+
+!UISpecificationTool methodsFor:'change & update'!
 
-specEdited
-    "gets current edit specification
+update
+    "reload specification
     "
-    ^ specEdited
+    specChannel notNil ifTrue:[
+        specChannel value:specification.
+    ]
 
 
 !
 
-specEdited:aSpec
-    "sets current edit specification
-    "
-    aSpec isNil ifTrue:[
-        specChannel := nil.
-        specEdited  := nil.
-        aspects     := nil.
-    ] ifFalse:[
-        specEdited class == aSpec class ifTrue:[
-            specEdited := aSpec.
-          ^ specChannel value:specEdited.
-        ].
-        specEdited  := aSpec.
-        aspects     := IdentityDictionary new.
-        specChannel := specEdited asValue.
-        specEdited class addBindingsTo:aspects for:specEdited channel:specChannel.
-        aspects do:[:el| el addDependent:self ].
-    ].
-
-    specClass notNil ifTrue:[
-        (builder componentAt:#Frame) destroySubViews.
-        specClass := nil.
-    ].
-! !
-
-!UISpecificationTool methodsFor:'change & update'!
-
 update:something with:someArgument from:someone
     "any attribute changed its state in the current specification
     "
@@ -179,18 +202,20 @@
 !UISpecificationTool methodsFor:'selection'!
 
 selection:something
+    "selection changed
+    "
     |slices idx spec frame|
 
-    specEdited notNil ifTrue:[
-        slices := specEdited class slices.
+    specification notNil ifTrue:[
+        slices := specification class slices.
         idx:= slices findFirst:[:aSlice| aSlice first = something ].
 
         idx ~~ 0 ifTrue:[
-            spec := specEdited class perform:((slices at:idx) last).
+            spec := specification class perform:((slices at:idx) last).
         ].
     ].
 
-    spec ~= specClass ifTrue:[
+    spec ~= selection ifTrue:[
         frame := builder componentAt:#Frame.
         frame destroySubViews.
 
@@ -200,7 +225,7 @@
             frame realizeAllSubViews.
         ]
     ].
-    specClass := spec.
+    selection := spec.
 ! !
 
 !UISpecificationTool class methodsFor:'documentation'!