caltool.view_ui
Class AppointmentsListDisplay

java.lang.Object
  extended by mvp.View
      extended by caltool.caltool_ui.CalendarToolWindow
          extended by caltool.view_ui.AppointmentsListDisplay
All Implemented Interfaces:
java.io.Serializable, java.util.Observer

public class AppointmentsListDisplay
extends CalendarToolWindow

Class AppointmentsListDisplay is the companion view of an Appointments list. The display is a JTable. The columns of the table are fixed, per the requirements. The number of rows and number of rows visible are controlled by options settings. The default number of rows is the number of appointments in the three-week period starting one week from today's date. The default number of visible rows is 20.

The model data for this display come from the Lists model class. A DefaultTableModel is used as an adaptor between the model data and the JTable display. See the method and data field documentation for further explanation.

See Also:
Serialized Form

Field Summary
protected  javax.swing.table.DefaultTableModel localData
          Local data model.
protected  javax.swing.JTable table
          The display view
 
Fields inherited from class caltool.caltool_ui.CalendarToolWindow
calToolUI
 
Fields inherited from class mvp.View
closeAdapter, editable, model, screen, shown, widget, window
 
Constructor Summary
AppointmentsListDisplay(mvp.Screen s, Lists lists, CalendarToolUI calToolUI)
          Construct with the given screen and Lists model.
 
Method Summary
 java.awt.Component compose()
          Compose the initial layout with column headings and no row data.
protected  void populateRow(int i, AppointmentListItem item)
          Populate the ith table row with the data from the given appointment list item.
 void update(java.util.Observable o, java.lang.Object arg)
          Display the model data produced by the method Lists.viewAppointmentsList.
 
Methods inherited from class caltool.caltool_ui.CalendarToolWindow
show
 
Methods inherited from class mvp.View
getModel, getWidget, getWindow, hide, isEditable, isShown, run, setEditable, setExitOnClose, setModel, show
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localData

protected javax.swing.table.DefaultTableModel localData
Local data model. This is not the real data model, but rather a view-specific table model that is constructed by extracting data from the real model using the viewAppointmentsList method. There are in fact no persistent list data on the model side; rather, all calendar lists are computed dynamically from the underlying CalendarDB.

In this way, DefaultTableModel is being used as a form of adaptor class between the Lists model and the JTable-based display.


table

protected javax.swing.JTable table
The display view

Constructor Detail

AppointmentsListDisplay

public AppointmentsListDisplay(mvp.Screen s,
                               Lists lists,
                               CalendarToolUI calToolUI)
Construct with the given screen and Lists model. A local DefaultTableModel is constructed to hold the raw data collected from the model.

Method Detail

compose

public java.awt.Component compose()
Compose the initial layout with column headings and no row data.

Overrides:
compose in class mvp.View

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Display the model data produced by the method Lists.viewAppointmentsList. The height of the display is based on an option setting, independent from the length of list returned from the model method. In the current preliminary implementation, the height is set to the default value of 20 rows. This implementation will be refined to call an appropriate method in the options package.

Specified by:
update in interface java.util.Observer
Overrides:
update in class mvp.View

populateRow

protected void populateRow(int i,
                           AppointmentListItem item)
Populate the ith table row with the data from the given appointment list item.