package caltool.model.view.schedule;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

/****
 *
 * Class RemindCheckBoxListener handles the selection of the Reminder
 * checkbox.  When it's turned on, the other components in the reminder row are
 * enabled.  When it's turned off, the other components are disabled.
 *
 */

public class RemindCheckBoxListener implements ActionListener {

    public RemindCheckBoxListener(RemindInfoSubdialog parentView) {
        this.parentView = parentView;
    }

    public void actionPerformed(ActionEvent e) {
        if (parentView.remindCheckBox.isSelected()) {
            setEnabled(true);
        }
        else {
            setEnabled(false);
            parentView.remindTimeTextField.setText("");
        }
    }

    protected void setEnabled(boolean isEnabled) {
        parentView.remindTimeTextField.setEnabled(isEnabled);
        parentView.remindTimeComboBox.setEnabled(isEnabled);
        parentView.remindLocationComboBox.setEnabled(isEnabled);
    }

    protected RemindInfoSubdialog parentView;

}