MiG InfoCom MiG Calendar AShape Developer Manual User Manual

Page 16

Advertising
background image

MiG InfoCom AB

Overrides
A unique feature of

AShape

is that of overrides. Since every

property of an

AShape

is stored in a

PropertyKey

/value

map it is very easy to intercept the getting and setting of
every property. One such interception is the notion of
overrides.

For every retrieval of a property, e.g.

Paint

,

PlaceRect

,

Font

and such, all

Interactor

s are asked if they have an

overridden object to return for that particular property name.
This means that is is very simple to exchange all, a sub set
or just one of the properties for an

AShape

without actually

changing it's state, and without changing properties that is
unknown at the time of writing. The only thing you change is
the

Interactor

since it contains the override

Map

.

This is for instance how normally you would set a different
color for a mouse over:ed

AShape

, you set an override for

the background paint on the corresponding

Interactor

.

This will work both for the one-to-one pattern as well as the
stamp pattern, as described above.

With this override pattern it is also very easy to restore the
original value, you just restore (remove) the override and the
original value is visible once again. This means that there is
no need to save the original value and late restore it.

The reason the you can't just set the new value on the

AShape

itself is that it is normally used as a rubber stamp

and for instance the shape can be used to paint all Activities
in a date area (this is even the normal case). If for instance a
new color was set on the shape when it was mouse over:ed
then all activities would change color. The override is
connected to the interacted through the

Interactor

so it is

overriding that property only for one paint (the mouse
over:ed one).

Interaction
An interaction is a concrete class that describes a trigger
that, when it happens, the framework should check the
validity of an

Expression

. If that

Expression

is evaluated

to

true

it also contains a

Command(s)

that should be

executed. It isn't more complicated than that since it is very
generic, yet is is powerful just because it can describe almost
any

if-then

constellation.

AShape Developer Manual

Page 16 / 24

Advertising