001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2006-2008 Sun Microsystems, Inc.
015 * Portions Copyright 2014 ForgeRock AS.
016 */
017
018package org.opends.quicksetup;
019
020import org.forgerock.i18n.LocalizableMessage;
021
022/**
023 * This class is used to describe the current state of the installation.
024 * It contains the step in which the installation is, the current progress
025 * ratio, the progress bar message and the details message (the logs).
026 *
027 * This class is used directly by the ProgressPanel to update its content
028 * and has been designed to match the layout of that panel.  However as it
029 * does not contain any dependency in terms of code with any Swing or UI package
030 * component it has been decided to leave it on the installer package.
031 *
032 * In general the progress bar message and the details messages (log) are in
033 * HTML form (but this class is independent of the format we use for the
034 * messages).
035 *
036 */
037public class ProgressDescriptor {
038
039  private ProgressStep step;
040
041  private Integer progressBarRatio;
042
043  private LocalizableMessage progressBarMsg;
044
045  private LocalizableMessage detailsMsg;
046
047  /**
048   * Constructor for the ProgressDescriptor.
049   * @param step the current install step.
050   * @param progressBarRatio the completed progress ratio (in percentage).
051   * @param progressBarMsg the message to be displayed in the progress bar.
052   * @param detailsMsg the logs.
053   */
054  public ProgressDescriptor(ProgressStep step,
055      Integer progressBarRatio, LocalizableMessage progressBarMsg, LocalizableMessage detailsMsg)
056  {
057    this.step = step;
058    this.progressBarRatio = progressBarRatio;
059    this.progressBarMsg = progressBarMsg;
060    this.detailsMsg = detailsMsg;
061  }
062
063  /**
064   * Returns the details message (the log message) of the install.
065   * @return the details message (the log message) of the install.
066   */
067  public LocalizableMessage getDetailsMsg()
068  {
069    return detailsMsg;
070  }
071
072  /**
073   * Returns the progress bar message.
074   * @return the progress bar message.
075   */
076  public LocalizableMessage getProgressBarMsg()
077  {
078    return progressBarMsg;
079  }
080
081  /**
082   * Returns the progress bar ratio (the percentage of the install that is
083   * completed).
084   * @return the progress bar ratio (the percentage of the install that is
085   * completed).
086   */
087  public Integer getProgressBarRatio()
088  {
089    return progressBarRatio;
090  }
091
092  /**
093   * Returns the step of the install on which we are.
094   * @return the step of the install on which we are.
095   */
096  public ProgressStep getProgressStep()
097  {
098    return step;
099  }
100}