package nxm.sys.test;

/** A Class to test a DR 2309 and DR 2310.
    DR 2309: Tests to ensure that a ItemStateChange event on a JComboBox
    sends a DESELECTED and SELECTED event, which is passed via Message.quals.
    DR 2310: Tests to ensure that the user may invoke an ItemStateChange
    event on a JComboBox using WidgetWrapper while preventing a Message from
    being sent (@see WidgetWrapper.setValue).
    See Bug 2228 for more details
    @author crs
 */
@SuppressWarnings({"serial","rawtypes"}) // <-- NOTE: JDK7 has rawtypes Xlint warnings that CANNOT be fixed since we still support JDK6
public class test_widget_wrapper extends javax.swing.JFrame {

    /** Creates new form test_widget_wrapper */
    public test_widget_wrapper() {
        initComponents();
    }

    /** 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() {

    main = new javax.swing.ButtonGroup();
    jScrollPane1 = new javax.swing.JScrollPane();
    idtext = new javax.swing.JTextArea();
    jPanel1 = new javax.swing.JPanel();
    msgCombo1 = new javax.swing.JComboBox();
    passButton = new javax.swing.JButton();
    failButton = new javax.swing.JButton();
    msglog = new nxm.sys.libg.MidasDisplay();
    lblInstructions = new javax.swing.JLabel();
    invokeWithMessage = new javax.swing.JButton();
    invokeWithoutMessage = new javax.swing.JButton();
    lblInstructions2 = new javax.swing.JLabel();
    jScrollPane2 = new javax.swing.JScrollPane();
    idtext2 = new javax.swing.JTextArea();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

    idtext.setColumns(10);
    idtext.setEditable(false);
    idtext.setLineWrap(true);
    idtext.setRows(5);
    jScrollPane1.setViewportView(idtext);

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
      jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGap(0, 0, Short.MAX_VALUE)
    );
    jPanel1Layout.setVerticalGroup(
      jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGap(0, 0, Short.MAX_VALUE)
    );

    msgCombo1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "AAAA", "BBBB" }));
    msgCombo1.setEnabled(false);

    passButton.setForeground(new java.awt.Color(58, 193, 96));
    passButton.setText("Pass");
    main.add(passButton);

    failButton.setForeground(new java.awt.Color(236, 2, 2));
    failButton.setText("Fail");
    main.add(failButton);

    javax.swing.GroupLayout msglogLayout = new javax.swing.GroupLayout(msglog);
    msglog.setLayout(msglogLayout);
    msglogLayout.setHorizontalGroup(
      msglogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGap(0, 830, Short.MAX_VALUE)
    );
    msglogLayout.setVerticalGroup(
      msglogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGap(0, 101, Short.MAX_VALUE)
    );

    lblInstructions.setFont(new java.awt.Font("DejaVu Sans", 1, 13));
    lblInstructions.setText("Test Case #1 Instructions:");

    invokeWithMessage.setText("Invoke with Message");

    invokeWithoutMessage.setText("Invoke without a Message");
    invokeWithoutMessage.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        invokeWithoutMessageActionPerformed(evt);
      }
    });

    lblInstructions2.setFont(new java.awt.Font("DejaVu Sans", 1, 13));
    lblInstructions2.setText("Test Case #2 Instructions:");

    idtext2.setColumns(10);
    idtext2.setEditable(false);
    idtext2.setLineWrap(true);
    idtext2.setRows(5);
    jScrollPane2.setViewportView(idtext2);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(layout.createSequentialGroup()
        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 820, javax.swing.GroupLayout.PREFERRED_SIZE))
          .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(lblInstructions))
          .addGroup(layout.createSequentialGroup()
            .addGap(12, 12, 12)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 820, javax.swing.GroupLayout.PREFERRED_SIZE)
              .addGroup(layout.createSequentialGroup()
                .addComponent(invokeWithMessage)
                .addGap(160, 160, 160)
                .addComponent(msgCombo1, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE))
              .addGroup(layout.createSequentialGroup()
                .addComponent(passButton, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(12, 12, 12)
                .addComponent(failButton, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))
              .addComponent(msglog, javax.swing.GroupLayout.PREFERRED_SIZE, 830, javax.swing.GroupLayout.PREFERRED_SIZE)))
          .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(invokeWithoutMessage))
          .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(lblInstructions2)))
        .addContainerGap(38, Short.MAX_VALUE))
    );
    layout.setVerticalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(layout.createSequentialGroup()
        .addGap(6, 6, 6)
        .addComponent(lblInstructions)
        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
        .addComponent(lblInstructions2)
        .addGap(9, 9, 9)
        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addGap(9, 9, 9)
        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
          .addComponent(invokeWithMessage)
          .addComponent(msgCombo1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
        .addComponent(invokeWithoutMessage)
        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
        .addComponent(msglog, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addGap(12, 12, 12)
        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addComponent(passButton)
          .addComponent(failButton))
        .addContainerGap(13, Short.MAX_VALUE))
    );

    pack();
  }// </editor-fold>//GEN-END:initComponents

    private void invokeWithoutMessageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_invokeWithoutMessageActionPerformed
      // TODO add your handling code here:
    }//GEN-LAST:event_invokeWithoutMessageActionPerformed

    /** main
    *   @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new test_widget_wrapper().setVisible(true);

            }
        });
    }

  // Variables declaration - do not modify//GEN-BEGIN:variables
  /** The FAIL status button */
  private javax.swing.JButton failButton;
  /** The test-case-1 instructions text area */
  private javax.swing.JTextArea idtext;
  /** The test-case-2 instructions text area */
  private javax.swing.JTextArea idtext2;
  /** The invoke-with-message button */
  private javax.swing.JButton invokeWithMessage;
  /** The invoke-without-message button */
  private javax.swing.JButton invokeWithoutMessage;
  /** The unused panel */
  private javax.swing.JPanel jPanel1;
  /** The test-case-1 instructions scroll pane containing the test-case-1 instructions text area */
  private javax.swing.JScrollPane jScrollPane1;
  /** The test-case-2 instructions scroll pane containing the test-case-2 instructions text area */
  private javax.swing.JScrollPane jScrollPane2;
  /** The test-case-1 instructions label */
  private javax.swing.JLabel lblInstructions;
  /** The test-case-1 instructions label */
  private javax.swing.JLabel lblInstructions2;
  /** The main button group containing the PASS/FAIL status buttons */
  private javax.swing.ButtonGroup main;
  /** The message combo box */
  private javax.swing.JComboBox msgCombo1;
  /** The message log display */
  private nxm.sys.libg.MidasDisplay msglog;
  /** The PASS status button */
  private javax.swing.JButton passButton;
  // End of variables declaration//GEN-END:variables

}
