<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
package usda.weru.util.wepsFileChooser2;

import de.schlichtherle.truezip.file.TFile;
import static java.awt.Dialog.ModalityType.*;
import java.awt.Dimension;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import javax.swing.JOptionPane;
import static javax.swing.JOptionPane.showMessageDialog;
import usda.weru.remoteDataAccess.csip.CsipLmodUtil;
import usda.weru.remoteDataAccess.csip.CsipLmodUtil.lmodType;
import usda.weru.remoteDataAccess.remoteFiles.inetFile.CrLmodFile;
import usda.weru.util.About;
import usda.weru.util.ConfigData;
import usda.weru.util.wepsFileChooser2.WfcFileListTable.showFileNameType;
import usda.weru.weps.Weps;

/**
 *
 * @author mhaas
 */
public class WepsFileChooser2_n extends javax.swing.JDialog implements PropertyChangeListener {
    
    static final long serialVersionUID = 1L;

    protected WepsFileChooser2_n mainDlg;
    protected boolean persitSelectedFile;
    
    protected boolean isOperationChooser = false;
    protected boolean isCropChooser = false;
    
    public WepsFileChooser2_n() {
        super();
        setModalityType(APPLICATION_MODAL);
        this.setAlwaysOnTop(true);
        init();
    }
    
    public WepsFileChooser2_n(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        init();
    }
    public WepsFileChooser2_n(java.awt.Window parent, boolean modal) {
//        Dialog.ModalityType modality = modal ? APPLICATION_MODAL : MODELESS;
        super(parent, modal ? APPLICATION_MODAL : MODELESS);
        init();
    }
    private void init() {

        persitSelectedFile = false;
        
        initComponents();
        
        JB_NewDir.setVisible(false);
        
        mainDlg = this;

        setTitle("Weps File Chooser");
        
        JT_dirList.setup();

        // hook the path combo and the file display together
        JCB_Path.addPropertyChangeListener(JT_dirList);
        JCB_FileTypes.addPropertyChangeListener(JT_dirList);
        JT_dirList.addPropertyChangeListener(JCB_Path);
        JT_dirList.addPropertyChangeListener(this);
        
        hideFolderButtons();
    }
    
    /**
     * The folder buttons are the buttons for templates.
     * [ System T, Local T, Shared T, CRLmod T ]
     */
    private void hideFolderButtons() {
        loctemp_button.setVisible(false);
        systemp_button.setVisible(false);
        sharetemp_button.setVisible(false);
        crlmod_button.setVisible(false);
    }
    
    public void enableFolderButtons() {
        //System.out.println("allowing buttons!");
        if(isOperationChooser) {
            loctemp_button.setVisible(ConfigData.checkParmValue(ConfigData.loopCheck, "1"));
            systemp_button.setVisible(ConfigData.checkParmValue(ConfigData.manOpDbCheck, "1"));
            sharetemp_button.setVisible(ConfigData.checkParmValue(ConfigData.shopCheck, "1"));
            crlmod_button.setVisible(ConfigData.checkParmValue(ConfigData.cropCheck, "1"));
        } else if(isCropChooser) {
            loctemp_button.setVisible(ConfigData.checkParmValue(ConfigData.locCropCheck, "1"));
            systemp_button.setVisible(ConfigData.checkParmValue(ConfigData.cropDbCheck, "1"));
            sharetemp_button.setVisible(ConfigData.checkParmValue(ConfigData.shaCropCheck, "1"));
            crlmod_button.setVisible(ConfigData.checkParmValue(ConfigData.crlmodCropCheck, "1"));
        } else {
            loctemp_button.setVisible(ConfigData.checkParmValue(ConfigData.locManTemp, "1"));
            systemp_button.setVisible(ConfigData.checkParmValue(ConfigData.sysManTemp, "1"));
            sharetemp_button.setVisible(ConfigData.checkParmValue(ConfigData.shaManTemp, "1"));
            crlmod_button.setVisible(ConfigData.checkParmValue(ConfigData.crlmodEnabled, "1"));
        }
    }
    
