/************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: InfoCtrl.java,v $ * $Revision: 1.4 $ * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 * only, as published by the Free Software Foundation. * * OpenOffice.org is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License version 3 for more details * (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU Lesser General Public License * version 3 along with OpenOffice.org. If not, see * * for a copy of the LGPLv3 License. * ************************************************************************/ package org.openoffice.setup.Util; import org.openoffice.setup.InstallData; import org.openoffice.setup.SetupData.PackageDescription; import org.openoffice.setup.SetupData.ProductDescription; import java.util.Enumeration; import java.util.Vector; public class InfoCtrl { private InfoCtrl() { } static public String setHtmlFrame(String position, String htmlInfoText) { if ( position.equals("header") ) { htmlInfoText = ""; } else if ( position.equals("end")) { htmlInfoText = htmlInfoText + ""; } return htmlInfoText; } static public String setReadyToInstallInfoText(ProductDescription productData, String htmlInfoText) { // String oneline = "-------------------------------------------------------------------"; String oneline = "-------------------------------------------------------------"; htmlInfoText = htmlInfoText + "Product: " + productData.get("product_fullname") + "
"; InstallData data = InstallData.getInstance(); htmlInfoText = htmlInfoText + "Location: " + data.getInstallDefaultDir() + "
"; htmlInfoText = htmlInfoText + oneline + "
"; return htmlInfoText; } static public String setReadyToInstallInfoText(PackageDescription packageData, String htmlInfoText) { // setHtmlInfoText(packageData, 0); InstallData data = InstallData.getInstance(); if ( data.isInstallationMode() ) { htmlInfoText = setReadyToInstallInfoText(packageData, "", htmlInfoText); } else { htmlInfoText = setReadyToUninstallInfoText(packageData, "", htmlInfoText); } return htmlInfoText; } // private void setReadyToInstallInfoText(PackageDescription packageData, Integer indent) { static private String setReadyToInstallInfoText(PackageDescription packageData, String indent, String htmlInfoText) { // String spacer = ""; // System.out.println(ind); if (( packageData.isLeaf() ) || ( packageData.isAllChildrenHidden() )) { if ( ! packageData.isHidden() ) { if ( packageData.getSelectionState() == packageData.INSTALL ) { // htmlInfoText = htmlInfoText + spacer + packageData.getName() + "
"; htmlInfoText = htmlInfoText + indent + packageData.getName() + "
"; } } } if (( ! packageData.isLeaf() ) && ( ! packageData.isAllChildrenHidden() )) { if ( ! packageData.isHidden() ) { if (( packageData.getSelectionState() == packageData.INSTALL ) || ( packageData.getSelectionState() == packageData.INSTALL_SOME )) { // htmlInfoText = htmlInfoText + spacer + "" + packageData.getName() + "" + "
"; // htmlInfoText = htmlInfoText + indent + "" + packageData.getName() + "" + "
"; htmlInfoText = htmlInfoText + indent + packageData.getName() + "
"; } } indent = indent + ".."; for (Enumeration e = packageData.children(); e.hasMoreElements(); ) { PackageDescription child = (PackageDescription) e.nextElement(); htmlInfoText = setReadyToInstallInfoText(child, indent, htmlInfoText); } } return htmlInfoText; } // private void setReadyToUninstallInfoText(PackageDescription packageData, Integer indent, String htmlInfoText) { static private String setReadyToUninstallInfoText(PackageDescription packageData, String indent, String htmlInfoText) { // String spacer = ""; // System.out.println(ind); if (( packageData.isLeaf() ) || ( packageData.isAllChildrenHidden() )) { if ( ! packageData.isHidden() ) { if ( packageData.getSelectionState() == packageData.REMOVE ) { // htmlInfoText = htmlInfoText + spacer + packageData.getName() + "
"; htmlInfoText = htmlInfoText + indent + packageData.getName() + "
"; } } } if (( ! packageData.isLeaf() ) && ( ! packageData.isAllChildrenHidden() )) { if ( ! packageData.isHidden() ) { if (( packageData.getSelectionState() == packageData.REMOVE ) || ( packageData.getSelectionState() == packageData.REMOVE_SOME )) { // htmlInfoText = htmlInfoText + spacer + "" + packageData.getName() + "" + "
"; // htmlInfoText = htmlInfoText + indent + "" + packageData.getName() + "" + "
"; htmlInfoText = htmlInfoText + indent + packageData.getName() + "
"; } } indent = indent + ".."; for (Enumeration e = packageData.children(); e.hasMoreElements(); ) { PackageDescription child = (PackageDescription) e.nextElement(); htmlInfoText = setReadyToUninstallInfoText(child, indent, htmlInfoText); } } return htmlInfoText; } static public String setInstallLogInfoText(ProductDescription productData, String htmlInfoText) { // String separatorline = "-------------------------------------------------------------------"; String separatorline = "-------------------------------------------------------------"; htmlInfoText = htmlInfoText + "Product: " + productData.get("product_fullname") + "
"; InstallData data = InstallData.getInstance(); htmlInfoText = htmlInfoText + "Location: " + data.getInstallDir() + "
"; htmlInfoText = htmlInfoText + "Operating system: " + data.getOSType() + "
"; if ( data.isUserInstallation() ) { htmlInfoText = htmlInfoText + "Installation type: " + "User installation" + "
"; } else { htmlInfoText = htmlInfoText + "Installation type: " + "Root installation" + "
"; } htmlInfoText = htmlInfoText + separatorline + "
"; htmlInfoText = LogManager.publishLogfileContent(htmlInfoText, separatorline); htmlInfoText = LogManager.publishCommandsLogfileContent(htmlInfoText); return htmlInfoText; } }