MiG InfoCom MiG Calendar JavaBeans Guide User Manual

Page 42

Advertising
background image

MiG InfoCom AB

public static final String DEFAULT_SHADOW_SHAPE_NAME

Yet another way is to provide different AShapes (or rather
RootAShapes) for different PaintContexts. This is
automatically handled by the framework. You simply register
a RootAShape for a PaintContext by:

Statically for all DefaultAShapeProviders:

DefaultAShapeProvider.setShapeGlobally(<yourRootAShape>, <paintContext>)

or for a specific DefaultAShapeProvider instance:

provider.setShape(<yourRootAShape >, <paintContext>)

Then you just set the PaintContext for the activities to
match one of the registered contexts and the renderer will
use the appropriate AShape to paint it. null is the default
PaintContext is used for the default shape.

activity.setPaintContext(<paintContext>);

A much more advanced solution, but one that give you total
control, is to write new Interactors and InteractionBrokers
and set them on the RootAShape in the render stage. That is
not a route we recommend for simpler customizations
though.

Adding Custom Visuals to a DateArea or Header

All painting in both date areas and headers are implemented
with Decorators. A Decorator is an interface to implement
to be able to do custom painting in these places. All visuals
such as the grid lines, cell labels, month dividers,
background image etc. are implemented as Decorators in
the MiG Calendar component. This makes it easy for you to
add your own layer of information containing any decoration
you like and even mix it in between the framework’s provided
graphics.

The Decorators can even intercept InputEvents before they
reach the DefaultDateArea. This means that your decoration
layer can for instance react to mouse or key events and

MiG Calendar JavaBeans Guide

Page 42 / 45

Advertising