MiG InfoCom MiG Calendar AShape Developer Manual User Manual
Page 14
![background image](https://www.manualsdir.com/files/798676/content/doc014.png)
MiG InfoCom AB
Note!
From v6.0 of the component there is a simpler and more
flexible way to interact with the shapes. See the Listening for
MouseEvents section below.
The Basics
Interactors are used to connect the
AShapes
to the rest of
the application. They are very flexible and there exist many
implementations to interact with different types of outside
events.
The whole
util.interaction
package denotes a very
extensible and highly decoupled way to say what you want to
happened, to what, and when.
Also check the Static Overrides section below as it is a
simpler way to change the properties on an
AShape
in
dynamic way. It is a simpler and more flexible way to handle
overrides in some ways but there are things you can't do
with them, for instance starting and stopping animations on
specific timer events.
Usage Pattern
Normally you have an
Interactor
(or many) that is
connected to the entity (the interacted) you are interacting
with (such as a button or activity) and usually also to some
source of events, such as a
JComponent
or a
Timer
. The
Interactor
contains a number of
Interaction
s which
specify what to do when something happens. For instance:
“Change the color to blue when clicked on with the mouse”.
All Interactors will process the events sent to them and check
if there are any
Interaction
s that needs attention (i.e. if
it's a “trigger” for the
Interaction
). All Interactions that is
triggered will be evaluated with the
Expression
set on it.
That
Expression
can denote just about anything, for
instance if the mouse is over it.
If the
Expression
is evaluated to
true
its associated
Command(s)
will be run using the
InteractionBroker
set
on the
Interactor
.
The above algorithm is using a lot of different parts in a very
decoupled framework. Almost any concrete implementation
of an
InteractionBroker
can be connected to any type of
Interactor
for instance. This is very powerful but can be a
bit hard to grasp since you can't count on the types of the
classes to see what belongs to what.
AShape Developer Manual
Page 14 / 24
Tip!