/*
 * Email_n.java
 *
 * Created on November 18, 2003, 4:25 PM
 */

package usda.weru.weps.gui;
/**
 * This GUI helps the user to attach the project and the specific run along with 
 * some commentsto send any errors or exceptions that occured to the WEPS support 
 * team or other people by mentioning their email address from within the application. 
 * @author  manmohan
 */
public class Email_n extends javax.swing.JFrame {
    
    /** Creates new form Email_n */
    /**
    * Default constructor for the Email GUI object that helps the user in sending 
    * the email with bug reports attached if the application doen't execute properly 
    * to the WEPS support tem.
    */
    public Email_n() {
        initComponents();
        //System.out.println("Email_n: Default constructor");
    }
    
      /**
    * Default constructor for the Email GUI object that helps the user in sending 
    * the email with bug reports attached if the application doen't execute properly 
    * to the WEPS support tem.
    * @param sTitle The frame title in which the email details will be fed for sending 
     * bug reports  or other quesries.
    */
    public Email_n(java.lang.String sTitle) {
        this();
        setTitle(sTitle);
        //System.out.println("Email_n: 1 argument constructor");
    }
    
 
    
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        JP_main = new javax.swing.JPanel();
        JL_header = new javax.swing.JLabel();
        JL_clientNote = new javax.swing.JLabel();
        JL_from = new javax.swing.JLabel();
        JTF_from = new javax.swing.JTextField();
        JTF_to = new javax.swing.JTextField();
        JL_to = new javax.swing.JLabel();
        JL_subject = new javax.swing.JLabel();
        JTF_subject = new javax.swing.JTextField();
        JTF_attachment = new javax.swing.JTextField();
        JL_attachment = new javax.swing.JLabel();
        JSP_text = new javax.swing.JScrollPane();
        JTA_text = new javax.swing.JTextArea();
        JP_buttons = new javax.swing.JPanel();
        JB_send = new javax.swing.JButton();
        JB_client = new javax.swing.JButton();
        JB_cancel = new javax.swing.JButton();
        JB_Run = new javax.swing.JButton();
        JB_Project = new javax.swing.JButton();

