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.UninstallationImminent;
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.InfoCtrl;
34 import org.openoffice.setup.Util.ModuleCtrl;
35 
36 public class UninstallationImminentCtrl extends PanelController {
37 
38     private String helpFile;
39     private String htmlInfoText = "";
40 
UninstallationImminentCtrl()41     public UninstallationImminentCtrl() {
42         super("UninstallationImminent", new UninstallationImminent());
43         helpFile = "String_Helpfile_UninstallationImminent";
44     }
45 
getNext()46     public String getNext() {
47         return new String("UninstallationOngoing");
48     }
49 
getPrevious()50     public String getPrevious() {
51 
52         InstallData data = InstallData.getInstance();
53 
54         if ( data.getInstallationType().equals(data.getCustomActionCommand()) ) {
55             return new String("ChooseUninstallationComponents");
56         } else if ( data.getInstallationType().equals(data.getTypicalActionCommand()) ) {
57             return new String("ChooseUninstallationType");
58         } else {
59             System.err.println("Error: Unknown uninstallation type!" );
60             return new String("Error");
61         }
62     }
63 
getHelpFileName()64     public final String getHelpFileName () {
65         return this.helpFile;
66     }
67 
beforeShow()68     public void beforeShow() {
69         String StringInstall = ResourceManager.getString("String_Uninstall");
70         getSetupFrame().setButtonText(StringInstall, getSetupFrame().BUTTON_NEXT);
71 
72         ProductDescription productData = SetupDataProvider.getProductDescription();
73         PackageDescription packageData = SetupDataProvider.getPackageDescription();
74 
75         htmlInfoText = InfoCtrl.setHtmlFrame("header", htmlInfoText);
76         htmlInfoText = InfoCtrl.setReadyToInstallInfoText(productData, htmlInfoText);
77         htmlInfoText = InfoCtrl.setReadyToInstallInfoText(packageData, htmlInfoText);
78         htmlInfoText = InfoCtrl.setHtmlFrame("end", htmlInfoText);
79 
80         UninstallationImminent panel = (UninstallationImminent)getPanel();
81         panel.setInfoText(htmlInfoText);
82         panel.setCaretPosition();
83 
84         // System.err.println("\nUninstallation module state dump 3:");
85         // Dumper.dumpModuleStates(packageData);
86     }
87 
duringShow()88     public void duringShow() {
89         UninstallationImminent panel = (UninstallationImminent)getPanel();
90         panel.setTabOrder();
91     }
92 
afterShow(boolean nextButtonPressed)93     public boolean afterShow(boolean nextButtonPressed) {
94         boolean repeatDialog = false;
95 
96         if ( nextButtonPressed ) {
97             PackageDescription packageData = SetupDataProvider.getPackageDescription();
98             ModuleCtrl.setHiddenModuleSettingsUninstall(packageData);
99             // Dumper.dumpUninstallPackages(packageData);
100 
101             // System.err.println("\nUninstallation module state dump 4:");
102             // Dumper.dumpModuleStates(packageData);
103         }
104 
105         return repeatDialog;
106     }
107 
108 }
109