    public void enableFolderButtonsSave() {
        //System.out.println("allowing buttons!");
        if(isOperationChooser) {
            loctemp_button.setVisible(ConfigData.checkParmValue(ConfigData.loopCheck, "1"));
            systemp_button.setVisible(false);
            sharetemp_button.setVisible(ConfigData.checkParmValue(ConfigData.shopCheck, "1"));
            crlmod_button.setVisible(false);
        } else if(isCropChooser) {
            loctemp_button.setVisible(ConfigData.checkParmValue(ConfigData.locCropCheck, "1"));
            systemp_button.setVisible(false);
            sharetemp_button.setVisible(ConfigData.checkParmValue(ConfigData.shaCropCheck, "1"));
            crlmod_button.setVisible(false);
        } else {
           loctemp_button.setVisible(ConfigData.checkParmValue(ConfigData.locManTemp, "1"));
            systemp_button.setVisible(false);
            sharetemp_button.setVisible(ConfigData.checkParmValue(ConfigData.shaManTemp, "1"));
            crlmod_button.setVisible(false); 
        }
        
    }
    
    public void setPersitSelectedFile (boolean setVal) {
        persitSelectedFile = setVal;
    }
    
    protected void doSelectButtonAction () {
        
    }
    
    public void setOperationChooser() {
        isOperationChooser = true;
        loctemp_button.setText("Local Op");
        sharetemp_button.setText("Shared Op");
        systemp_button.setText("System Op");
        crlmod_button.setText("CrLmod Op");
    }
    
    public void setCropChooser() {
        isCropChooser = true;
        loctemp_button.setText("Local C/R");
        sharetemp_button.setText("Shared C/R");
        systemp_button.setText("System C/R");
        crlmod_button.setText("CrLmod C/R");
    }
    
    /**
     * This handles the selecting of a file from the two ways it could be done. 
     * One is using the select button, the other is with a double click from the
     * interface.
     * @param evt 
     */
    @Override
    public void propertyChange(PropertyChangeEvent evt) {
        // Select button
        if (evt.getPropertyName().equals(WfcFileListTable.propChangeCmdStrFileSected)) {
            //File f = (File)evt.getNewValue();
            doSelectButtonAction();
        } else if (evt.getPropertyName().equals(WfcFileListTable.propChangeCmdSetFilename)) {
        // Double click fired
            showFileNameType type = null;
            if (evt.getOldValue() instanceof showFileNameType) {
                type = (showFileNameType)evt.getOldValue();
            }
            File f = (File)evt.getNewValue();
            //System.out.println("New Path Value: " + f.getAbsolutePath());
            if (f != null &amp;&amp; !persitSelectedFile &amp;&amp; (type == null || type == showFileNameType.Mouse)) {
                // Settin this to absolute or canonical will brick the fileChooser. Path will double itself
                JTF_SelectedFile.setText(f.getName());
            }
        }
    }
    
    protected void close () {
        dispose();
    }
    
