package usda.weru.weps.gui;

import de.schlichtherle.truezip.file.TFile;
import java.awt.Component;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import usda.weru.util.ConfigData;
import usda.weru.util.Util;
import usda.weru.util.WepsFileField;
import usda.weru.weps.Weps;

/**
 *
 * @author willy
 */
public class RunExporter_n extends javax.swing.JPanel{
    
     private static final long serialVersionUID = 1L;
    /**
     * Creates new form RunExporter_n
     */
    public RunExporter_n(TFile source) {
        initComponents();
        g_source.setMode(WepsFileField.MODE.SELECT);
        g_source.setFileType(WepsFileField.TYPE.RUN);
        if(source != null){
            g_source.setText(source.getPath());
            g_source.setFile(source);
        }
        g_dest.setMode(WepsFileField.MODE.SELECT);
        g_dest.setFileType(WepsFileField.TYPE.DIRECTORY);
    }

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

        g_sourceLabel = new javax.swing.JLabel();
        g_source = new usda.weru.util.WepsFileField();
        g_source.setFileType(WepsFileField.TYPE.RUN);
        g_destLabel = new javax.swing.JLabel();
        g_dest = new usda.weru.util.WepsFileField(Util.parse(ConfigData.getDefault().getData(ConfigData.ProjDir)+"/exported WEPS runs"));
        g_source.setFileType(WepsFileField.TYPE.RUN);
        g_zipContents = new javax.swing.JCheckBox();
        g_removeCheckBox = new javax.swing.JCheckBox();

        org.openide.awt.Mnemonics.setLocalizedText(g_sourceLabel, org.openide.util.NbBundle.getMessage(RunExporter_n.class, "RunExporter_n.g_sourceLabel.text")); // NOI18N

        g_source.setFileType(usda.weru.util.WepsFileField.TYPE.RUN);

        org.openide.awt.Mnemonics.setLocalizedText(g_destLabel, org.openide.util.NbBundle.getMessage(RunExporter_n.class, "RunExporter_n.g_destLabel.text")); // NOI18N

        g_dest.setFileType(usda.weru.util.WepsFileField.TYPE.DIRECTORY);

        g_zipContents.setSelected(true);
        org.openide.awt.Mnemonics.setLocalizedText(g_zipContents, org.openide.util.NbBundle.getMessage(RunExporter_n.class, "RunExporter_n.g_zipContents.text")); // NOI18N
        g_zipContents.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                g_zipContentsActionPerformed(evt);
            }
        });

        org.openide.awt.Mnemonics.setLocalizedText(g_removeCheckBox, org.openide.util.NbBundle.getMessage(RunExporter_n.class, "RunExporter_n.g_removeCheckBox.text")); // NOI18N
        g_removeCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                g_removeCheckBoxActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(g_destLabel, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(g_sourceLabel, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(g_dest, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(g_source, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(g_removeCheckBox)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addComponent(g_zipContents, javax.swing.GroupLayout.DEFAULT_SIZE, 809, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(g_source, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(g_sourceLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(g_dest, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(g_destLabel))
                .addGap(18, 18, Short.MAX_VALUE)
                .addComponent(g_zipContents)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(g_removeCheckBox))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void g_zipContentsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_g_zipContentsActionPerformed
        zipContentsActionPerformed(evt);
    }//GEN-LAST:event_g_zipContentsActionPerformed

    private void g_removeCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_g_removeCheckBoxActionPerformed
        removeCheckBoxActionPerformed(evt);
    }//GEN-LAST:event_g_removeCheckBoxActionPerformed
   
    protected void zipContentsActionPerformed(java.awt.event.ActionEvent evt){
    }
    protected void removeCheckBoxActionPerformed(java.awt.event.ActionEvent evt){
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    protected usda.weru.util.WepsFileField g_dest;
    private javax.swing.JLabel g_destLabel;
    protected javax.swing.JCheckBox g_removeCheckBox;
    protected usda.weru.util.WepsFileField g_source;
    private javax.swing.JLabel g_sourceLabel;
    protected javax.swing.JCheckBox g_zipContents;
    // End of variables declaration//GEN-END:variables
}
