package caltool.view.schedule;

import caltool.model.schedule.*;
import caltool.view.*;
import mvp.*;
import java.awt.*;

/****
 *
 * Class ScheduleUI is the companion view for the <a href = "Schedule.html">
 * Schedule </a> model class.  ScheduleUI contains all of the interface
 * components needed to access model components of the Schedule object.  The
 * ScheduleMenu provides access to the four scheduling operations and the
 * categories list.  An input dialog view is defined for each of the four
 * operations.  The input dialog classes are named "ScheduleXDialog", where X =
 * "Appointment", "Meeting", "Task", and "Event".  These dialogs are used to
 * gather input values for their corresponding method and to invoke the method
 * when the user confirms the inputs with the 'OK' button.
 *                                                                          <p>
 * The CategoriesEditor view provides access to the categories list component
 * of the Schedule model.  This dialog provides the canonical view of the
 * Categories class.  The CategoriesEditor is a subview of ScheduleUI in
 * parallel with Categories being a submodel of Schedule.
 *
 * @author Gene Fisher (gfisher@calpoly.edu)
 * @version 13apr15
 *
 */
public class ScheduleUI extends View {

    /**
     * Construct this by constructing each of the component views.
     */
    public ScheduleUI(Screen screen, Schedule schedule,
            CalendarToolUI calToolUI) {
        super(screen, schedule);
        scheduleMenu = new ScheduleMenu(screen, schedule, this);
        scheduleAppointmentDialog = new ScheduleAppointmentDialog(screen,
            schedule, calToolUI);
        scheduleMeetingDialog = new ScheduleMeetingDialog(screen, schedule,
	    calToolUI);
        scheduleTaskDialog = new ScheduleTaskDialog(screen, schedule,
            calToolUI);
        scheduleEventDialog = new ScheduleEventDialog(screen, schedule,
            calToolUI);
        categoriesEditor = new CategoriesEditor(screen,
            schedule.getCategories(), calToolUI);
    }    

    /**
     * Call compose for each of the component views.  As a convenience to dad
     * (the CalendarToolUI), return the pulldown menu so it can be inserted
     * into the top-level menubar.
     */
    public Component compose() {
        scheduleAppointmentDialog.compose();
        scheduleMeetingDialog.compose();
        scheduleTaskDialog.compose();
        scheduleEventDialog.compose();
        categoriesEditor.compose();
        return scheduleMenu.compose();
    }

    /**
     * Return the ScheduleAppointmentDialog.
     */
    public ScheduleAppointmentDialog getScheduleAppointmentDialog() {
        return scheduleAppointmentDialog;
    }

    /**
     * Return the ScheduleMeetingDialog.
     */
    public ScheduleMeetingDialog getScheduleMeetingDialog() {
        return scheduleMeetingDialog;
    }

    /**
     * Return the ScheduleTaskDialog.
     */
    public ScheduleTaskDialog getScheduleTaskDialog() {
        return scheduleTaskDialog;
    }

    /**
     * Return the ScheduleEventDialog.
     */
    public ScheduleEventDialog getScheduleEventDialog() {
        return scheduleEventDialog;
    }

    /**
     * Return the CategoriesEditor.
     */
    public CategoriesEditor getCategoriesEditor() {
        return categoriesEditor;
    }

    /** The ScheduleMenu */
    protected ScheduleMenu scheduleMenu;

    /** The ScheduleAppointmentDialog */
    protected ScheduleAppointmentDialog scheduleAppointmentDialog;

    /** The ScheduleMeetingDialog */
    protected ScheduleMeetingDialog scheduleMeetingDialog;

    /** The ScheduleTaskDialog */
    protected ScheduleTaskDialog scheduleTaskDialog;

    /** The ScheduleEventDialog */
    protected ScheduleEventDialog scheduleEventDialog;

    /** The CategoriesEditor */
    protected CategoriesEditor categoriesEditor;

}