/*
 * RunDialog_n.java
 *
 * Created on November 22, 2003, 4:09 PM
 */
package usda.weru.weps.gui;

import usda.weru.util.About;

/**
 * This "RUN dialog" GUI shows the progress of the run's execution process.The wind 
 * generation, climate file generation and the overall WEPS model itself is being 
 * monitored here.
 * @author  manmohan
 */
public class RunDialog_n extends javax.swing.JFrame {

    private static final long serialVersionUID = 1L;

    /**
     * Default constructor for the Run Dialog GUI object that helps the user in
     * getting to know how long will the run take to be executed before all the 
     * reports are generated. 
     * It also initializes the components that go in the GUI with default settings.
     */
    public RunDialog_n() {
        super();
        initComponents();
        setIconImage (About.getWeruIconImage());
    }

    /**
     * Single argument constructor for the Run Dialog GUI object that helps the user in
     * getting to know how long will the run take to be executed before all the 
     * reports are generated.
     * It also initializes the components that go in the GUI with default settings.
     * @param title The title string for the parent frame of the GUI.
     */
    public RunDialog_n(java.lang.String title) {
        this();
        setTitle(title);
    }

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

        JLabel4 = new javax.swing.JLabel();
        JLabel2 = new javax.swing.JLabel();
        JLabel3 = new javax.swing.JLabel();
        JTF_win = new javax.swing.JTextField();
        JTF_cli = new javax.swing.JTextField();
        JTF_weps = new javax.swing.JTextField();
        JPB_weps = new javax.swing.JProgressBar();
        JL_runName = new javax.swing.JLabel();
        JB_can = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        JTA_status = new javax.swing.JTextArea();
        JLabel5 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("Run Dialog");
        setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
        setMinimumSize(new java.awt.Dimension(310, 213));
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                RunDialog_n_WindowClosing(evt);
            }
        });

        JLabel4.setFont(JLabel4.getFont());
        JLabel4.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        JLabel4.setText("Wind Model :");

        JLabel2.setFont(JLabel2.getFont());
        JLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        JLabel2.setText("Climate Model :");

        JLabel3.setFont(JLabel3.getFont());
        JLabel3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        JLabel3.setText("WEPS Model :");

        JTF_win.setEditable(false);
        JTF_win.setFont(new java.awt.Font("Liberation Sans", 0, 12)); // NOI18N
        JTF_win.setHorizontalAlignment(javax.swing.JTextField.LEFT);

        JTF_cli.setEditable(false);
        JTF_cli.setFont(new java.awt.Font("Liberation Sans", 0, 12)); // NOI18N
        JTF_cli.setHorizontalAlignment(javax.swing.JTextField.LEFT);

        JTF_weps.setEditable(false);
        JTF_weps.setFont(new java.awt.Font("Liberation Sans", 0, 12)); // NOI18N
        JTF_weps.setHorizontalAlignment(javax.swing.JTextField.LEFT);

        JPB_weps.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 153, 153)));
        JPB_weps.setFocusable(false);
        JPB_weps.setStringPainted(true);

        JL_runName.setFont(JL_runName.getFont());
        JL_runName.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        JL_runName.setText("run name");
        JL_runName.setMaximumSize(new java.awt.Dimension(2147483647, 14));
        JL_runName.setMinimumSize(new java.awt.Dimension(310, 14));
        JL_runName.setPreferredSize(new java.awt.Dimension(310, 14));

        JB_can.setFont(JB_can.getFont());
        JB_can.setText("Cancel");
        JB_can.setToolTipText("RunDialog : Cancel");
        JB_can.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JBCan_ActionPerformed(evt);
            }
        });

        JTA_status.setEditable(false);
        JTA_status.setColumns(20);
        JTA_status.setFont(new java.awt.Font("Liberation Sans", 0, 12)); // NOI18N
        JTA_status.setLineWrap(true);
        JTA_status.setRows(3);
        JTA_status.setWrapStyleWord(true);
        JTA_status.setVerifyInputWhenFocusTarget(false);
        jScrollPane2.setViewportView(JTA_status);

        JLabel5.setFont(JLabel5.getFont().deriveFont(JLabel5.getFont().getSize()-2f));
        JLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        JLabel5.setText("Model Progress:");

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel1.setText("Model Info:");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(JL_runName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(JLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(JLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(JLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(JLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE)
                            .addComponent(JTF_win)
                            .addComponent(JTF_cli)
                            .addComponent(JTF_weps)
                            .addComponent(JPB_weps, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addGap(8, 8, 8))
            .addGroup(layout.createSequentialGroup()
                .addGap(162, 162, 162)
                .addComponent(JB_can)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(JL_runName, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JTF_win, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JTF_cli, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JTF_weps, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jScrollPane2)
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(JLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(JPB_weps, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(JB_can)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void JBCan_ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JBCan_ActionPerformed
        JBCan_actionPerformed(evt);
    }//GEN-LAST:event_JBCan_ActionPerformed

    private void RunDialog_n_WindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_RunDialog_n_WindowClosing
        this.dispose();
    }//GEN-LAST:event_RunDialog_n_WindowClosing

    /**
     * This method is used if this dialog is rum as an independent application. If executed,
     * makes the GUI visible.
     * @param evt The cancel button event is generated if the "Run dialog" is to be 
     * closed and the run itself "cancelled".
     */
    public void JBCan_actionPerformed(java.awt.event.ActionEvent evt) {

    }

    /**
     * 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[]) {
        new RunDialog_n().setVisible(true);
    }

    /**
     * This method notifies when the window or frame is resized and the components 
     * need to be re-arranged so they are evenly spaced relative to each other.
     */
    @Override
    public void addNotify() {
        super.addNotify();
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    public javax.swing.JButton JB_can;
    protected javax.swing.JLabel JL_runName;
    public javax.swing.JLabel JLabel2;
    public javax.swing.JLabel JLabel3;
    public javax.swing.JLabel JLabel4;
    public javax.swing.JLabel JLabel5;
    public javax.swing.JProgressBar JPB_weps;
    public javax.swing.JTextArea JTA_status;
    public javax.swing.JTextField JTF_cli;
    public javax.swing.JTextField JTF_weps;
    public javax.swing.JTextField JTF_win;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane2;
    // End of variables declaration//GEN-END:variables

}
