/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ImportSettingsStatusJDialog.java
 *
 * Created on 9-dic-2009, 15.19.24
 */

package com.jaspersoft.ireport.designer.standalone.actions;

import javax.swing.JProgressBar;

/**
 *
 * @author gtoffoli
 */
public class ImportSettingsStatusJDialog extends javax.swing.JDialog {

    private ImportSettingsJob importSettingsJob = null;


    /** Creates new form ImportSettingsStatusJDialog */
    public ImportSettingsStatusJDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        setLocationRelativeTo(null);
    }

    public void setTextFile(String s)
    {
        jLabelSettingsFile.setText(org.openide.util.NbBundle.getMessage(ImportSettingsStatusJDialog.class, "ImportSettingsStatusJDialog.jLabelSettingsFile.text",s));
    }

    public JProgressBar getProgressBar()
    {
        return this.jProgressBar1;
    }


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

        jLabelSettingsFile = new javax.swing.JLabel();
        jProgressBar1 = new javax.swing.JProgressBar();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jLabelSettingsFile.setText(org.openide.util.NbBundle.getMessage(ImportSettingsStatusJDialog.class, "ImportSettingsStatusJDialog.jLabelSettingsFile.text")); // NOI18N

        jButton1.setText(org.openide.util.NbBundle.getMessage(ImportSettingsStatusJDialog.class, "ImportSettingsStatusJDialog.jButton1.text")); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jProgressBar1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 458, Short.MAX_VALUE)
                    .add(jLabelSettingsFile)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jButton1))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabelSettingsFile)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jProgressBar1, 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(jButton1)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

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

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        if (this.importSettingsJob != null)
        {
            this.importSettingsJob.getThread().interrupt();
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                ImportSettingsStatusJDialog dialog = new ImportSettingsStatusJDialog(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabelSettingsFile;
    private javax.swing.JProgressBar jProgressBar1;
    // End of variables declaration//GEN-END:variables

    

    void setImportSettingsJob(ImportSettingsJob aThis) {
        this.importSettingsJob = aThis;
    }

}
