beautypg.com

MiG InfoCom MiG Calendar Getting Started Guide User Manual

Page 29

background image

MiG InfoCom AB

here area a more thorough explanation.
A

Decorator

is a generic interface that encapsulates how to

paint something. A

GridDecorator

is a sub interface and

used to decorate things relative to a

Grid

. They have an

layerIndex

that denotes how to order them is a repaint

cycle. Lower indexed decorators will be painted before higher

indexed ones, making higher indexed decorators appear on

top.
They can also interact with the user since the container of

them should offer all

InputEvent

s (such as

MouseEvent

s

and

KeyEvent

s) to the decorators. Event notification stops if

a decorator consumes the event. If no decorator consumes it

it would normally mean that the container if the decorators

should process it. The code that processes the

InputEvent

s

in the decorators should as always be very fast to not

introduce delays in the GUI.

For DefaultDateArea and AbstractDateHeaders
Currently decorators are use in these two classes and their

sub classes.

DecoratorSupport

is a class that handles

them and can be utilized should you choose to use them for

other purposes.

Examples of Decorators Included
The Decorator hierarchy is one of the more extensive

hierarchies in the MiG Calendar component. This is done to

minimize code duplication. For a UML diagram of this

structure see the

MiG Calendar Technical Specification

.

CellLabelDecorator

– Draws labels in the cells of the

Grid

.

DateSeparatorDecorator

– Draws separator lines

between date boundaries in the grid. For instance dividing

months in a month view.

EvenFieldFillDecorator

– To fill different backgrounds

for even/odd date ranges. For instance every other month

can have a yellowish background.

GridLineDecorator

– Draws the grid lines in a

Grid

.

HeaderShapeGridDecorator

– Draws the labels for

headers. Very flexible and can merge cells. Also manages

mouse over and press interactions.

ImageDecorator

– A generic decorator to place images

somewhere on the

Grid

.

NoFitShapeDecorator

– Paints a custom aligned

AShape

in cells that had

ActivityView

s that couldn't fit.

MiG Calendar Getting Started Guide

Page 29 / 31