Table of Contents Markup Tutorial Interfacing with Java™ Web Services

Note: Compared to other examples presented so far, this is a fairly advanced example of object composition. To follow it, you must have a good understanding of Model-View-Controller Pattern and Object Composition.

We now show you how to build a fully functioning calendar using many of the pieces we have already developed. We will later use this example to demonstrate advanced table features, and show how you can radically alter the view of the calendar using markup alone.

Calendar Structure

The structure of a calendar is shown below. The notation is the same as in earlier examples — red boxes represent models, purple boxes represent controllers, and green circles represent events. To reduce clutter, not all of the connections between event sources and event listeners are shown. See numeric spinner and month picker for details on how the year entry field and the month picker are implemented.

The most significant addition to this composition is the scroll pane containing a table that serves as the date view for the calendar. The table gets its data from the table model which can be manipulated by the calendar controller represented by the large purple box on the right.

Calendar Controller

The calendar controller is defined by the class com.enode.calendar.Calendar. As shown below, it implements the interfaces javax.swing.event.TableModelListener and com.enode.xalt.SequenceChangeListener.

Calendar Model

To implement the communication protocol between the various objects in this example, we establish bi-directional associations between the calendar controller and each of the three models depicted above. The combo box model and the text model are unchanged from the month picker and numeric spinner examples, respectively. The listing for the table model is shown below.

Calendar View

The markup for the calendar view is shown below.

Make this object in eNode Sandbox. The result should be similar to the following:

See Advanced Table Features for some exciting ways to change the appearance of this calendar.


Copyright © 2002 eNode, Inc. All Rights Reserved.