ApplicationModel.st
changeset 2977 ee3185e19167
parent 2976 c3ea42b1ab14
child 2980 b2a90134c2cd
--- a/ApplicationModel.st	Thu Dec 22 11:07:34 2011 +0100
+++ b/ApplicationModel.st	Thu Dec 22 11:18:10 2011 +0100
@@ -1568,201 +1568,6 @@
     ^ self application visualFor:aKey
 ! !
 
-!ApplicationModel methodsFor:'binding access-help'!
-
-basicFlyByHelpTextForKey:aKey
-    "flyByHelp interface: return some short help text for a key
-     key is the symbol associated with some widget or menu item.
-     Return the original (english) text; needs to be translated as per language"
-
-    |helpSpecFromBindings helpText helpSpec "resourceArgs"|
-
-    helpSpecFromBindings := self aspectFor:#helpSpec.
-    helpSpecFromBindings notNil ifTrue:[
-        helpText := helpSpecFromBindings at:aKey ifAbsent:nil.
-    ].
-    helpText isNil ifTrue:[
-        helpSpec := self flyByHelpSpec.
-        helpSpec notNil ifTrue:[
-            helpText := helpSpec at:aKey ifAbsent:nil.
-        ].
-    ].
-
-    "/ new: allow for a collection (resource-key arg1 arg2...)
-    helpText isNonByteCollection ifTrue:[
-        helpText := helpText first.
-"/        resourceArgs := helpText copyFrom:2.
-    ].
-    ^ helpText
-
-    "Modified: / 22-12-2011 / 11:06:53 / cg"
-!
-
-basicHelpTextForKey:aKey
-    "activeHelp interface: return some help text for a key
-     key is the symbol associated with some widget or menu item.
-     Return the original (english) text; needs to be translated as per language"
-
-    |helpText helpSpec "resourceArgs"|
-
-    helpSpec := self helpSpec.
-    helpSpec notNil ifTrue:[
-        helpText := helpSpec at:aKey ifAbsent:nil.
-    ].
-
-    "/ new: allow for a collection (resource-key arg1 arg2...)
-    helpText isNonByteCollection ifTrue:[
-        helpText := helpText first.
-"/        resourceArgs := helpText copyFrom:2.
-    ].
-    ^ helpText
-!
-
-flyByHelpSpec
-    "activeHelp interface: return some short help text for a widget component"
-
-    ^ self class flyByHelpSpec
-!
-
-flyByHelpTextFor:aComponent
-    "activeHelp interface: return some short help text for a widget component"
-
-    |key|
-
-    builder notNil ifTrue:[
-        (key := builder helpKeyFor:aComponent) notNil ifTrue:[
-            ^ self flyByHelpTextForKey:key
-        ]
-    ].
-    masterApplication notNil ifTrue:[
-        ^ masterApplication flyByHelpTextFor:aComponent
-    ].
-    ^ nil
-
-    "Modified: / 31.7.1998 / 23:03:10 / cg"
-!
-
-flyByHelpTextForKey:aKey
-    "flyByHelp interface: return some short help text for a key
-     key is the symbol associated with some widget or menu item.
-     (from my flyByHelpSpec); return a language variant (if available)"
-
-    |helpText translatedHelpText translatedKey|
-
-    ActiveHelp debugging ifTrue:[ Transcript showCR:'help key: ', aKey].
-
-    helpText := self basicFlyByHelpTextForKey:aKey.
-    helpText isNil ifTrue:[
-        masterApplication notNil ifTrue:[
-            "here we get an already translated helpText"
-            helpText := masterApplication flyByHelpTextForKey:aKey.
-        ].
-        helpText isNil ifTrue:[
-            "there is no help text - resolve key from resources"
-            helpText := (self translateString:aKey) withCRs.
-        ].
-        ^ helpText.
-    ].
-    "/ kludge to allow for dynamic translation by the application itself, avoiding the key translation below.
-    helpText isBlock ifTrue:[
-        ^ helpText value.
-    ].
-
-    "get the translation"
-    translatedHelpText := self translateString:helpText.
-    translatedHelpText == helpText ifTrue:[
-        "there is no translation in the resources - maybe there is one for the key?"
-        translatedKey := self translateString:aKey.
-        translatedKey ~~ aKey ifTrue:[
-             translatedHelpText := translatedKey.
-        ].
-    ].
-    ^ translatedHelpText withCRs.
-
-    "Modified: / 22-12-2011 / 10:47:39 / cg"
-!
-
-flyByHelpTextForKey:aKey row:aRowNr
-    "Special interface for DataSet - get the active help text for a specific row"
-
-    "Default: no row specific help"
-
-    ^ self flyByHelpTextForKey:aKey.
-!
-
-helpSpec
-    "activeHelp interface: return some short help text for a widget component"
-
-    ^ self class helpSpec
-!
-
-helpTextFor:aComponent
-    "activeHelp interface: return some help text for a widget component"
-
-    |key|
-
-    builder notNil ifTrue:[
-        (key := builder helpKeyFor:aComponent) notNil ifTrue:[
-            ^ self helpTextForKey:key
-        ]
-    ].
-    masterApplication notNil ifTrue:[
-        ^ masterApplication helpTextFor:aComponent
-    ].
-    ^ nil
-
-    "Modified: / 31.7.1998 / 23:03:10 / cg"
-!
-
-helpTextForKey:aKey
-    "activeHelp interface: return some help text for a key
-     key is the symbol associated with some widget or menu item.
-     (from my helpSpec); return a language variant (if available)"
-
-    |helpText translatedHelpText translatedKey|
-
-    helpText := self basicHelpTextForKey:aKey.
-    helpText isNil ifTrue:[
-        masterApplication notNil ifTrue:[
-            "here we get an already translated helpText"
-            helpText := masterApplication helpTextForKey:aKey.
-        ].
-        helpText isNil ifTrue:[
-            "there is no help text - resolve key from resources"
-            helpText := (self translateString:aKey) withCRs.
-        ].
-        ^ helpText.
-
-"/        aKey isSymbol ifFalse:[
-"/            ^ nil
-"/        ].
-"/        "/ mhmh - is this a good idea ?
-"/        "/ if someone already maps the flyByHelpTexts to the helpTexts
-"/        helpText := self flyByHelpTextForKey:aKey.
-"/        helpText notNil ifTrue:[ ^ helpText ].
-        ^ nil.
-"/        ^ self resources string:'Sorry, no help for: %1' with:aKey "/ nil
-    ].
-
-    "/ kludge to allow for dynamic translation by the application itself.
-    helpText isBlock ifTrue:[
-        ^ helpText value.
-    ].
-
-    "get the translation"
-    translatedHelpText := self translateString:helpText.
-    translatedHelpText == helpText ifTrue:[
-        "there is no translation in the resources - maybe there is one for the key?"
-        translatedKey := self translateString:aKey.
-        translatedKey ~~ aKey ifTrue:[
-             translatedHelpText := translatedKey.
-        ].
-    ].
-    ^ translatedHelpText withCRs.
-
-    "Modified: / 22-12-2011 / 11:07:03 / cg"
-! !
-
 !ApplicationModel methodsFor:'building'!
 
 allButOpen
