ApplicationModel.st
changeset 52 6dc870beba69
parent 50 53bc56e07e8f
child 57 3984019e8f5f
equal deleted inserted replaced
51:ac84315b8181 52:6dc870beba69
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
    12 
       
    13 'From Smalltalk/X, Version:2.10.5 on 24-mar-1995 at 9:31:53 am'!
       
    14 
    13 Model subclass:#ApplicationModel
    15 Model subclass:#ApplicationModel
    14 	 instanceVariableNames:'builder'
    16 	 instanceVariableNames:'builder resources'
    15 	 classVariableNames:''
    17 	 classVariableNames:''
    16 	 poolDictionaries:''
    18 	 poolDictionaries:''
    17 	 category:'ST80-Compatibility'
    19 	 category:'Interface-Framework'
    18 !
    20 !
       
    21 
       
    22 ApplicationModel class instanceVariableNames:'ClassResources'!
    19 
    23 
    20 !ApplicationModel class methodsFor:'documentation'!
    24 !ApplicationModel class methodsFor:'documentation'!
    21 
    25 
    22 copyright
    26 copyright
    23 "
    27 "
    33 "
    37 "
    34 !
    38 !
    35 
    39 
    36 version
    40 version
    37 "
    41 "
    38 $Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.1 1995-03-23 16:51:31 claus Exp $
    42 $Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.2 1995-03-25 22:11:46 claus Exp $
    39 "
    43 "
    40 !
    44 !
    41 
    45 
    42 documentation
    46 documentation
    43 "
    47 "
    44     Since many ST-80 classes are subclasses of ApplicationModel, this class
    48     Since many ST-80 classes are subclasses of ApplicationModel, this class
    45     is provided here to allow easier porting of ST-80 code.
    49     is provided here to allow easier porting of ST-80 code.
    46     It does not (currently) provide any functionality; therefore, manual
    50     It does not (currently) provide much functionality; therefore, manual
    47     changes have to be made to get those applications to run under ST/X.
    51     changes have to be made to get those applications to run under ST/X.
    48     (but at least, this enables you to fileIn that code)
    52     (but at least, this enables you to fileIn that code)
    49 
    53 
       
    54     The classResources have been put into this class to allow ST/X
       
    55     view code to migrate smoothly into ApplicationModels.
       
    56 
    50     Instance variables:
    57     Instance variables:
    51 	builder      ?          dont know what that is used for yet,
    58 	resources    ResourcePack       language string translation
    52 				some subclasses (see manchester goodies)
    59 
    53 				depend on thise being there.
    60 	builder      ?                  dont know what that is used for yet,
       
    61 					some subclasses (see manchester goodies)
       
    62 					depend on thise being there.
    54 "
    63 "
       
    64 ! !
       
    65 
       
    66 !ApplicationModel class methodsFor:'initialization'!
       
    67 
       
    68 initialize 
       
    69     self == ApplicationModel ifTrue:[
       
    70 	Smalltalk addDependent:self
       
    71     ]
       
    72 
       
    73     "
       
    74      ApplicationModel initialize
       
    75     "
       
    76 ! !
       
    77 
       
    78 !ApplicationModel class methodsFor:'instance creation'!
       
    79 
       
    80 new
       
    81     ^ super new initialize
    55 ! !
    82 ! !
    56 
    83 
    57 !ApplicationModel class methodsFor:'startup'!
    84 !ApplicationModel class methodsFor:'startup'!
    58 
    85 
    59 open
    86 open
    60     self subclassResponsibility
    87     self subclassResponsibility
    61 ! !
    88 ! !
       
    89 
       
    90 !ApplicationModel class methodsFor:'change & update'!
       
    91 
       
    92 update:something
       
    93     something == #Language ifTrue:[
       
    94 	"flush resources on language changes"
       
    95 	self flushAllClassResources
       
    96     ]
       
    97 ! !
       
    98 
       
    99 !ApplicationModel class methodsFor:'resources'!
       
   100 
       
   101 classResources
       
   102     "if not already loaded, get the classes resourcePack
       
   103      and return it"
       
   104 
       
   105     ClassResources isNil ifTrue:[
       
   106 	ClassResources := ResourcePack for:self.
       
   107     ].
       
   108     ^ ClassResources
       
   109 !
       
   110 
       
   111 classResources:aResourcePack
       
   112     "allow setting of the classResources"
       
   113 
       
   114     ClassResources := aResourcePack
       
   115 !
       
   116 
       
   117 flushAllClassResources
       
   118     "flush all classes resource translations.
       
   119      Needed after a resource file / language setting has changed."
       
   120 
       
   121     ResourcePack flushCachedResourcePacks.
       
   122     self flushClassResources.
       
   123     self allSubclassesDo:[:aClass |
       
   124 	aClass flushClassResources.
       
   125     ]
       
   126 !
       
   127 
       
   128 flushClassResources
       
   129     "flush classes resource string translations.
       
   130      Needed whenever a resource file / language setting has changed"
       
   131 
       
   132     ClassResources := nil.
       
   133 ! !
       
   134 
       
   135 !ApplicationModel methodsFor:'initialization'!
       
   136 
       
   137 initialize
       
   138     super initialize.
       
   139     resources := self class classResources.
       
   140 ! !