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.Installer.Installer;
28 import org.openoffice.setup.Installer.InstallerFactory;
29 import org.openoffice.setup.PanelController;
30 import org.openoffice.setup.Panel.installationCompleted;
31 import org.openoffice.setup.ResourceManager;
32 import org.openoffice.setup.SetupData.PackageDescription;
33 import org.openoffice.setup.SetupData.ProductDescription;
34 import org.openoffice.setup.SetupData.SetupDataProvider;
35 import org.openoffice.setup.Util.InfoCtrl;
36 
37 public class InstallationCompletedCtrl extends PanelController {
38 
39     private String helpFile;
40     private String mDialogText;
41     private String htmlInfoText;
42 
InstallationCompletedCtrl()43     public InstallationCompletedCtrl() {
44         super("InstallationCompleted", new installationCompleted());
45         helpFile = "String_Helpfile_InstallationCompleted";
46     }
47 
beforeShow()48     public void beforeShow() {
49         InstallData installData = InstallData.getInstance();
50         ProductDescription productData = SetupDataProvider.getProductDescription();
51 
52         getSetupFrame().setButtonEnabled(false, getSetupFrame().BUTTON_PREVIOUS);
53         getSetupFrame().setButtonEnabled(false, getSetupFrame().BUTTON_CANCEL);
54         getSetupFrame().setButtonEnabled(false, getSetupFrame().BUTTON_HELP);
55         getSetupFrame().removeButtonIcon(getSetupFrame().BUTTON_NEXT);
56         getSetupFrame().setButtonSelected(getSetupFrame().BUTTON_NEXT);
57 
58         installationCompleted panel = (installationCompleted)getPanel();
59         panel.setDetailsButtonActionCommand(getSetupFrame().ACTION_DETAILS);
60         panel.addDetailsButtonActionListener(getSetupFrame().getSetupActionListener());
61 
62         if ( installData.isAbortedInstallation() ) {
63             String titleText = ResourceManager.getString("String_InstallationCompleted1_Abort");
64             panel.setTitleText(titleText);
65             String dialogText = ResourceManager.getString("String_InstallationCompleted2_Abort");
66             panel.setDialogText(dialogText);
67         } else if ( installData.isErrorInstallation() ) {
68             String titleText = ResourceManager.getString("String_InstallationCompleted1_Error");
69             panel.setTitleText(titleText);
70             String dialogText = ResourceManager.getString("String_InstallationCompleted2_Error");
71             panel.setDialogText(dialogText);
72         }
73 
74         htmlInfoText = InfoCtrl.setHtmlFrame("header", htmlInfoText);
75         htmlInfoText = InfoCtrl.setInstallLogInfoText(productData, htmlInfoText);
76         htmlInfoText = InfoCtrl.setHtmlFrame("end", htmlInfoText);
77     }
78 
duringShow()79     public void duringShow() {
80         Thread t = new Thread() {
81             public void run() {
82                 PackageDescription packageData = SetupDataProvider.getPackageDescription();
83                 Installer installer = InstallerFactory.getInstance();
84                 installer.postInstall(packageData);
85             }
86         };
87 
88         t.start();
89     }
90 
getNext()91     public String getNext() {
92         return null;
93     }
94 
getPrevious()95     public String getPrevious() {
96         return null;
97     }
98 
getHelpFileName()99     public final String getHelpFileName () {
100         return this.helpFile;
101     }
102 
getDialogText()103     public String getDialogText() {
104         return htmlInfoText;
105     }
106 
107 }
108