package caltool.view_ui; import caltool.view.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; /**** * * Class SmallDayViewDisplay is the companion view for a SmallDayView model * object. The display is comprised of a vbox containing a left/top-justified * label with the date number, and a JList of scheduled item descriptors. * * In the current stubbed implementation, the JList is empty. In the completed * implementation, the JList will be hooked up with the DefaultListModel that * contains the scheduled item descriptors for a given day. * * Note that no compose method is provided because there is no static layout. * Instances of this class are all created dynamically in the update method of * MontlyAgendaDisplay, q.v. * * @author Gene Fisher (gfisher@calpoly.edu) * @version 6feb04 * */ public class SmallDayViewDisplay extends mvp.View { /** * Construct this as vbox of date number and item-descriptor list. The * Dimension argument is not presently used, and may be removed in the * final implementation. It's purpose is to ensure proper sizing of the * day grid. */ SmallDayViewDisplay(mvp.Screen s, SmallDayView smallDayView, MonthlyAgenda monthlyAgenda, Dimension size) { super(s, smallDayView); /* * Build the outer vbox. */ JPanel vbox = new JPanel(); vbox.setLayout(new BoxLayout(vbox, BoxLayout.Y_AXIS)); /* * Create the date number label and attach its mouse listener. */ DateNumberLabel label = new DateNumberLabel(smallDayView.getDate()); label.addMouseListener(new DateLabelListener(label, monthlyAgenda)); /* * Construct a (for now empty) list of items. */ JList list = new JList(); /* * Finish the layout. */ vbox.add(label); vbox.add(list); vbox.setBackground(Color.white); vbox.setBorder(BorderFactory.createLineBorder(Color.black)); widget = vbox; } protected Dimension defaultSize; }