Geometry package and coordinates – MiG InfoCom MiG Calendar Tutorial User Manual
Page 19

MiG InfoCom AB
3. The
Command
or
CommandSet
that should be executed. E.g.
StartAnimation
.
A
Command
is a generic specification of an action that is to be taken
and what is the target. It can also be sub classes to support any action
that can be written in Java code, without the need for a specific
InteractionBroker
.
An
InteractionBroker
is an executor/interpreter of
Command
s.
A broker will normally handle a certain type of commands, for example
the
ActivityViewInteractionBroker
can handle commands
that will affect an
ActivityView
, it has specific knowledge on how
to manipulate it.
The
Interaction
framework is very loosely coupled. The different
parts, Interactor, Interaction, Command, Expression and
InteractionBroker have few demands on each other's types. This can
be confusing at first but is very powerful once understood. See the
examples in the AShape Tutorial for hints on how to use this powerful
and flexible framework.
One important functionality that the
Interactor
framework
supports is the notion of overriding attributes. If, for instance, an
AShape
's background color is normally blue, it can be overridden to
be yellow when the mouse is hovering over it. The original property of
the
AShape
is never actually changed, it is just exchanged for the
overridden value when the attribute is fetched, for instance during the
paint process. The
Interactor
keeps track of the overrides that is
currently active for its peer object, e.g. an
ActivityView
.
Geometry Package and Coordinates
Since the MiG Calendar requires a lot of flexibility when it comes to
positioning graphics on screen a new type of coordinates was
developed. All sub components within the component uses this
coordinating system. Classes that could denote statements like: '10
pixels from the end' and '20% in, but no less than 10 pixels from the
right edge'. These kind of statements is easy to do in Java code, but
quite hard to specify in a persistable object, such as a coordinate. The
util.gfx.geometry
packages has these main parts:
•
Numbers. A number can relate to 0, 1, or 2 other numbers. 0
means it is a value on it's own, such as an
Integer
normally is. 1
means it needs one reference value in order to produce a number,
for instance when a coordinate denotes an offset or percentage. 2
MiG Calendar Tutorial
Page 19 / 24