ResourceRetriever.st
author tz
Wed, 28 Jan 1998 19:49:45 +0100
changeset 509 3d42fb6ec7b0
parent 476 05adf036c0ac
child 815 b2b9356a648c
permissions -rw-r--r--
removed #generateCodeFor:aClass menuSelector:aSelector
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
120
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
     1
"
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
     3
              All Rights Reserved
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
     4
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
     5
 This software is furnished under a license and may be used
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    10
 hereby transferred.
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    11
"
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    12
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    13
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    14
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    15
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    16
Object subclass:#ResourceRetriever
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    17
	instanceVariableNames:'className resourceOwner selector labelText'
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    18
	classVariableNames:''
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    19
	poolDictionaries:''
200
bae1541cda28 generate help specs moved to UIHelpTool
ca
parents: 198
diff changeset
    20
	category:'Interface-Support-UI'
120
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    21
!
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    22
399
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    23
ResourceRetriever class instanceVariableNames:'LabelResources'
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    24
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    25
"
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    26
 The following class instance variables are inherited by this class:
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    27
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    28
	Object - 
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    29
"
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    30
!
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    31
120
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    32
!ResourceRetriever class methodsFor:'documentation'!
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    33
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    34
copyright
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    35
"
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    36
 COPYRIGHT (c) 1997 by eXept Software AG
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    37
              All Rights Reserved
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    38
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    39
 This software is furnished under a license and may be used
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    40
 only in accordance with the terms of that license and with the
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    41
 inclusion of the above copyright notice.   This software may not
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    42
 be provided or otherwise made available to, or used by, any
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    43
 other person.  No title to or ownership of the software is
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    44
 hereby transferred.
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    45
"
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    46
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    47
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    48
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    49
!
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    50
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    51
documentation
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    52
"
373
ae526fcf716a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
    53
    ST80 compatibility class.
ae526fcf716a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
    54
ae526fcf716a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
    55
    The class is not completed yet and certainly not bug free.
ae526fcf716a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
    56
    Also, it is not guaranteed that all winSpecs are understood.
120
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    57
373
ae526fcf716a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
    58
    Notice: 
ae526fcf716a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
    59
        this class was implemented using protocol information
ae526fcf716a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
    60
        from alpha testers, literature and by reading public domain code
ae526fcf716a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
    61
        - it may not be complete or compatible to
ae526fcf716a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
    62
        the corresponding ST-80 class. 
ae526fcf716a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
    63
        If you encounter any incompatibilities, please forward a note 
ae526fcf716a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
    64
        describing the incompatibility verbal (i.e. no code) to the ST/X team.
120
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    65
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    66
    [author:]
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    67
        Claus Atzkern
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    68
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    69
    [see also:]
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    70
        Application
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    71
        Menu
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    72
        MenuItem
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    73
"
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    74
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    75
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    76
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    77
! !
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
    78
399
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    79
!ResourceRetriever class methodsFor:'accessing resource'!
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    80
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    81
findResourceLabel: label in: aResourceOwner
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    82
    "look for a string 
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    83
        in aResourceOwner, 
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    84
        in class of aResourceOwner,
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    85
        in resources of class of aResourceOwner,
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    86
        and finally in my label resources
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    87
    "
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    88
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    89
    aResourceOwner isNil ifTrue: [^label].
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    90
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    91
    label isSymbol
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    92
    ifTrue:
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    93
    [
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    94
        (aResourceOwner respondsTo: label)
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    95
        ifTrue:
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    96
        [           
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    97
            ^aResourceOwner perform: label
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    98
        ].
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
    99
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   100
        (aResourceOwner isClass not and: [aResourceOwner class respondsTo: label])
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   101
        ifTrue:
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   102
        [            
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   103
            ^aResourceOwner perform: label
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   104
        ].
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   105
    ].
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   106
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   107
    ((aResourceOwner isKindOf: ApplicationModel) or: 
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   108
    [aResourceOwner isKindOf: SimpleView]) 
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   109
    ifTrue:
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   110
    [
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   111
        ^aResourceOwner resources string: label
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   112
    ].
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   113
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   114
    ^self labelResources string:label
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   115
  
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   116
!
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   117
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   118
labelResources
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   119
    "if not already loaded, get the common label resourcePack
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   120
     and return it"
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   121
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   122
    LabelResources isNil ifTrue:[
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   123
        LabelResources := ResourcePack for:self.
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   124
    ].
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   125
    ^ LabelResources
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   126
! !
0822ecf56bf2 checkin from browser
tz
parents: 378
diff changeset
   127
