[Chandler-dev] Moving sharing-specific attributes out of
Phillip J. Eby
pje at telecommunity.com
Fri Jan 26 14:49:15 PST 2007
Btw, forgot to answer this question...
At 02:09 PM 1/26/2007 -0800, Morgen Sagen wrote:
>On Jan 26, 2007, at 2:02 PM, Grant Baillie wrote:
>>You probably want just an Annotation, not a Stamp, I'm guessing.
>Ah, I thought they were one and the same, since I remember hearing
>the phrase "Stamping as Annotation" a lot. :-) What are the
>differences between a Stamp and an Annotation?
A Stamp is an Annotation with some extra features:
1. .add() and .remove() methods, to explicitly record whether the
annotation is in use for a particular instance
2. Ability to support initialValue for its attributes (regular Annotations
can't do this correctly, and the ability for them to do it at all is being
removed). The initialValue of Stamp attributes will be set at .add() time,
if not already set.
3. The "Stamp(anItem).stamps" attribute gives you the stamp (i.e.
Annotation) wrappers that are active for that content item. There's also a
pim.stamping.has_stamp() function that can be used to determine the
presence of stamps.
These features are meaningless for regular annotations, because an
annotation is in some sense "always on" - as long as you handle your own
initialization, you can always access an annotation's attributes on any
item of the annotated type. In contrast, Stamps can be separately "on" or
"off" for *each* item of the annotated type.
(Well, conceptually, anyway. In practice, stamps are exactly the same as
annotations, it's just that the Stamp framework provides the way to also
track this explicit per-item state, and you have to be a Stamp subclass to
play in that world.)
More information about the chandler-dev