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-2015 ForgeRock AS
026 */
027
028package org.opends.quicksetup.util;
029
030import org.forgerock.i18n.LocalizableMessage;
031
032/**
033 * This interface has been created in order to share the same formatting code
034 * for both the Installer and the Uninstaller classes.   This way we have the
035 * same look and feel for both.  In addition to that not having the format of
036 * the message inside the Installer/Uninstaller classes is cleaner, as these
037 * classes should no nothing about the classes that are in charge of displaying
038 * the progress.
039 *
040 */
041public interface ProgressMessageFormatter
042{
043
044  /**
045   * Returns the formatted representation of the text without providing any
046   * style.
047   * @param text the source text from which we want to get the formatted
048   * representation
049   * @return the formatted representation for the given text.
050   */
051  LocalizableMessage getFormattedText(LocalizableMessage text);
052
053  /**
054   * Returns the formatted representation of the text that is the summary of the
055   * installation process (the one that goes in the UI next to the progress
056   * bar).
057   * @param text the source text from which we want to get the formatted
058   * representation
059   * @return the formatted representation of a summary for the given text.
060   */
061  LocalizableMessage getFormattedSummary(LocalizableMessage text);
062
063  /**
064   * Returns the formatted representation of an error for a given text.
065   * @param text the source text from which we want to get the formatted
066   * representation
067   * @param applyMargin specifies whether we apply a margin or not to the
068   * resulting formatted text.
069   * @return the formatted representation of an error for the given text.
070   */
071  LocalizableMessage getFormattedError(LocalizableMessage text, boolean applyMargin);
072
073  /**
074   * Returns the formatted representation of a warning for a given text.
075   * @param text the source text from which we want to get the formatted
076   * representation
077   * @param applyMargin specifies whether we apply a margin or not to the
078   * resulting formatted text.
079   * @return the formatted representation of a warning for the given text.
080   */
081  LocalizableMessage getFormattedWarning(LocalizableMessage text, boolean applyMargin);
082
083  /**
084   * Returns the formatted representation of a success message for a given text.
085   * @param text the source text from which we want to get the formatted
086   * representation
087   * @return the formatted representation of a success message for the given
088   * text.
089   */
090  LocalizableMessage getFormattedSuccess(LocalizableMessage text);
091
092  /**
093   * Returns the formatted representation of a log error message for a given
094   * text.
095   * @param text the source text from which we want to get the formatted
096   * representation
097   * @return the formatted representation of a log error message for the given
098   * text.
099   */
100  LocalizableMessage getFormattedLogError(LocalizableMessage text);
101
102  /**
103   * Returns the formatted representation of a log message for a given text.
104   * @param text the source text from which we want to get the formatted
105   * representation
106   * @return the formatted representation of a log message for the given text.
107   */
108  LocalizableMessage getFormattedLog(LocalizableMessage text);
109
110  /**
111   * Returns the formatted representation of the 'Done' text string.
112   * @return the formatted representation of the 'Done' text string.
113   */
114  LocalizableMessage getFormattedDone();
115
116  /**
117   * Returns the formatted representation of the 'Error' text string.
118   * @return the formatted representation of the 'Error' text string.
119   */
120  LocalizableMessage getFormattedError();
121
122  /**
123   * Returns the formatted representation of the argument text to which we add
124   * points.  For instance if we pass as argument 'Configuring Server' the
125   * return value will be 'Configuring Server .....'.
126   * @param text the String to which add points.
127   * @return the formatted representation of the '.....' text string.
128   */
129  LocalizableMessage getFormattedWithPoints(LocalizableMessage text);
130
131  /**
132   * Returns the formatted representation of a point.
133   * @return the formatted representation of the '.' text string.
134   */
135  LocalizableMessage getFormattedPoint();
136
137  /**
138   * Returns the formatted representation of a space.
139   * @return the formatted representation of the ' ' text string.
140   */
141  LocalizableMessage getSpace();
142
143  /**
144   * Returns the formatted representation of a progress message for a given
145   * text.
146   * @param text the source text from which we want to get the formatted
147   * representation
148   * @return the formatted representation of a progress message for the given
149   * text.
150   */
151  LocalizableMessage getFormattedProgress(LocalizableMessage text);
152
153  /**
154   * Returns the formatted representation of an error message for a given
155   * throwable.
156   * This method applies a margin if the applyMargin parameter is
157   * <CODE>true</CODE>.
158   * @param t the throwable.
159   * @param applyMargin specifies whether we apply a margin or not to the
160   * resulting formatted text.
161   * @return the formatted representation of an error message for the given
162   * exception.
163   */
164  LocalizableMessage getFormattedError(Throwable t, boolean applyMargin);
165
166  /**
167   * Returns the line break formatted.
168   * @return the line break formatted.
169   */
170  LocalizableMessage getLineBreak();
171
172  /**
173   * Returns the tab formatted.
174   * @return the tab formatted.
175   */
176  LocalizableMessage getTab();
177
178  /**
179   * Returns the task separator formatted.
180   * @return the task separator formatted.
181   */
182  LocalizableMessage getTaskSeparator();
183
184  /**
185   * Returns the log formatted representation after the user has clicked on a
186   * url.
187   *
188   * @param url that has been clicked
189   * @param lastText the formatted representation of the progress log before
190   * clicking on the url.
191   * @return the formatted progress log representation after the user has
192   * clicked on a url.
193   */
194  LocalizableMessage getFormattedAfterUrlClick(String url, LocalizableMessage lastText);
195}