1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package org.openoffice.setup.Controller; 25 26 import org.openoffice.setup.InstallData; 27 import org.openoffice.setup.PanelController; 28 import org.openoffice.setup.Panel.InstallationImminent; 29 import org.openoffice.setup.ResourceManager; 30 import org.openoffice.setup.SetupData.PackageDescription; 31 import org.openoffice.setup.SetupData.ProductDescription; 32 import org.openoffice.setup.SetupData.SetupDataProvider; 33 import org.openoffice.setup.Util.Dumper; 34 import org.openoffice.setup.Util.InfoCtrl; 35 import org.openoffice.setup.Util.Informer; 36 import org.openoffice.setup.Util.LogManager; 37 import org.openoffice.setup.Util.ModuleCtrl; 38 import java.util.Vector; 39 40 public class InstallationImminentCtrl extends PanelController { 41 42 private String helpFile; 43 private String htmlInfoText = ""; 44 InstallationImminentCtrl()45 public InstallationImminentCtrl() { 46 super("InstallationImminent", new InstallationImminent()); 47 helpFile = "String_Helpfile_InstallationImminent"; 48 } 49 getNext()50 public String getNext() { 51 return new String("InstallationOngoing"); 52 } 53 getPrevious()54 public String getPrevious() { 55 56 InstallData data = InstallData.getInstance(); 57 58 if ( data.isRootInstallation() ) { 59 if ( data.olderVersionExists() ) { 60 if ( data.hideEula() ) { 61 return new String("Prologue"); 62 } else { 63 return new String("AcceptLicense"); 64 } 65 } else if ( data.sameVersionExists() ) { 66 return new String("ChooseComponents"); 67 } else { 68 if ( data.getInstallationType().equals(data.getCustomActionCommand()) ) { 69 return new String("ChooseComponents"); 70 } else if ( data.getInstallationType().equals(data.getTypicalActionCommand()) ) { 71 return new String("ChooseInstallationType"); 72 } else { 73 System.err.println("Error: Unknown installation type!" ); 74 return new String("Error"); 75 } 76 } 77 } else { 78 if ( data.olderVersionExists() ) { 79 return new String("ChooseDirectory"); 80 } else if ( data.sameVersionExists() ) { 81 return new String("ChooseComponents"); 82 } else { 83 if ( data.getInstallationType().equals(data.getCustomActionCommand()) ) { 84 return new String("ChooseComponents"); 85 } else if ( data.getInstallationType().equals(data.getTypicalActionCommand()) ) { 86 return new String("ChooseInstallationType"); 87 } else { 88 System.err.println("Error: Unknown installation type!" ); 89 return new String("Error"); 90 } 91 } 92 } 93 } 94 getHelpFileName()95 public final String getHelpFileName () { 96 return this.helpFile; 97 } 98 beforeShow()99 public void beforeShow() { 100 String StringInstall = ResourceManager.getString("String_Install"); 101 getSetupFrame().setButtonText(StringInstall, getSetupFrame().BUTTON_NEXT); 102 103 ProductDescription productData = SetupDataProvider.getProductDescription(); 104 PackageDescription packageData = SetupDataProvider.getPackageDescription(); 105 // Dumper.dumpPackageSettings(packageData); 106 htmlInfoText = InfoCtrl.setHtmlFrame("header", htmlInfoText); 107 htmlInfoText = InfoCtrl.setReadyToInstallInfoText(productData, htmlInfoText); 108 htmlInfoText = InfoCtrl.setReadyToInstallInfoText(packageData, htmlInfoText); 109 htmlInfoText = InfoCtrl.setHtmlFrame("end", htmlInfoText); 110 111 InstallationImminent panel = (InstallationImminent)getPanel(); 112 panel.setInfoText(htmlInfoText); 113 panel.setCaretPosition(); 114 115 // Update mode 116 InstallData data = InstallData.getInstance(); 117 if ( data.olderVersionExists() ) { 118 String dialogTitle = ResourceManager.getString("String_InstallationImminent1_Update"); 119 panel.setTitleText(dialogTitle); 120 } 121 } 122 duringShow()123 public void duringShow() { 124 InstallationImminent panel = (InstallationImminent)getPanel(); 125 panel.setTabOrder(); 126 } 127 afterShow(boolean nextButtonPressed)128 public boolean afterShow(boolean nextButtonPressed) { 129 boolean repeatDialog = false; 130 131 if ( nextButtonPressed ) { 132 133 InstallData data = InstallData.getInstance(); 134 135 // determining the packagePath 136 if ( data.getPackagePath() != null ) { 137 String log = "<b>Packages path:</b> " + data.getPackagePath() + "<br>"; 138 LogManager.addLogfileComment(log); 139 } else { 140 String message = ResourceManager.getString("String_InstallationOngoing_PackagePath_Not_Found"); 141 String title = ResourceManager.getString("String_Error"); 142 Informer.showErrorMessage(message, title); 143 String log = "<b>Error: No path for packages exists!</b><br>"; 144 LogManager.addLogfileComment(log); 145 repeatDialog = true; 146 } 147 } 148 149 return repeatDialog; 150 } 151 } 152