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


/**
    Template if you'd like to do some additional configuration on the user's
    system after the files are installed. If you want to do the configuration
    before files are installed, then 'extend' WizardPanel instead of StatusPanel.

    Copyright (C) 1998-2010 DeNova
 */
public class Configure extends StatusPanel 
                       implements InstallPropertyNames {

    // show the user a message about what you're doing
    private String progressLabel = "Configuring";
    
    
    /**
      *  The processing should be done in its own thread. 
      *  Swinger lets you update the user interface in the
      *  swingBefore() method, do the actual processing that
      *  doesn't require updating the screen in the workInBackground()
      *  method, and report the final result to the user in
      *  the swingAfter() method.
      */
    private class ConfigureSwinger extends Swinger
    {
        /**
          *  Update the screen to let the user know what's going on.
          *  This class inherits from StatusPanel so the progress bar
          *  is automatically be updated while this class is running.
          */
        public void swingBefore()
        {
            updateProgressBarLabel(progressLabel);
        }
        
        /**
          *  Here's where you want to add your code to handle
          *  any configuration of the user's system. Do *not*
          *  update the screen in this method because you are
          *  not running on the event queue.
          */
        public void workInBackground()
        {
            // You can access any of the properties that the installer
            // uses through getPropertyList().getProperty(). You can
            // see the list of properties in the JExpress API
            // com.denova.JExpess.Installer.InstallPropetyNames
            
            // One of the most useful properties is knowing where the
            // user installed your app. You get it by calling...
            String applicationDirectory =
               getPropertyList().getProperty(ApplicationDirectory, "");
               
            // add your the code here <------------------>
            // to here <------------------>
        }

        
        /**
          *  Now, you can update the screen with any additional information.
          *  The default behavior is to simply move to the next panel in
          *  the installer, but if you want to show the status and let the
          *  user click the next button before proceeding, then simply
          *  remove the showNextPanel() call below and add isNextButtonEnabled()
          *  method so the Next button is active.
          *  
          */
        public void swingAfter()
        {
            // since there's no user interaction, simply move to the next panel
            showNextPanel();
        }
    }
    
    
    public Configure(PropertyList properties)
    {
        super (properties);
        
        updateProgressBarLabel(progressLabel);
    }
    
    /** 
     * Enter the panel. 
     *
     * Do not call this method; only the wizard should call it.
     */
     public void enter()
     {
        ConfigureSwinger swinger = new ConfigureSwinger();
        swinger.execute();
    }

}  // Configure