001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031 package org.openoffice.setup.Util;
032
033 import org.openoffice.setup.InstallData;
034 import org.openoffice.setup.SetupData.PackageDescription;
035 import org.openoffice.setup.SetupData.ProductDescription;
036 import java.util.Enumeration;
037 import java.util.Vector;
038
039 public class InfoCtrl {
040
041 private InfoCtrl() {
042 }
043
044 static public String setHtmlFrame(String position, String htmlInfoText) {
045 if ( position.equals("header") ) {
046 htmlInfoText = "<HTML><BODY><FONT FACE=\"sans-serif\" SIZE=3>";
047 }
048 else if ( position.equals("end")) {
049 htmlInfoText = htmlInfoText + "</FONT></BODY></HTML>";
050 }
051
052 return htmlInfoText;
053 }
054
055 static public String setReadyToInstallInfoText(ProductDescription productData, String htmlInfoText) {
056
057 String oneline = "-------------------------------------------------------------";
058 htmlInfoText = htmlInfoText + "<b>Product</b>: " + productData.get("product_fullname") + "<br>";
059 InstallData data = InstallData.getInstance();
060 htmlInfoText = htmlInfoText + "<b>Location</b>: " + data.getInstallDefaultDir() + "<br>";
061 htmlInfoText = htmlInfoText + oneline + "<br>";
062
063 return htmlInfoText;
064 }
065
066 static public String setReadyToInstallInfoText(PackageDescription packageData, String htmlInfoText) {
067
068 InstallData data = InstallData.getInstance();
069 if ( data.isInstallationMode() ) {
070 htmlInfoText = setReadyToInstallInfoText(packageData, "", htmlInfoText);
071 } else {
072 htmlInfoText = setReadyToUninstallInfoText(packageData, "", htmlInfoText);
073 }
074 return htmlInfoText;
075 }
076
077
078 static private String setReadyToInstallInfoText(PackageDescription packageData, String indent, String htmlInfoText) {
079
080
081 if (( packageData.isLeaf() ) || ( packageData.isAllChildrenHidden() )) {
082 if ( ! packageData.isHidden() ) {
083 if ( packageData.getSelectionState() == packageData.INSTALL ) {
084
085 htmlInfoText = htmlInfoText + indent + packageData.getName() + "<br>";
086 }
087 }
088 }
089
090 if (( ! packageData.isLeaf() ) && ( ! packageData.isAllChildrenHidden() )) {
091 if ( ! packageData.isHidden() ) {
092 if (( packageData.getSelectionState() == packageData.INSTALL ) ||
093 ( packageData.getSelectionState() == packageData.INSTALL_SOME )) {
094
095
096 htmlInfoText = htmlInfoText + indent + packageData.getName() + "<br>";
097 }
098 }
099
100 indent = indent + "..";
101
102 for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
103 PackageDescription child = (PackageDescription) e.nextElement();
104 htmlInfoText = setReadyToInstallInfoText(child, indent, htmlInfoText);
105 }
106 }
107
108 return htmlInfoText;
109 }
110
111
112 static private String setReadyToUninstallInfoText(PackageDescription packageData, String indent, String htmlInfoText) {
113
114
115 if (( packageData.isLeaf() ) || ( packageData.isAllChildrenHidden() )) {
116 if ( ! packageData.isHidden() ) {
117 if ( packageData.getSelectionState() == packageData.REMOVE ) {
118
119 htmlInfoText = htmlInfoText + indent + packageData.getName() + "<br>";
120 }
121 }
122 }
123
124 if (( ! packageData.isLeaf() ) && ( ! packageData.isAllChildrenHidden() )) {
125 if ( ! packageData.isHidden() ) {
126 if (( packageData.getSelectionState() == packageData.REMOVE ) ||
127 ( packageData.getSelectionState() == packageData.REMOVE_SOME )) {
128
129
130 htmlInfoText = htmlInfoText + indent + packageData.getName() + "<br>";
131 }
132 }
133
134 indent = indent + "..";
135
136 for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
137 PackageDescription child = (PackageDescription) e.nextElement();
138 htmlInfoText = setReadyToUninstallInfoText(child, indent, htmlInfoText);
139 }
140 }
141
142 return htmlInfoText;
143 }
144
145 static public String setInstallLogInfoText(ProductDescription productData, String htmlInfoText) {
146
147 String separatorline = "-------------------------------------------------------------";
148 htmlInfoText = htmlInfoText + "<b>Product</b>: " + productData.get("product_fullname") + "<br>";
149 InstallData data = InstallData.getInstance();
150 htmlInfoText = htmlInfoText + "<b>Location</b>: " + data.getInstallDir() + "<br>";
151 htmlInfoText = htmlInfoText + "<b>Operating system</b>: " + data.getOSType() + "<br>";
152 if ( data.isUserInstallation() ) {
153 htmlInfoText = htmlInfoText + "<b>Installation type</b>: " + "User installation" + "<br>";
154 } else {
155 htmlInfoText = htmlInfoText + "<b>Installation type</b>: " + "Root installation" + "<br>";
156 }
157
158 htmlInfoText = htmlInfoText + separatorline + "<br>";
159
160 htmlInfoText = LogManager.publishLogfileContent(htmlInfoText, separatorline);
161 htmlInfoText = LogManager.publishCommandsLogfileContent(htmlInfoText);
162
163 return htmlInfoText;
164 }
165
166 }