package caltool;

import caltool.caltool_ui.*;
import caltool.file.*;
import caltool.edit.*;
import caltool.schedule.*;
import caltool.view.*;
import caltool.admin.*;
import caltool.options.*;
import caltool.help.*;
import caltool.caldb.*;
import mvp.Model;

/****
 *
 * Class CalendarToolTest is the companion testing class for <a href=
 * CalendarTool.html> CalendarTool </a>.  It implements the following test
 * plan:
 *
 */
public class CalendarTool {

    /**
     * Construct this with the given companion view.  Call the submodel
     * constructors.  Initialize the start-up state based on default options
     * and command-line arguments.
     */
    public CalendarTool(CalendarToolUI calToolUI) {

        /*
         * Call the parent constructor.
         */
        super(calToolUI);

        /*
         * Construct and store the submodel instances.  Note that the
         * CalendarDB is constructed before the File so the latter can observe
         * the former for changes.
         */
        caldb = new CalendarDBTest();
        file = new FileTest(null, caldb);
        edit = new EditTest(null);
        schedule = new ScheduleTest(null, caldb);
        calView = new ViewTest(null);
        admin = new AdminTest(null);
        options = new OptionsTest(null);

	/*
	 * Set up the initial state of the tool.
	 */
	initialize();
    }

    /** Return the File model. */
    public File getFile() { return file; }

    /** Return the Edit model. */
    public Edit getEdit() { return edit; }

    /** Return the Schedule model. */
    public Schedule getSchedule() { return schedule; }

    /** Return the View model. */
    public View getCalView() { return calView; }

    /** Return the Admin model. */
    public Admin getAdmin() { return admin; }

    /** Return the Options model. */
    public Options getOptions() { return options; }

    /** Return the Help model. */
    public Help getHelp() { return help; }


    /*-*
     * Protected methods
     */

    /**
     * Set up the initial state of the tool, based on default option values and
     * command-line arguments, if any.  Details TBD.
     */
    void initialize() {}


    /*-*
     * Data fields
     */

    /** File-handling module */
    protected FileTest file;

    /** Basic editing module */
    protected EditTest edit;

    /** Scheduling module */
    protected ScheduleTest schedule;

    /** Calendar viewing module */
    protected ViewTest calView;

    /** Calendar administration module */
    protected AdminTest admin;

    /** Tool options module */
    protected OptionsTest options;

    /** Tool options module */
    protected HelpTest help;

    /** Calendar database */
    protected CalendarDBTest caldb;

}