
import javax.swing.JLabel;
import java.awt.BorderLayout;
import java.awt.Font;
import java.io.File;
import com.denova.ui.WizardPanel;
import com.denova.ui.LocaleTranslator;
import com.denova.util.PropertyList;
import com.denova.JExpress.Installer.CustomInstaller;
import com.denova.JExpress.Installer.Installer;


/** Make the installer silent all the time.
  * This eliminates the need for the user to 
  * pass the -q switch and the install directory on the command line.
  *
  * The applicationDirectory *must* be set in the installer's properties *before*
  * trying to make the installer silent.
  *
  * Copyright &copy; 2003-2008 DeNova
  * All rights reserved worldwide.
  *
  * Last modified: 2008-05-22
  *
  * @author DeNova
  *
  * Important:
  *  1.This class must be included in the "Before install" field on the Custom panel in JExpress Developer.
  *
  *  2.This class is not dependent on any other custom classes.
  *
  *  3.You must adapt setting the applicationDirectory property to the correct install directory.
  *
  *  4.If the installer requires additional custom properties, then you must load those properties
  *     and "addProperties" to the getPropertyList().It would be best to set the applicationDirectory
  *     in the constructor, but load/add any additional properties in the setAcitve() method.
  */


public class MakeInstallerSilent extends WizardPanel {

    /**
      *   Make installer silent.
      */

    public MakeInstallerSilent(PropertyList properties) {
    
        // initialize WizardPanel superclass
        super(properties);
    
        File installDir = new File("/tmp/test");
        
        getPropertyList().setProperty("applicationDirectory", 
                                      installDir.getPath());
        
        CustomInstaller.makeInstallerSilent();        
        CustomInstaller.setVisible(false);
    }


    /** 
     * Enter the panel. 
     *
     * Do not call this method; only the wizard should call it.
     */
     public void enter()
     {
        // we don't want any user interaction and we
        // already accomplished what we wanted in the constructor
        // so move them to the next panel automatically
        showNextPanel();
    }

    
    /**
      * Determines if the 'Next" button is accessible to the user.
      *
      * @return always false because this is a non-interactive panel.
      */

    public boolean isNextButtonEnabled() {
        return false;
    }

    
    /**
      * Determines if the 'Cancel" button is accessible to the user.
      *
      * @return always false because this is a non-interactive panel.
      */

    public boolean isCancelButtonEnabled() {
        return false;
    }

    
    /**
      * Determines if the 'Back" button is accessible to the user.
      *
      * @return always false because this is a non-interactive panel.
      */

    public boolean isPreviousButtonEnabled() {
        return false;
    }

    
    /**
      * Supplies the name of the panel.
      */

    public String getName() {
        return "MakeInstallerSilent";
    }
    
}  // MakeInstallerSilent


