255 resource |
255 resource |
256 "returns a form assigned to resource or nil" |
256 "returns a form assigned to resource or nil" |
257 |
257 |
258 |img cls| |
258 |img cls| |
259 |
259 |
260 resource notNil ifTrue:[^ resource]. |
260 resource notNil ifTrue:[ |
|
261 ^ resource |
|
262 ]. |
261 |
263 |
262 selector isNil ifTrue:[ |
264 selector isNil ifTrue:[ |
263 ^nil |
265 ^ nil |
264 ]. |
266 ]. |
265 |
267 |
266 resourceOwner isNil ifTrue:[ |
268 resourceOwner isNil ifTrue:[ |
267 (resourceOwner := Smalltalk resolveName:className inClass:self class) isNil ifTrue:[ |
269 (resourceOwner := Smalltalk resolveName:className inClass:self class) isNil ifTrue:[ |
268 ^ nil |
270 ^ nil |
280 ]. |
282 ]. |
281 |
283 |
282 resourceOwner isClass ifFalse:[ |
284 resourceOwner isClass ifFalse:[ |
283 cls := resourceOwner class. |
285 cls := resourceOwner class. |
284 |
286 |
|
287 (cls respondsTo:#visualFor:) ifTrue:[ |
|
288 (img := cls visualFor:selector) notNil ifTrue:[ |
|
289 ^ img |
|
290 ] |
|
291 ]. |
285 (cls respondsTo:selector) ifTrue:[ |
292 (cls respondsTo:selector) ifTrue:[ |
286 ^ cls perform:selector |
293 ^ cls perform:selector |
287 ] |
294 ]. |
288 ]. |
295 ]. |
289 ^ nil |
296 ^ nil |
290 |
297 |
291 "Modified: / 31.10.1997 / 12:09:52 / cg" |
298 "Modified: / 31.10.1997 / 12:09:52 / cg" |
292 ! ! |
299 ! ! |
293 |
300 |
294 !ResourceRetriever methodsFor:'converting'! |
301 !ResourceRetriever methodsFor:'converting'! |
295 |
302 |
296 fromLiteralArrayEncoding:anArray |
303 fromLiteralArrayEncoding:anArray |
297 "read my values from an encoding. |
304 "read my values from an encoding." |
298 " |
305 |
299 className := anArray at: 2. |
306 className := anArray at: 2. |
300 selector := anArray at: 3. |
307 selector := anArray at: 3. |
301 |
308 |
302 anArray size == 4 ifTrue:[ |
309 anArray size == 4 ifTrue:[ |
303 labelText := anArray at:4 |
310 labelText := anArray at:4 |
304 ]. |
311 ]. |
305 resourceOwner := nil. |
312 resourceOwner := nil. |
306 |
|
307 ! |
313 ! |
308 |
314 |
309 literalArrayEncoding |
315 literalArrayEncoding |
310 "encode myself as an array, from which a copy of the receiver can be |
316 "encode myself as an array, from which a copy of the receiver can be |
311 reconstructed with #decodeAsLiteralArray. |
317 reconstructed with #decodeAsLiteralArray. |