    /**
     * 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","rawtypes", "serial"})
    // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt;//GEN-BEGIN:initComponents
    private void initComponents() {

        JB_Close = new javax.swing.JButton();
        JB_Select = new javax.swing.JButton();
        JCB_Path = new usda.weru.util.wepsFileChooser2.WfcPathComboBox();
        JB_Details = new javax.swing.JToggleButton();
        jLabel3 = new javax.swing.JLabel();
        JTF_SelectedFile = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        JCB_FileTypes = new usda.weru.util.wepsFileChooser2.WfcFileTypeComboBox();
        JL_CustomMessage = new javax.swing.JLabel();
        JSCP_DirPane = new javax.swing.JScrollPane();
        JT_dirList = new usda.weru.util.wepsFileChooser2.WfcFileListTable();
        jLabel2 = new javax.swing.JLabel();
        JB_NewDir = new javax.swing.JButton();
        filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(18, 18), new java.awt.Dimension(18, 18), new java.awt.Dimension(18, 18));
        JB_ProjDir = new javax.swing.JButton();
        JB_HomeDir = new javax.swing.JButton();
        JP_Accessory = new javax.swing.JPanel();
        JB_UpDir = new javax.swing.JButton();
        JB_DefaultDir = new javax.swing.JButton();
        systemp_button = new javax.swing.JButton();
        loctemp_button = new javax.swing.JButton();
        sharetemp_button = new javax.swing.JButton();
        crlmod_button = new javax.swing.JButton();
        JB_dbDir = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setModal(true);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        JB_Close.setText("Cancel");
        JB_Close.setMargin(new java.awt.Insets(2, 8, 2, 8));
        JB_Close.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_CloseActionPerformed(evt);
            }
        });

        JB_Select.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        JB_Select.setText("Select");
        JB_Select.setMargin(new java.awt.Insets(2, 8, 2, 8));
        JB_Select.setMaximumSize(new java.awt.Dimension(60, 25));
        JB_Select.setMinimumSize(new java.awt.Dimension(60, 25));
        JB_Select.setPreferredSize(new java.awt.Dimension(60, 25));
        JB_Select.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_SelectActionPerformed(evt);
            }
        });
        JB_Select.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                JB_SelectPropertyChange(evt);
            }
        });

        JCB_Path.setEditable(true);
        JCB_Path.setToolTipText(JCB_Path.getSelectedDir().getAbsolutePath());

        JB_Details.setFont(new java.awt.Font("Tahoma", 0, 9)); // NOI18N
        JB_Details.setText("List Details");
        JB_Details.setMaximumSize(new java.awt.Dimension(53, 27));
        JB_Details.setMinimumSize(new java.awt.Dimension(53, 27));
        JB_Details.setPreferredSize(new java.awt.Dimension(53, 27));
        JB_Details.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_DetailsActionPerformed(evt);
            }
        });

        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel3.setText("File:  ");
        jLabel3.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jLabel3.setPreferredSize(new java.awt.Dimension(24, 18));

        JTF_SelectedFile.setMargin(new java.awt.Insets(2, 2, 0, 2));

        jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel5.setText("File types: ");
        jLabel5.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);

        JCB_FileTypes.setEditable(true);
        JCB_FileTypes.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                JCB_FileTypesPropertyChange(evt);
            }
        });

        JL_CustomMessage.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        JL_CustomMessage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        JT_dirList.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "icon", "name", "type", "date", "size (bytes)"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        JT_dirList.setColumnSelectionAllowed(true);
        JT_dirList.setIntercellSpacing(new java.awt.Dimension(5, 1));
        JT_dirList.setShowHorizontalLines(false);
        JT_dirList.setShowVerticalLines(false);
        JSCP_DirPane.setViewportView(JT_dirList);
        JT_dirList.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        if (JT_dirList.getColumnModel().getColumnCount() &gt; 0) {
            JT_dirList.getColumnModel().getColumn(0).setPreferredWidth(6);
            JT_dirList.getColumnModel().getColumn(0).setMaxWidth(6);
            JT_dirList.getColumnModel().getColumn(1).setPreferredWidth(600);
            JT_dirList.getColumnModel().getColumn(2).setMinWidth(36);
            JT_dirList.getColumnModel().getColumn(2).setPreferredWidth(36);
            JT_dirList.getColumnModel().getColumn(3).setMinWidth(172);
            JT_dirList.getColumnModel().getColumn(3).setPreferredWidth(172);
            JT_dirList.getColumnModel().getColumn(4).setMinWidth(72);
            JT_dirList.getColumnModel().getColumn(4).setPreferredWidth(72);
        }

        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel2.setText("Path: ");
        jLabel2.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);

        JB_NewDir.setFont(new java.awt.Font("Tahoma", 0, 9)); // NOI18N
        JB_NewDir.setText("New dir");
        JB_NewDir.setMargin(new java.awt.Insets(2, 2, 2, 2));
        JB_NewDir.setMinimumSize(new java.awt.Dimension(48, 18));
        JB_NewDir.setPreferredSize(new java.awt.Dimension(48, 18));
        JB_NewDir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_NewDirActionPerformed(evt);
            }
        });

        JB_ProjDir.setFont(new java.awt.Font("Tahoma", 0, 9)); // NOI18N
        JB_ProjDir.setText("Proj Dir");
        JB_ProjDir.setToolTipText("Project Directory");
        JB_ProjDir.setMargin(new java.awt.Insets(2, 2, 2, 2));
        JB_ProjDir.setMaximumSize(new java.awt.Dimension(41, 27));
        JB_ProjDir.setMinimumSize(new java.awt.Dimension(41, 27));
        JB_ProjDir.setPreferredSize(new java.awt.Dimension(41, 27));
        JB_ProjDir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_projDirActionPerformed(evt);
            }
        });

        JB_HomeDir.setFont(new java.awt.Font("Tahoma", 0, 9)); // NOI18N
        JB_HomeDir.setText("Home");
        JB_HomeDir.setToolTipText("Home Directory");
        JB_HomeDir.setMargin(new java.awt.Insets(2, 2, 2, 2));
        JB_HomeDir.setMaximumSize(new java.awt.Dimension(33, 27));
        JB_HomeDir.setMinimumSize(new java.awt.Dimension(33, 27));
        JB_HomeDir.setPreferredSize(new java.awt.Dimension(33, 27));
        JB_HomeDir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_HomeDirActionPerformed(evt);
            }
        });

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

        JB_UpDir.setFont(new java.awt.Font("Tahoma", 0, 9)); // NOI18N
        JB_UpDir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/usda/weru/resources/updir.gif"))); // NOI18N
        JB_UpDir.setToolTipText("Up Directory");
        JB_UpDir.setMargin(new java.awt.Insets(2, 2, 2, 2));
        JB_UpDir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_UpDirActionPerformed(evt);
            }
        });

        JB_DefaultDir.setFont(new java.awt.Font("Tahoma", 0, 9)); // NOI18N
        JB_DefaultDir.setText("Def Loc");
        JB_DefaultDir.setToolTipText("Default Location");
        JB_DefaultDir.setMargin(new java.awt.Insets(2, 2, 2, 2));
        JB_DefaultDir.setMaximumSize(new java.awt.Dimension(39, 27));
        JB_DefaultDir.setMinimumSize(new java.awt.Dimension(39, 27));
        JB_DefaultDir.setPreferredSize(new java.awt.Dimension(39, 27));
        JB_DefaultDir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_DefaultDirActionPerformed(evt);
            }
        });

        systemp_button.setFont(new java.awt.Font("Tahoma", 0, 9)); // NOI18N
        systemp_button.setText("System T");
        systemp_button.setToolTipText("System Templates");
        systemp_button.setMargin(new java.awt.Insets(2, 2, 2, 2));
        systemp_button.setMaximumSize(new java.awt.Dimension(27, 27));
        systemp_button.setMinimumSize(new java.awt.Dimension(27, 27));
        systemp_button.setPreferredSize(new java.awt.Dimension(27, 27));
        systemp_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_SysTempActionPerformed(evt);
            }
        });

        loctemp_button.setFont(new java.awt.Font("Tahoma", 0, 9)); // NOI18N
        loctemp_button.setText("Local T");
        loctemp_button.setToolTipText("Local Templates");
        loctemp_button.setMargin(new java.awt.Insets(2, 2, 2, 2));
        loctemp_button.setMaximumSize(new java.awt.Dimension(66, 27));
        loctemp_button.setMinimumSize(new java.awt.Dimension(66, 27));
        loctemp_button.setPreferredSize(new java.awt.Dimension(66, 27));
        loctemp_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_LocTempActionPerformed(evt);
            }
        });

        sharetemp_button.setFont(new java.awt.Font("Tahoma", 0, 9)); // NOI18N
        sharetemp_button.setText("Shared T");
        sharetemp_button.setToolTipText("Shared Templates");
        sharetemp_button.setMargin(new java.awt.Insets(2, 2, 2, 2));
        sharetemp_button.setMaximumSize(new java.awt.Dimension(75, 27));
        sharetemp_button.setMinimumSize(new java.awt.Dimension(75, 27));
        sharetemp_button.setPreferredSize(new java.awt.Dimension(75, 27));
        sharetemp_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_ShaTempActionPerformed(evt);
            }
        });

        crlmod_button.setFont(new java.awt.Font("Tahoma", 0, 9)); // NOI18N
        crlmod_button.setText("CrLmod T");
        crlmod_button.setMargin(new java.awt.Insets(2, 2, 2, 2));
        crlmod_button.setMaximumSize(new java.awt.Dimension(55, 27));
        crlmod_button.setMinimumSize(new java.awt.Dimension(55, 27));
        crlmod_button.setPreferredSize(new java.awt.Dimension(55, 27));
        crlmod_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_CrLmodActionPerformed(evt);
            }
        });

        JB_dbDir.setFont(new java.awt.Font("Tahoma", 0, 9)); // NOI18N
        JB_dbDir.setText("Database");
        JB_dbDir.setMargin(new java.awt.Insets(2, 2, 2, 2));
        JB_dbDir.setMaximumSize(new java.awt.Dimension(79, 27));
        JB_dbDir.setMinimumSize(new java.awt.Dimension(79, 27));
        JB_dbDir.setPreferredSize(new java.awt.Dimension(79, 27));
        JB_dbDir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_dbDirActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, 8, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel3, 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)
                            .addComponent(JCB_FileTypes, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(JTF_SelectedFile))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(JB_Select, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(JB_NewDir, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(JB_Close)
                        .addGap(23, 23, 23))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(JSCP_DirPane)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addGap(11, 11, 11)
                                .addComponent(JCB_Path, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(JB_DefaultDir, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(systemp_button, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(loctemp_button, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(sharetemp_button, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(crlmod_button, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(JB_dbDir, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(JB_ProjDir, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(JB_HomeDir, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(JB_UpDir)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(JB_Details, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(JP_Accessory, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(JL_CustomMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 528, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(32, 32, 32))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(JL_CustomMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(JCB_Path, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(JB_UpDir, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(JB_ProjDir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(JB_HomeDir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(JB_dbDir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(crlmod_button, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(JB_Details, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(JB_DefaultDir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(systemp_button, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(loctemp_button, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(sharetemp_button, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(JSCP_DirPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                        .addGap(17, 17, 17))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(JP_Accessory, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(85, 85, 85)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(JB_NewDir, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JTF_SelectedFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(JB_Close)
                    .addComponent(JB_Select, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JCB_FileTypes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(280, 280, 280)
                .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(48, 48, 48))
        );

        pack();
    }// &lt;/editor-fold&gt;//GEN-END:initComponents

    private void JB_CloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_CloseActionPerformed
        close();
    }//GEN-LAST:event_JB_CloseActionPerformed

    private void JB_SelectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_SelectActionPerformed
        doSelectButtonAction();
    }//GEN-LAST:event_JB_SelectActionPerformed

    private void JB_DetailsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_DetailsActionPerformed
        JT_dirList.showDetails(JB_Details.isSelected());
    }//GEN-LAST:event_JB_DetailsActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        //
    }//GEN-LAST:event_formWindowClosing

    private void JB_NewDirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_NewDirActionPerformed
        String dirNameInput = JOptionPane.showInputDialog(this, "Please specify a name for the new directory", "Specify a new directory", JOptionPane.OK_CANCEL_OPTION); 
        if (dirNameInput != null) {
            File newDir = new File (JCB_Path.getSelectedDir().getAbsoluteFile(), dirNameInput);

            if (!newDir.mkdirs()) {
                showMessageDialog(this, "Cannot create the specified directory, please re-specify", "Error", JOptionPane.ERROR_MESSAGE);
            }

            JT_dirList.doRefreshAndSelectDir(newDir);
            JTF_SelectedFile.setText(dirNameInput);
        }
    }//GEN-LAST:event_JB_NewDirActionPerformed

    private void JB_projDirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_projDirActionPerformed
        JCB_Path.selectProjDir();
    }//GEN-LAST:event_JB_projDirActionPerformed

    private void JB_HomeDirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_HomeDirActionPerformed
        JCB_Path.selectHomeDir();
    }//GEN-LAST:event_JB_HomeDirActionPerformed

    private void JB_UpDirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_UpDirActionPerformed
        JCB_Path.upOneDir();
    }//GEN-LAST:event_JB_UpDirActionPerformed

    private void JB_DefaultDirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_DefaultDirActionPerformed
        JCB_Path.selectDefaultDir();
    }//GEN-LAST:event_JB_DefaultDirActionPerformed

    private void JB_SelectPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_JB_SelectPropertyChange
        if (evt.getPropertyName().contentEquals("text")) {
            int diff = JB_Select.getPreferredSize().width - JB_Select.getSize().width;
            if (diff &gt; 0) {
                Dimension d = this.getSize();
                d.width += diff + 6;
                this.setSize(d);
            }
        }
    }//GEN-LAST:event_JB_SelectPropertyChange

    private void JB_SysTempActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_SysTempActionPerformed
        if(isOperationChooser) {
            System.out.println("Loading System Operation Location");
            JCB_Path.selectDir(Weps.getInstance().cd.getData(ConfigData.SystemOpDB));
        } else if(isCropChooser) {
            System.out.println("Loading System Crop Location");
            JCB_Path.selectDir(Weps.getInstance().cd.getData(ConfigData.SystemCropDB));
        } else {
            System.out.println("Loading System Management Location");
            JCB_Path.selectDir(Weps.getInstance().cd.getData(ConfigData.ManTemp));
        }
    }//GEN-LAST:event_JB_SysTempActionPerformed

    private void JB_LocTempActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_LocTempActionPerformed
        if(isOperationChooser) {
            System.out.println("Loading Local Operation Location");
            JCB_Path.selectDir(Weps.getInstance().cd.getData(ConfigData.LocalOpDB));
        } else if(isCropChooser) {
            System.out.println("Loading Local Crop Location");
            JCB_Path.selectDir(Weps.getInstance().cd.getData(ConfigData.LocalCropDB));
        } else {
            System.out.println("Loading Local Management Location");
            JCB_Path.selectDir(Weps.getInstance().cd.getData(ConfigData.LocalManDB));
        }
    }//GEN-LAST:event_JB_LocTempActionPerformed

    private void JB_ShaTempActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_ShaTempActionPerformed
        if(isOperationChooser) {
            System.out.println("Loading Shared Operation Location");
            JCB_Path.selectDir(Weps.getInstance().cd.getData(ConfigData.shopLocation));
        } else if(isCropChooser) {
            System.out.println("Loading Shared Crop Location");
            JCB_Path.selectDir(Weps.getInstance().cd.getData(ConfigData.localResidueRecords));
        } else {
            System.out.println("Loading Shared Management Location");
            JCB_Path.selectDir(Weps.getInstance().cd.getData(ConfigData.SharedManDB));
        }
    }//GEN-LAST:event_JB_ShaTempActionPerformed

    private void JB_CrLmodActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_CrLmodActionPerformed
        File rootFile;
        if(isOperationChooser) {
            System.out.println("Loading CRLMOD Operation Location");
            rootFile = new CrLmodFile("CrLmod Operations", lmodType.lmodOperation);
            rootFile.listFiles();
            JCB_Path.addAndSelectItem(rootFile);
        } else if(isCropChooser) {
            System.out.println("Loading CRLMOD Crop Location");
            //rootFile = new CrLmodFile("CrLmod Crops and Residues", lmodType.lmodCrop);
            rootFile = new TFile(About.getWepsCacheDir(), CsipLmodUtil.WepsCacheDirNameCrop);
            //rootFile.listFiles();
            JCB_Path.addAndSelectItem(rootFile);
        } else {
            System.out.println("Loading CRLMOD Management Location");
            rootFile = new CrLmodFile("CrLmod Managements", lmodType.lmodManagement);
            rootFile.listFiles();
            JCB_Path.addAndSelectItem(rootFile);
        }
    }//GEN-LAST:event_JB_CrLmodActionPerformed

    public void defaultToCrLmod() {
        File rootFile;
        if(isOperationChooser) {
            System.out.println("Loading CRLMOD Operation Location");
            rootFile = new CrLmodFile("CrLmod Operations", lmodType.lmodOperation);
        } else if(isCropChooser) {
            System.out.println("Loading CRLMOD Crop Location");
            rootFile = new TFile(About.getWepsCacheDir(), CsipLmodUtil.WepsCacheDirNameCrop);
        } else {
            System.out.println("Loading CRLMOD Management Location");
            rootFile = new CrLmodFile("CrLmod Managements", lmodType.lmodManagement);
        }
        rootFile.listFiles();
        JCB_Path.addAndSelectItem(rootFile);
        JCB_Path.setDefaultDir(rootFile);
    }
    private int counter = 0;
    private void JCB_FileTypesPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_JCB_FileTypesPropertyChange
        fileTypesAction();
    }//GEN-LAST:event_JCB_FileTypesPropertyChange

    private void JB_dbDirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_dbDirActionPerformed
        JCB_Path.selectDbDir();
    }//GEN-LAST:event_JB_dbDirActionPerformed

    protected void fileTypesAction() {
        
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton JB_Close;
    private javax.swing.JButton JB_DefaultDir;
    private javax.swing.JToggleButton JB_Details;
    protected javax.swing.JButton JB_HomeDir;
    protected javax.swing.JButton JB_NewDir;
    private javax.swing.JButton JB_ProjDir;
    protected javax.swing.JButton JB_Select;
    protected javax.swing.JButton JB_UpDir;
    private javax.swing.JButton JB_dbDir;
    protected usda.weru.util.wepsFileChooser2.WfcFileTypeComboBox JCB_FileTypes;
    protected usda.weru.util.wepsFileChooser2.WfcPathComboBox JCB_Path;
    protected javax.swing.JLabel JL_CustomMessage;
    protected javax.swing.JPanel JP_Accessory;
    private javax.swing.JScrollPane JSCP_DirPane;
    protected javax.swing.JTextField JTF_SelectedFile;
    protected usda.weru.util.wepsFileChooser2.WfcFileListTable JT_dirList;
    private javax.swing.JButton crlmod_button;
    private javax.swing.Box.Filler filler1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JButton loctemp_button;
    private javax.swing.JButton sharetemp_button;
    private javax.swing.JButton systemp_button;
    // End of variables declaration//GEN-END:variables
}
</pre></body></html>