import java.io.*;
import java.awt.*;
import java.awt.event.*;
 
/**
 * CSC 442F:    Software Engineering
 * Software:    Calendar Client
 * Component:   DeleteReasonDialog class
 * Description: The DeleteReasonDialog class produces a dialog to enter 
 *              a reason for deleting a meeting.
 * @author David Tam
 * @version 1.0
 */
public class DeleteReasonDialog extends DropReasonDialog
{ 

  // Constructor
  // ===========
  public DeleteReasonDialog(ViewMeetingDialog parent_in, Frame frame_in,
                          ClientSocket socket_in)
  {
    super(parent_in, frame_in, socket_in);

    setTitle("Deleting the Meeting");    
    descriptionPanel.description.setText("Reason for deleting the meeting:");
  }
  
  
  // Build response
  // ==============
  protected void buildResponse()
  {
    ResultBox resultBox;
    StringBuffer result = new StringBuffer("CANCELMEETING,");
    
    result.append(parent.meetingId);
    result.append(",");
    result.append(descriptionPanel.buildResponse());

    // Send to server
    try
    {
      socket.Write(result.toString());
    }
    // Catch errors
    catch (IOException io)
    {
      resultBox = new ResultBox(frame, socket);
      resultBox.getResponse();
    }

    resultBox = new ResultBox(frame, socket);
    if (resultBox.getResponse()==0)
      dispose();
    
  }
  
}
