/************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the 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; } }