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