Better, Faster, Freer

The LXR Cross Referencer

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Architecture: i386 ]
Version: HEAD ]

001 /*************************************************************************
002  *
003  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004  * 
005  * Copyright 2008 by Sun Microsystems, Inc.
006  *
007  * OpenOffice.org - a multi-platform office productivity suite
008  *
009  * $RCSfile: InfoCtrl.java,v $
010  * $Revision: 1.4 $
011  *
012  * This file is part of OpenOffice.org.
013  *
014  * OpenOffice.org is free software: you can redistribute it and/or modify
015  * it under the terms of the GNU Lesser General Public License version 3
016  * only, as published by the Free Software Foundation.
017  *
018  * OpenOffice.org is distributed in the hope that it will be useful,
019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
021  * GNU Lesser General Public License version 3 for more details
022  * (a copy is included in the LICENSE file that accompanied this code).
023  *
024  * You should have received a copy of the GNU Lesser General Public License
025  * version 3 along with OpenOffice.org.  If not, see
026  * <http://www.openoffice.org/license.html>
027  * for a copy of the LGPLv3 License.
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         // String oneline = "-------------------------------------------------------------------";
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         // setHtmlInfoText(packageData, 0);
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     // private void setReadyToInstallInfoText(PackageDescription packageData, Integer indent) {
078     static private String setReadyToInstallInfoText(PackageDescription packageData, String indent, String htmlInfoText) {
079         // String spacer = "<spacer type=horizontal size=" + indent.toString() + ">";
080         // System.out.println(ind);
081         if (( packageData.isLeaf() ) || ( packageData.isAllChildrenHidden() )) {
082             if ( ! packageData.isHidden() ) {
083                 if ( packageData.getSelectionState() == packageData.INSTALL ) {
084                     // htmlInfoText = htmlInfoText + spacer + packageData.getName() + "<br>";
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                     // htmlInfoText = htmlInfoText + spacer + "<b>" + packageData.getName() + "</b>" + "<br>";
095                     // htmlInfoText = htmlInfoText + indent + "<b>" + packageData.getName() + "</b>" + "<br>";
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     // private void setReadyToUninstallInfoText(PackageDescription packageData, Integer indent, String htmlInfoText) {
112     static private String setReadyToUninstallInfoText(PackageDescription packageData, String indent, String htmlInfoText) {
113         // String spacer = "<spacer type=horizontal size=" + indent.toString() + ">";
114         // System.out.println(ind);
115         if (( packageData.isLeaf() ) || ( packageData.isAllChildrenHidden() )) {
116             if ( ! packageData.isHidden() ) {
117                 if ( packageData.getSelectionState() == packageData.REMOVE ) {
118                     // htmlInfoText = htmlInfoText + spacer + packageData.getName() + "<br>";
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                     // htmlInfoText = htmlInfoText + spacer + "<b>" + packageData.getName() + "</b>" + "<br>";
129                     // htmlInfoText = htmlInfoText + indent + "<b>" + packageData.getName() + "</b>" + "<br>";
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         // String separatorline = "-------------------------------------------------------------------";
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 }

source navigation ] diff markup ] identifier search ] general search ]

This page was automatically generated by the LXR engine.
The LXR team
Valid HTML 4.01!