120
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   128
!ResourceRetriever methodsFor:'accessing'!
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   129
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   130
className
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   131
    "return the value of the instance variable 'className' (automatically generated)"
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   132
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   133
    ^ className!
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   134
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   135
className:something
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   136
    "set the class which provides the resources
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   137
    "
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   138
    className     := something.
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   139
    resourceOwner := nil.
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   140
!
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   141
198
7d495c01a8a6 access methods for labelText edited
ca
parents: 120
diff changeset
   142
labelText
7d495c01a8a6 access methods for labelText edited
ca
parents: 120
diff changeset
   143
    ^ labelText
7d495c01a8a6 access methods for labelText edited
ca
parents: 120
diff changeset
   144
!
7d495c01a8a6 access methods for labelText edited
ca
parents: 120
diff changeset
   145
7d495c01a8a6 access methods for labelText edited
ca
parents: 120
diff changeset
   146
labelText:aText
7d495c01a8a6 access methods for labelText edited
ca
parents: 120
diff changeset
   147
    labelText := aText
7d495c01a8a6 access methods for labelText edited
ca
parents: 120
diff changeset
   148
!
7d495c01a8a6 access methods for labelText edited
ca
parents: 120
diff changeset
   149
120
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   150
selector
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   151
    "return the value of the instance variable 'selector' (automatically generated)"
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   152
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   153
    ^ selector!
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   154
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   155
selector:something
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   156
    "set the value of the instance variable 'selector' (automatically generated)"
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   157
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   158
    selector := something.
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   159
!
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   160
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   161
value
373
ae526fcf716a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
   162
    "returns the value assigned to resource or nil
120
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   163
    "
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   164
    |resource|
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   165
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   166
    (resource := self resource) isNil ifTrue:[
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   167
        ^ labelText
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   168
    ].
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   169
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   170
    (labelText notNil and:[resource isImage]) ifTrue:[
378
9057ea063eca use font derived from style sheet; no default Text object
ca
parents: 373
diff changeset
   171
        ^ LabelAndIcon icon:resource string:labelText
120
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   172
    ].
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   173
  ^ resource
373
ae526fcf716a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
   174
ae526fcf716a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
   175
    "Modified: / 31.10.1997 / 12:10:05 / cg"
120
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   176
! !
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   177
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   178
!ResourceRetriever methodsFor:'accessing resource'!
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   179
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   180
findGuiResourcesIn:aResourceContainer
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   181
    "setup a resource owner
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   182
    "
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   183
    className isNil ifTrue:[
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   184
        resourceOwner := aResourceContainer
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   185
    ].
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   186
!
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   187
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   188
resource
373
ae526fcf716a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
   189
    "returns a form assigned to resource or nil
120
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   190
    "
331
ca
parents: 320
diff changeset
   191
    |img cls appl|
226
07e81ce2d32f accessing a resource
ca
parents: 200
diff changeset
   192
120
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   193
    selector isNil ifTrue:[
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   194
        ^nil
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   195
    ].
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   196
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   197
    resourceOwner isNil ifTrue:[
343
8358ce37f8be checkin from browser
ca
parents: 331
diff changeset
   198
        (resourceOwner := Smalltalk resolveName:className inClass:self class) isNil ifTrue:[
120
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   199
            ^ nil
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   200
        ]
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   201
    ].
320
5915a3370a59 savely perform method to retrive resource
ca
parents: 226
diff changeset
   202
226
07e81ce2d32f accessing a resource
ca
parents: 200
diff changeset
   203
    (resourceOwner respondsTo:#visualFor:) ifTrue:[
07e81ce2d32f accessing a resource
ca
parents: 200
diff changeset
   204
        (img := resourceOwner visualFor:selector) notNil ifTrue:[
07e81ce2d32f accessing a resource
ca
parents: 200
diff changeset
   205
            ^ img
07e81ce2d32f accessing a resource
ca
parents: 200
diff changeset
   206
        ]
07e81ce2d32f accessing a resource
ca
parents: 200
diff changeset
   207
    ].
