MiG InfoCom MiG Calendar JavaBeans Guide User Manual

Page 39

Advertising
background image

MiG InfoCom AB

method CategoryDepository.getRoot(). Use this root to
handle the tree much like how you would with a normal
JTree. The Category nodes in the tree also implement the
TreeNode interface so they can be added to a JTree directly.

Adding Activities to your Application

The calendar component uses the ActivityDepository class
to manage the in-memory activities. All activities in this
depository can optionally be viewed in a date area. It is the
application builder’s job to move activities in and out of that
depository. Normally an importer/exporter of some kind will
read from a database and create DefaultActivity objects
from the records in the database and add them to the
depository with addBrokedActivity(..). When an activity
should not be handled by the component anymore you can
use removeBrokedActivity(..) to remove it.

The date areas in the application will automatically add
Subscriptions to the activity depository where they get
their activities from. You as the application developer can
monitor these subscriptions to know what date/time ranges
are currently being displayed and pull the relevant activity
records from a backing store. Your own components can also
add Subscriptions to this depository if they show activities.
This is a good centralized way to manage views of the
activity data, i.e. what date ranges a currently visible. Note
that the subscriptions are not used in any way by the MiG
calendar framework other than what’s explained above.

How the saving of changed activities is done is up to the
application developer. There are simply too many ways to do
this to include it into the component.

Tracking Changes to Activities

There are a number of ways to monitor changes to activities
and other important events happening in the component.
Here are the most important ones:

Add a listener to all created Activity objects. This
listener will get notified of any changes to the
properties of that activity.

Add a static listener with
AbstractActivity.addStaticPropertyChangeListe
ner(..) that tracks the changes for all activities that

MiG Calendar JavaBeans Guide

Page 39 / 45

Advertising