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