package event.editor;

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

/**
 *
 * @author nathaniellehrer
 */
public class TelephonePanel extends javax.swing.JPanel {

    private ActionListener removeListener;
    private JTable dialogTable;

    /** Creates new form TelephonePanel */
    public TelephonePanel() {
        initComponents();
        HashMap<JButton, String> buttonMap = new HashMap<JButton, String>();
        buttonMap.put(addInstructorButton, "Instructor");
        buttonMap.put(addStudentButton, "Student");
        GenericTable.genericizeTable(jScrollPane1, buttonMap, deleteSelectedButton);
    }
    
    /** 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.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        addStudentButton = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        deleteSelectedButton = new javax.swing.JButton();
        addInstructorButton = new javax.swing.JButton();
        jTextField1 = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        removeButton = new javax.swing.JButton();

        addStudentButton.setText("Add Student Line");
        addStudentButton.setToolTipText("Adds a row for student dialog in the table");

        jScrollPane1.setHorizontalScrollBar(null);

        deleteSelectedButton.setText("Delete Selected Line");
        deleteSelectedButton.setToolTipText("Deletes the selected row in the table");

        addInstructorButton.setText("Add Instructor Line");
        addInstructorButton.setToolTipText("Adds a row for instructor dialog in the table");

        jTextField1.setToolTipText("Specifies the role the instructor plays");

        jLabel1.setText("Role of instructor:");

        removeButton.setText("Remove");
        removeButton.setToolTipText("Removes this property");
        removeButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                removeThisProperty(evt);
            }
        });

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 602, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
                        .add(jLabel1)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 478, Short.MAX_VALUE))
                    .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
                        .add(addInstructorButton)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(addStudentButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 173, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(deleteSelectedButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 178, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 86, Short.MAX_VALUE))
                    .add(removeButton))
                .add(26, 26, 26))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(removeButton)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel1))
                .add(18, 18, 18)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(addInstructorButton)
                    .add(addStudentButton)
                    .add(deleteSelectedButton))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 310, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void removeThisProperty(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_removeThisProperty
        if (removeListener != null)
        {
            removeListener.actionPerformed(new ActionEvent(this, 0, ""));
        }
    }//GEN-LAST:event_removeThisProperty


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton addInstructorButton;
    private javax.swing.JButton addStudentButton;
    private javax.swing.JButton deleteSelectedButton;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JButton removeButton;
    // End of variables declaration//GEN-END:variables

}