320
5915a3370a59 savely perform method to retrive resource
ca
parents: 226
diff changeset
   208
5915a3370a59 savely perform method to retrive resource
ca
parents: 226
diff changeset
   209
    (resourceOwner respondsTo:selector) ifTrue:[
5915a3370a59 savely perform method to retrive resource
ca
parents: 226
diff changeset
   210
        ^ resourceOwner perform:selector
5915a3370a59 savely perform method to retrive resource
ca
parents: 226
diff changeset
   211
    ].
5915a3370a59 savely perform method to retrive resource
ca
parents: 226
diff changeset
   212
5915a3370a59 savely perform method to retrive resource
ca
parents: 226
diff changeset
   213
    resourceOwner isClass ifFalse:[
5915a3370a59 savely perform method to retrive resource
ca
parents: 226
diff changeset
   214
        cls := resourceOwner class.
5915a3370a59 savely perform method to retrive resource
ca
parents: 226
diff changeset
   215
5915a3370a59 savely perform method to retrive resource
ca
parents: 226
diff changeset
   216
        (cls respondsTo:selector) ifTrue:[
5915a3370a59 savely perform method to retrive resource
ca
parents: 226
diff changeset
   217
            ^ cls perform:selector
5915a3370a59 savely perform method to retrive resource
ca
parents: 226
diff changeset
   218
        ]
5915a3370a59 savely perform method to retrive resource
ca
parents: 226
diff changeset
   219
    ].
5915a3370a59 savely perform method to retrive resource
ca
parents: 226
diff changeset
   220
    ^ nil
5915a3370a59 savely perform method to retrive resource
ca
parents: 226
diff changeset
   221
373
ae526fcf716a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
   222
    "Modified: / 31.10.1997 / 12:09:52 / cg"
120
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   223
! !
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   224
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   225
!ResourceRetriever methodsFor:'converting'!
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   226
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   227
fromLiteralArrayEncoding:anArray
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   228
    "read my values from an encoding.
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   229
    "
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   230
    className     := anArray at: 2.
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   231
    selector      := anArray at: 3.
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   232
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   233
    anArray size == 4 ifTrue:[
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   234
        labelText := anArray at:4
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   235
    ].
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   236
    resourceOwner := nil.
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   237
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   238
!
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   239
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   240
literalArrayEncoding
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   241
    "encode myself as an array, from which a copy of the receiver can be
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   242
     reconstructed with #decodeAsLiteralArray.
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   243
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   244
     The encoding is: 
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   245
        (#ResourceRetriever className selector)
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   246
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   247
     or if labelText not nil:
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   248
        (#ResourceRetriever className selector labelText)
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   249
    "
476
05adf036c0ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   250
    |myClassName|
05adf036c0ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   251
05adf036c0ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   252
    myClassName := self class name.
120
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   253
    labelText isNil ifTrue:[
476
05adf036c0ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   254
        ^ Array with:myClassName with:className with:selector
120
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   255
    ] ifFalse:[
476
05adf036c0ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   256
        ^ Array with:myClassName with:className with:selector with:labelText
120
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   257
    ].
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   258
476
05adf036c0ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   259
    "Modified: / 26.1.1998 / 13:52:43 / cg"
120
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   260
! !
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   261
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   262
!ResourceRetriever methodsFor:'testing'!
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   263
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   264
isDefined
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   265
    "returns true if resource exists
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   266
    "
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   267
    selector notNil ifTrue:[
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   268
        ^ (resourceOwner notNil or:[className notNil])
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   269
    ].
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   270
  ^ false
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   271
!
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   272
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   273
notDefined
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   274
    "returns false if resource is not defined
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   275
    "
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   276
    self isDefined ifTrue:[^ false ]
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   277
                  ifFalse:[^ true  ]
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   278
! !
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   279
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   280
!ResourceRetriever class methodsFor:'documentation'!
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   281
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   282
version
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   283
    ^ '$Header$'
d83c307f3bf5 intitial checkin
ca
parents:
diff changeset
   284
! !