ReferenceView should publish resourceIdentifier (V4.0.1)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ReferenceView should publish resourceIdentifier (V4.0.1)

Carsten Haerle
I think the ReferenceView class should publish it's most important
attribute #resourceIdentifier. Enclosed the code which does this.

Maybe Andy Bower will incorporate this in to the next release.

ReferenceView>>publishedAspectsOfInstances
"Answer a Set of AspectDescriptors that describe the aspects published
by instances of the receiver"
| aspects |
aspects := super publishedAspectsOfInstances.
aspects
removeKey: #hasBorder;
removeKey: #hasClientEdge;
removeKey: #hasStaticEdge;
removeKey: #usePreferredExtent;
removeKey: #contextMenu;
removeKey: #preferredExtent;
removeKey: #font;
removeKey: #isTransparent;
removeKey: #isEnabled;
removeKey: #text;
add: (Aspect string: #resourceIdentifier).
^aspects.

Regards

Carsten Haerle
straightec GmbH


Reply | Threaded
Open this post in threaded view
|

Re: ReferenceView should publish resourceIdentifier (V4.0.1)

Andy Bower
Carsten,

> I think the ReferenceView class should publish it's most important
> attribute #resourceIdentifier. Enclosed the code which does this.
>
> Maybe Andy Bower will incorporate this in to the next release.
>
> ReferenceView>>publishedAspectsOfInstances
> "Answer a Set of AspectDescriptors that describe the aspects published
> by instances of the receiver"
> | aspects |
> aspects := super publishedAspectsOfInstances.
> aspects
> removeKey: #hasBorder;
> removeKey: #hasClientEdge;
> removeKey: #hasStaticEdge;
> removeKey: #usePreferredExtent;
> removeKey: #contextMenu;
> removeKey: #preferredExtent;
> removeKey: #font;
> removeKey: #isTransparent;
> removeKey: #isEnabled;
> removeKey: #text;
> add: (Aspect string: #resourceIdentifier).
> ^aspects.

You can't do this (certainly not as proposed anyway). The
#resourceIdentifier aspect holds an instance of ResourceIdentifier, not a
String. The above just happens to work when displaying the identifer in the
view composer but is not strictly correct. You could use:

add: (Aspect name: #resourceIdentifier)

which would treat the aspect as a general object that could be displayed and
edited in a workspace. However, this would still not be correct since the
#resourceIdentifier: setter method doesn't have code to cause the reference
view to be refreshed if the identifier is changed. Something like:

ReferenceView>>resourceIdentifier: aResourceIdentifier
    "Private - Store the identifier of the ViewResource to which the
receiver is a reference.
    When the receiver is created this will be resolved to form the
receiver's sub-view."
    referee notNil ifTrue: [
        referee destroy.
        referee := nil ].
    resourceIdentifier := aResourceIdentifier

Theoretically this would allow the identifier to be changed on the fly from
the view composer but you'd have to assign an instance of
ResourceIdentifier, e.g. ResourceIdentifier class: 'MyClass' name: 'Default
view'. I'm not sure how important this really is but if you folks want to
add the above to your images and give it a whirl for a few days then we can
consider adding it in a future patch level if it turns out to be useful.

Best Regards,

Andy Bower
Dolphin Support
http://www.object-arts.com
---
Are you trying too hard?
http://www.object-arts.com/Relax.htm
---


Reply | Threaded
Open this post in threaded view
|

Re: ReferenceView should publish resourceIdentifier (V4.0.1)

Bill Schwab
Andy,

> Theoretically this would allow the identifier to be changed on the fly
from
> the view composer but you'd have to assign an instance of
> ResourceIdentifier, e.g. ResourceIdentifier class: 'MyClass' name:
'Default
> view'. I'm not sure how important this really is but if you folks want to
> add the above to your images and give it a whirl for a few days then we
can
> consider adding it in a future patch level if it turns out to be useful.

There have been times when I've wanted to tweak an existing reference view,
so when you put it as above, it starts to sound pretty useful.  It would
matter (to me at least) most in situations with complicated framing
layouts - dragging in a new view gets a little tricky, though I'm gradually
getting more clever about copying/pasting the arrangements to save work.  If
publishing the aspect is easy and reliable, it would be a nice addition.

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]