@@ -2382,6 +2187,201 @@
     "Modified: / 31.7.1998 / 17:55:31 / cg"
 ! !
 
+!ApplicationModel methodsFor:'help texts'!
+
+basicFlyByHelpTextForKey:aKey
+    "flyByHelp interface: return some short help text for a key
+     key is the symbol associated with some widget or menu item.
+     Return the original (english) text; needs to be translated as per language"
+
+    |helpSpecFromBindings helpText helpSpec "resourceArgs"|
+
+    helpSpecFromBindings := self aspectFor:#helpSpec.
+    helpSpecFromBindings notNil ifTrue:[
+        helpText := helpSpecFromBindings at:aKey ifAbsent:nil.
+    ].
+    helpText isNil ifTrue:[
+        helpSpec := self flyByHelpSpec.
+        helpSpec notNil ifTrue:[
+            helpText := helpSpec at:aKey ifAbsent:nil.
+        ].
+    ].
+
+    "/ new: allow for a collection (resource-key arg1 arg2...)
+    helpText isNonByteCollection ifTrue:[
+        helpText := helpText first.
+"/        resourceArgs := helpText copyFrom:2.
+    ].
+    ^ helpText
+
+    "Modified: / 22-12-2011 / 11:06:53 / cg"
+!
+
+basicHelpTextForKey:aKey
+    "activeHelp interface: return some help text for a key
+     key is the symbol associated with some widget or menu item.
+     Return the original (english) text; needs to be translated as per language"
+
+    |helpText helpSpec "resourceArgs"|
+
+    helpSpec := self helpSpec.
+    helpSpec notNil ifTrue:[
+        helpText := helpSpec at:aKey ifAbsent:nil.
+    ].
+
+    "/ new: allow for a collection (resource-key arg1 arg2...)
+    helpText isNonByteCollection ifTrue:[
+        helpText := helpText first.
+"/        resourceArgs := helpText copyFrom:2.
+    ].
+    ^ helpText
+!
+
+flyByHelpSpec
+    "activeHelp interface: return some short help text for a widget component"
+
+    ^ self class flyByHelpSpec
+!
+
+flyByHelpTextFor:aComponent
+    "activeHelp interface: return some short help text for a widget component"
+
+    |key|
+
+    builder notNil ifTrue:[
+        (key := builder helpKeyFor:aComponent) notNil ifTrue:[
+            ^ self flyByHelpTextForKey:key
+        ]
+    ].
+    masterApplication notNil ifTrue:[
+        ^ masterApplication flyByHelpTextFor:aComponent
+    ].
+    ^ nil
+
+    "Modified: / 31.7.1998 / 23:03:10 / cg"
+!
+
+flyByHelpTextForKey:aKey
+    "flyByHelp interface: return some short help text for a key
+     key is the symbol associated with some widget or menu item.
+     (from my flyByHelpSpec); return a language variant (if available)"
+
+    |helpText translatedHelpText translatedKey|
+
+    ActiveHelp debugging ifTrue:[ Transcript showCR:'help key: ', aKey].
+
+    helpText := self basicFlyByHelpTextForKey:aKey.
+    helpText isNil ifTrue:[
+        masterApplication notNil ifTrue:[
+            "here we get an already translated helpText"
+            helpText := masterApplication flyByHelpTextForKey:aKey.
+        ].
+        helpText isNil ifTrue:[
+            "there is no help text - resolve key from resources"
+            helpText := (self translateString:aKey) withCRs.
+        ].
+        ^ helpText.
+    ].
+    "/ kludge to allow for dynamic translation by the application itself, avoiding the key translation below.
+    helpText isBlock ifTrue:[
+        ^ helpText value.
+    ].
+
+    "get the translation"
+    translatedHelpText := self translateString:helpText.
+    translatedHelpText == helpText ifTrue:[
+        "there is no translation in the resources - maybe there is one for the key?"
+        translatedKey := self translateString:aKey.
+        translatedKey ~~ aKey ifTrue:[
+             translatedHelpText := translatedKey.
+        ].
+    ].
+    ^ translatedHelpText withCRs.
+
+    "Modified: / 22-12-2011 / 10:47:39 / cg"
+!
+
+flyByHelpTextForKey:aKey row:aRowNr
+    "Special interface for DataSet - get the active help text for a specific row"
+
+    "Default: no row specific help"
+
+    ^ self flyByHelpTextForKey:aKey.
+!
+
+helpSpec
+    "activeHelp interface: return some short help text for a widget component"
+
+    ^ self class helpSpec
+!
+
+helpTextFor:aComponent
+    "activeHelp interface: return some help text for a widget component"
+
+    |key|
+
+    builder notNil ifTrue:[
+        (key := builder helpKeyFor:aComponent) notNil ifTrue:[
+            ^ self helpTextForKey:key
+        ]
+    ].
+    masterApplication notNil ifTrue:[
+        ^ masterApplication helpTextFor:aComponent
+    ].
+    ^ nil
+
+    "Modified: / 31.7.1998 / 23:03:10 / cg"
+!
+
+helpTextForKey:aKey
+    "activeHelp interface: return some help text for a key
+     key is the symbol associated with some widget or menu item.
+     (from my helpSpec); return a language variant (if available)"
+
+    |helpText translatedHelpText translatedKey|
+
+    helpText := self basicHelpTextForKey:aKey.
+    helpText isNil ifTrue:[
+        masterApplication notNil ifTrue:[
+            "here we get an already translated helpText"
+            helpText := masterApplication helpTextForKey:aKey.
+        ].
+        helpText isNil ifTrue:[
+            "there is no help text - resolve key from resources"
+            helpText := (self translateString:aKey) withCRs.
+        ].
+        ^ helpText.
+
+"/        aKey isSymbol ifFalse:[
+"/            ^ nil
+"/        ].
+"/        "/ mhmh - is this a good idea ?
+"/        "/ if someone already maps the flyByHelpTexts to the helpTexts
+"/        helpText := self flyByHelpTextForKey:aKey.
+"/        helpText notNil ifTrue:[ ^ helpText ].
+        ^ nil.
+"/        ^ self resources string:'Sorry, no help for: %1' with:aKey "/ nil
+    ].
+
+    "/ kludge to allow for dynamic translation by the application itself.
+    helpText isBlock ifTrue:[
+        ^ helpText value.
+    ].
+
+    "get the translation"
+    translatedHelpText := self translateString:helpText.
+    translatedHelpText == helpText ifTrue:[
+        "there is no translation in the resources - maybe there is one for the key?"
+        translatedKey := self translateString:aKey.
+        translatedKey ~~ aKey ifTrue:[
+             translatedHelpText := translatedKey.
+        ].
+    ].
+    ^ translatedHelpText withCRs.
+
+    "Modified: / 22-12-2011 / 11:07:03 / cg"
+! !
+
 !ApplicationModel methodsFor:'hooks'!
 
 aboutToOpen:whichTopView
@@ -3914,8 +3914,12 @@
 
 !ApplicationModel class methodsFor:'documentation'!
 
+version
+    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.325 2011-12-22 10:18:10 cg Exp $'
+!
+
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.324 2011-12-22 10:07:34 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.325 2011-12-22 10:18:10 cg Exp $'
 ! !
 
 ApplicationModel initialize!