        setTitle("sTitle");
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                exitForm(evt);
            }
        });

        getAccessibleContext().setAccessibleName("");
        JL_header.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        JL_header.setText("E-mail ");

        JL_clientNote.setText("<html><p>This screen allows you to attach a run or project to an email message in your default mail client.<ol><li>Attach a run or project (optional)</li><li>Click Open Mail Client.</li></ol></p></html>");
        JL_clientNote.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        JL_clientNote.setVerticalTextPosition(javax.swing.SwingConstants.TOP);

        JL_from.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        JL_from.setText("From :");

        JTF_from.setHorizontalAlignment(javax.swing.JTextField.LEFT);

        JTF_to.setHorizontalAlignment(javax.swing.JTextField.LEFT);

        JL_to.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        JL_to.setText("To :");

        JL_subject.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        JL_subject.setText("Subject :");

        JTF_subject.setHorizontalAlignment(javax.swing.JTextField.LEFT);

        JTF_attachment.setHorizontalAlignment(javax.swing.JTextField.LEFT);

        JL_attachment.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        JL_attachment.setText("Attachment :");

        JSP_text.setViewportBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        JSP_text.setPreferredSize(new java.awt.Dimension(5, 21));
        JSP_text.setViewportView(JTA_text);

        JB_send.setMnemonic('S');
        JB_send.setText("Send");
        JB_send.setToolTipText("Email:JB_Send");
        JB_send.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JBSend_ActionPerformed(evt);
            }
        });

        JP_buttons.add(JB_send);

        JB_client.setText("Open Mail Client");
        JB_client.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_clientActionPerformed(evt);
            }
        });

        JP_buttons.add(JB_client);

        JB_cancel.setMnemonic('C');
        JB_cancel.setText("Cancel");
        JB_cancel.setToolTipText("Email:JB_Cancel");
        JB_cancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JBCancel_ActionPerformed(evt);
            }
        });

        JP_buttons.add(JB_cancel);

        JB_Run.setMnemonic('R');
        JB_Run.setText("Attach Run");
        JB_Run.setToolTipText("Email:JB_Run");
        JB_Run.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JBRun_ActionPerformed(evt);
            }
        });

        JP_buttons.add(JB_Run);

        JB_Project.setMnemonic('P');
        JB_Project.setText("Attach Project");
        JB_Project.setToolTipText("Email:JB_Project");
        JB_Project.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JBProject_ActionPerformed(evt);
            }
        });

        JP_buttons.add(JB_Project);

        org.jdesktop.layout.GroupLayout JP_mainLayout = new org.jdesktop.layout.GroupLayout(JP_main);
        JP_main.setLayout(JP_mainLayout);
        JP_mainLayout.setHorizontalGroup(
            JP_mainLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(JP_mainLayout.createSequentialGroup()
                .addContainerGap()
                .add(JP_mainLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(JP_mainLayout.createSequentialGroup()
                        .add(JSP_text, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                        .addContainerGap())
                    .add(JP_mainLayout.createSequentialGroup()
                        .add(JP_mainLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(org.jdesktop.layout.GroupLayout.LEADING, JL_clientNote, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 511, Short.MAX_VALUE)
                            .add(org.jdesktop.layout.GroupLayout.LEADING, JL_header, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 511, Short.MAX_VALUE))
                        .addContainerGap())
                    .add(JP_mainLayout.createSequentialGroup()
                        .add(JP_mainLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(JL_from, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 47, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(JL_to, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 75, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(JL_subject, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 75, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(JL_attachment, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(JP_mainLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(JTF_from, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 250, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(JTF_to, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 250, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(JTF_attachment, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 428, Short.MAX_VALUE)
                            .add(JTF_subject, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 428, Short.MAX_VALUE))
                        .add(13, 13, 13))
                    .add(JP_mainLayout.createSequentialGroup()
                        .add(JP_buttons, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 511, Short.MAX_VALUE)
                        .addContainerGap())))
        );
        JP_mainLayout.setVerticalGroup(
            JP_mainLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(JP_mainLayout.createSequentialGroup()
                .add(JL_header, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(JL_clientNote)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(JP_mainLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(JL_from, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(JTF_from, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(JP_mainLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(JL_to, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(JTF_to, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(JP_mainLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(JL_subject, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(JTF_subject, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(JP_mainLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(JL_attachment, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(JTF_attachment, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(JSP_text, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 172, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(JP_buttons, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 32, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, JP_main, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(JP_main, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 415, Short.MAX_VALUE)
        );
        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-539)/2, (screenSize.height-442)/2, 539, 442);
    }// </editor-fold>//GEN-END:initComponents

    private void JB_clientActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_clientActionPerformed
        JB_client_actionPerformed(evt);
    }//GEN-LAST:event_JB_clientActionPerformed
    protected void JB_client_actionPerformed(java.awt.event.ActionEvent evt) {

    }
    private void JBProject_ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JBProject_ActionPerformed
        // Add your handling code here:
        JBProject_actionPerformed(evt);
    }//GEN-LAST:event_JBProject_ActionPerformed

    private void JBRun_ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JBRun_ActionPerformed
        // Add your handling code here:
        JBRun_actionPerformed(evt);
    }//GEN-LAST:event_JBRun_ActionPerformed

    private void JBCancel_ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JBCancel_ActionPerformed
        // Add your handling code here:
        JBCancel_actionPerformed(evt);
    }//GEN-LAST:event_JBCancel_ActionPerformed

    private void JBSend_ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JBSend_ActionPerformed
        // Add your handling code here:
        JBSend_actionPerformed(evt);
    }//GEN-LAST:event_JBSend_ActionPerformed
    
    /**  
    * This method is called when a "Attach Project" button on the "Email GUI Screen"  
    * is clicked to attach the bugs encountered in the project during the execution.
    * @param evt This event generated when the "Attach" button on the "Email" GUI 
    * is pressed.
    */
    public void JBProject_actionPerformed(java.awt.event.ActionEvent evt) {
        // Add your handling code here:
    }

    /**  
    * This method is called when a "Attach RUN" button on the "Email GUI Screen"  
    * is clicked to attach the bugs encountered in the specific run of a project
    * during the execution.
    * @param evt This event generated when the "Attach Run" button on the "Email" GUI 
    * is pressed.
    */
    public void JBRun_actionPerformed(java.awt.event.ActionEvent evt) {
        // Add your handling code here:
    }

    /**  
    * This method is called when the "Cancel" button on the "Email GUI Screen"  
    * is clicked to discard any changes made and close the frame.
    * @param evt This event generated when the "Cancel" button on the "Email" GUI 
    * is pressed.
    */
    public void JBCancel_actionPerformed(java.awt.event.ActionEvent evt) {
        // Add your handling code here:
    }

    /**  
    * This method is called when the user intends to send the email to the recipient
    * by pressing the "Send" labeled button on the "Email GUI screen. 
    * @param evt This event generated when the "Send" button on the "Email" GUI 
    * is pressed.
    */
    public void JBSend_actionPerformed(java.awt.event.ActionEvent evt) {
        // Add your handling code here:			removeListeners(rfd,cd);

    }
  
    /** 
    * This method is called when the email frame is to be closed by hitting the 
    * "Red X" button of the window.
    * @param evt The window event generated when the " Red X " button on the window is hit. 
    */
    private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
        exit_form(evt);
    }//GEN-LAST:event_exitForm
    
    protected void exit_form(java.awt.event.WindowEvent evt) {                          
        this.dispose();
    } 
    
  /**
   * This method is used if this dialog is rum as an independent application. If executed,
   * makes the GUI visible.
   * @param args These are the command line arguments passed to the main method.
   */
    public static void main(String args[]) {
		javax.swing.JFrame jf = new javax.swing.JFrame("test");
		jf.setVisible(true);
		Email_n e = new Email_n();
		//System.out.println("E_m: " + e);
		e.setVisible(true);
		e.invalidate();
		e.repaint();
		e.setVisible(true);
		//System.out.println("E_m: " + e);
        //System.out.println("Email_n: Inside main after Email_n.setVisible(true)");
    }
        
    // Variables declaration - do not modify//GEN-BEGIN:variables
    public javax.swing.JButton JB_Project;
    public javax.swing.JButton JB_Run;
    public javax.swing.JButton JB_cancel;
    protected javax.swing.JButton JB_client;
    public javax.swing.JButton JB_send;
    protected javax.swing.JLabel JL_attachment;
    protected javax.swing.JLabel JL_clientNote;
    protected javax.swing.JLabel JL_from;
    public javax.swing.JLabel JL_header;
    protected javax.swing.JLabel JL_subject;
    protected javax.swing.JLabel JL_to;
    public javax.swing.JPanel JP_buttons;
    protected javax.swing.JPanel JP_main;
    public javax.swing.JScrollPane JSP_text;
    public javax.swing.JTextArea JTA_text;
    public javax.swing.JTextField JTF_attachment;
    public javax.swing.JTextField JTF_from;
    public javax.swing.JTextField JTF_subject;
    public javax.swing.JTextField JTF_to;
    // End of variables declaration//GEN-END:variables
    
}
