/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package turgen.config;

import turgen.generator.PulseCrate;

/**
 *
 * @author michael
 */
public class PulseCorrectionPanel extends javax.swing.JPanel {

    /**
     * Creates new form PulseCorretionPanel
     */
    public PulseCorrectionPanel() {
        initComponents();
    }
    
    public void setCorrectionCrate(PulseCrate p) {
        
        jspPilot.setValue(Integer.valueOf(p.pilotTonePulseWidth));
        jspWide.setValue(Integer.valueOf(p.longPulseWidth));
        jspNarrow.setValue(Integer.valueOf(p.shortPulseWidth));
        jspSync.setValue(Integer.valueOf(p.syncPulseWidth));
        jspStop.setValue(Integer.valueOf(p.stopPulseWidth));
    }
    
    public PulseCrate getCorrectionCrate() {
        PulseCrate cCrate = new PulseCrate();
        cCrate.pilotTonePulseWidth=((Integer)jspPilot.getValue()).intValue();
        cCrate.longPulseWidth=((Integer)jspWide.getValue()).intValue();
        cCrate.shortPulseWidth=((Integer)jspNarrow.getValue()).intValue();
        cCrate.syncPulseWidth=((Integer)jspSync.getValue()).intValue();
        cCrate.stopPulseWidth=((Integer)jspStop.getValue()).intValue();
        return cCrate;
    }

    /**
     * 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() {
        java.awt.GridBagConstraints gridBagConstraints;

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jspPilot = new javax.swing.JSpinner();
        jspWide = new javax.swing.JSpinner();
        jspNarrow = new javax.swing.JSpinner();
        jspSync = new javax.swing.JSpinner();
        jspStop = new javax.swing.JSpinner();
        pFiller = new javax.swing.JPanel();

        setLayout(new java.awt.GridBagLayout());

        jLabel1.setText("Pilot");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(2, 4, 0, 0);
        add(jLabel1, gridBagConstraints);

        jLabel2.setText("Wide");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(2, 4, 0, 0);
        add(jLabel2, gridBagConstraints);

        jLabel3.setText("Narrow");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(2, 4, 0, 0);
        add(jLabel3, gridBagConstraints);

        jLabel4.setText("Sync");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(2, 4, 0, 0);
        add(jLabel4, gridBagConstraints);

        jLabel5.setText("Stop");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 4;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(2, 4, 0, 0);
        add(jLabel5, gridBagConstraints);

        jspPilot.setModel(new javax.swing.SpinnerNumberModel(0, -16, 16, 1));
        jspPilot.setToolTipText("");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(2, 4, 0, 0);
        add(jspPilot, gridBagConstraints);

        jspWide.setModel(new javax.swing.SpinnerNumberModel(0, -16, 16, 1));
        jspWide.setToolTipText("");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(2, 4, 0, 0);
        add(jspWide, gridBagConstraints);

        jspNarrow.setModel(new javax.swing.SpinnerNumberModel(0, -16, 16, 1));
        jspNarrow.setToolTipText("");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(2, 4, 0, 0);
        add(jspNarrow, gridBagConstraints);

        jspSync.setModel(new javax.swing.SpinnerNumberModel(0, -16, 16, 1));
        jspSync.setToolTipText("");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(2, 4, 0, 0);
        add(jspSync, gridBagConstraints);

        jspStop.setModel(new javax.swing.SpinnerNumberModel(0, -16, 16, 1));
        jspStop.setToolTipText("");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 4;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(2, 4, 0, 0);
        add(jspStop, gridBagConstraints);

        pFiller.setLayout(null);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 6;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridheight = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        add(pFiller, gridBagConstraints);
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JSpinner jspNarrow;
    private javax.swing.JSpinner jspPilot;
    private javax.swing.JSpinner jspStop;
    private javax.swing.JSpinner jspSync;
    private javax.swing.JSpinner jspWide;
    private javax.swing.JPanel pFiller;
    // End of variables declaration//GEN-END:variables
}
