package com.sun.solarisinstall.panels;

import java.awt.*;
import java.util.*;
import com.sun.wizards.core.*;
import com.sun.wizards.awt.*;
import com.sun.solarisinstall.*;

/*
 *  Loading Solaris CD panel. 
 */

public class LoadingSolarisCDPanel extends LoadingCDPanel 
{
  public LoadingSolarisCDPanel()
  {
  }

  public LoadingSolarisCDPanel(WizardState wizardState, String name)
  {
    super(wizardState, name);
  }
    
  public LoadingSolarisCDPanel( String name,
				Route route,
			        WizardTreeManager wizardManager) 
  {
    super(name, route, wizardManager);
  }

  public String getMountSequence()
  {
    return("mountSolarisCDSequence");
  }

  public boolean mountCDresult()
  {
    if (super.mountCDresult()) {
      WizardTreeManager wizardManager = getTreeManager();

      /*
       * Solaris CD Mount was OK.
       * Clear the RemountSolarisCD flag.
       */
      wizardManager.callServerObjectMethod(
        getRoute(),
        "setData",
        new String[] {"com.sun.wizards.core.Route.class",
                      "java.lang.String.class",
                      "java.lang.Object.class"},
        new Object[] {null, ProfileConstants.RemountSolarisCD, Boolean.FALSE});

        return(true);
    } else
	return(false);
  }

  public String getLoadingString()
  {
    WizardTreeManager wizardManager = getTreeManager();

    String osName =
          (String)wizardManager.callServerObjectMethod(getRoute(),
          "getData",
          new String[]{"java.lang.String.class"},
          new Object[] { ProfileConstants.osName});

    Route profileRoute = getRoute().getChildServerRoute("profileObject");

    CDName =
          (String)wizardManager.callServerObjectMethod(
	  profileRoute.copy(),
          "getNameOSCD",
          new String[]{"java.lang.String.class"}, 
	  new Object[] { osName });

    CDName = CDName.trim();
    Object[] CDnameArg = { CDName };
    return(MsgCat.getString("com.sun.solarisinstall.SolarisInstall",
                SolarisInstallResources.MSG_READING_CD, CDnameArg)); 
  }

  public void addRuntimeResources(Vector resourceVector)
  {
     super.addRuntimeResources(resourceVector);
     resourceVector.addElement(new String[] {null, 
	"com.sun.solarisinstall.panels.LoadingSolarisCDPanel"});
  }
}
