import com.denova.runtime.Exec;
import com.denova.ui.Swinger;
import com.denova.util.PropertyList;
import com.denova.JExpress.Installer.InstallPropertyNames;
import com.denova.JExpress.Installer.StatusPanel;


/**
    Template to start another program from the installer. 
    
    If you want to start one of the menus that the installer created
    at the end of the installer, then you don't need this class. You
    can simply add a check mark on the menu item's dialog box next to
    "Start after installer".
    
    If you want a third party installer or other program to run during
    the installer, then you can include the other program on the Files
    panel and then include your custom class after files are installed.
    
    Or, if you need the program to run before files are installed, then
    you should include the program in the directory where you have your
    custom classes stored. You'll need to extract the program from the
    installer before you run it. 
    
    This class assumes that you are running a program that you included in
    the Files panel of JExpress builder.

    Copyright (C) 1998-2010 DeNova
*/

public class StartProgram extends StatusPanel
    implements InstallPropertyNames
{
    // you'd need to include this file in the list on the Files panel in JExpress
    private String progressLabel = "Running another program"

    private class StartProgramSwinger extends Swinger
    {
        public void swingBefore()
        {
            updateProgressBarLabel(progressLabel);
        }
        
        public void workInBackground()
        {
            // execute your program -- see Samples/RunThirdPartyProgam.java
            // for a complete example
        }
        
        public void swingAfter()
        {
            // since there's no user interaction, simply move to the next panel
            showNextPanel ();
        }
    }
    
    
    /**
     * Creates a new StartProgram object.
     * 
     * @param properties installer's properties
     */
    public StartProgram (PropertyList properties)
    {
        super (properties);
        
        updateProgressBarLabel(progressLabel);
    }

    /** 
     * Enter the panel. Method where the work for the class is done.
     *
     * See RunThirdPartyProgram.java in Samples subdirectory for a more complete example.
     *
     * Do not call this method; only the wizard should call it.
     */
    public void enter()
    {
        StartProgramSwinger swinger = new StartProgramSwinger();
        swinger.execute();
    }

}