/*
 * ResetRunLocationPanel.java
 *
 * Created on August 15, 2006, 11:22 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package usda.weru.util;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import de.schlichtherle.io.File;
import usda.weru.util.gui.ResetRunLocationPanel_n;
import usda.weru.weps.RunFileData;

/**
 *
 * @author joelevin
 */
public class ResetRunLocationPanel extends ResetRunLocationPanel_n implements PropertyChangeListener{
    protected WepsFileChooser c_wfc;
    protected File c_default;
    protected ConfigData c_cd;
    protected RunFileData c_rfd;
    /** Creates a new instance of ResetRunLocationPanel */
    public ResetRunLocationPanel(ConfigData cd, RunFileData rfd, WepsFileChooser wfc) {
        c_cd = cd;
        
        cd.fireAll(this);        
        
        c_rfd = rfd;  
        
        
        
        c_wfc = wfc;
        
    }
    
    protected void resetButtonActionPerformed(java.awt.event.ActionEvent evt) {
        c_wfc.setSelectedFile(c_default);
        c_rfd.setData(RunFileData.RunsLocation, c_default.getAbsolutePath());
        c_wfc.approveSelection();
        
    }
    
    public void propertyChange(PropertyChangeEvent e){
        if (e.getPropertyName().equals(ConfigData.DefaultRunsLocation)){
            c_default = new File(e.getNewValue().toString());            
        }
    }
    
}
