AppModel.st
author claus
Sat, 25 Mar 1995 23:11:46 +0100
changeset 52 6dc870beba69
parent 50 53bc56e07e8f
child 57 3984019e8f5f
permissions -rw-r--r--
*** empty log message ***

"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

'From Smalltalk/X, Version:2.10.5 on 24-mar-1995 at 9:31:53 am'!

Model subclass:#ApplicationModel
	 instanceVariableNames:'builder resources'
	 classVariableNames:''
	 poolDictionaries:''
	 category:'Interface-Framework'
!

ApplicationModel class instanceVariableNames:'ClassResources'!

!ApplicationModel class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

version
"
$Header: /cvs/stx/stx/libview2/Attic/AppModel.st,v 1.2 1995-03-25 22:11:46 claus Exp $
"
!

documentation
"
    Since many ST-80 classes are subclasses of ApplicationModel, this class
    is provided here to allow easier porting of ST-80 code.
    It does not (currently) provide much functionality; therefore, manual
    changes have to be made to get those applications to run under ST/X.
    (but at least, this enables you to fileIn that code)

    The classResources have been put into this class to allow ST/X
    view code to migrate smoothly into ApplicationModels.

    Instance variables:
	resources    ResourcePack       language string translation

	builder      ?                  dont know what that is used for yet,
					some subclasses (see manchester goodies)
					depend on thise being there.
"
! !

!ApplicationModel class methodsFor:'initialization'!

initialize 
    self == ApplicationModel ifTrue:[
	Smalltalk addDependent:self
    ]

    "
     ApplicationModel initialize
    "
! !

!ApplicationModel class methodsFor:'instance creation'!

new
    ^ super new initialize
! !

!ApplicationModel class methodsFor:'startup'!

open
    self subclassResponsibility
! !

!ApplicationModel class methodsFor:'change & update'!

update:something
    something == #Language ifTrue:[
	"flush resources on language changes"
	self flushAllClassResources
    ]
! !

!ApplicationModel class methodsFor:'resources'!

classResources
    "if not already loaded, get the classes resourcePack
     and return it"

    ClassResources isNil ifTrue:[
	ClassResources := ResourcePack for:self.
    ].
    ^ ClassResources
!

classResources:aResourcePack
    "allow setting of the classResources"

    ClassResources := aResourcePack
!

flushAllClassResources
    "flush all classes resource translations.
     Needed after a resource file / language setting has changed."

    ResourcePack flushCachedResourcePacks.
    self flushClassResources.
    self allSubclassesDo:[:aClass |
	aClass flushClassResources.
    ]
!

flushClassResources
    "flush classes resource string translations.
     Needed whenever a resource file / language setting has changed"

    ClassResources := nil.
! !

!ApplicationModel methodsFor:'initialization'!

initialize
    super initialize.
    resources := self class classResources.
! !