| Class | Line # | Actions | |||||
|---|---|---|---|---|---|---|---|
| ErrorBlockGenerator | 34 | 0 | - | 0 | 0 |
| 1 | /* | |
| 2 | * See the NOTICE file distributed with this work for additional | |
| 3 | * information regarding copyright ownership. | |
| 4 | * | |
| 5 | * This is free software; you can redistribute it and/or modify it | |
| 6 | * under the terms of the GNU Lesser General Public License as | |
| 7 | * published by the Free Software Foundation; either version 2.1 of | |
| 8 | * the License, or (at your option) any later version. | |
| 9 | * | |
| 10 | * This software is distributed in the hope that it will be useful, | |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | * Lesser General Public License for more details. | |
| 14 | * | |
| 15 | * You should have received a copy of the GNU Lesser General Public | |
| 16 | * License along with this software; if not, write to the Free | |
| 17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
| 18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
| 19 | */ | |
| 20 | package org.xwiki.rendering.util; | |
| 21 | ||
| 22 | import java.util.List; | |
| 23 | ||
| 24 | import org.xwiki.component.annotation.Role; | |
| 25 | import org.xwiki.rendering.block.Block; | |
| 26 | ||
| 27 | /** | |
| 28 | * Generates error blocks to render an error in a wiki page. | |
| 29 | * | |
| 30 | * @version $Id: fbb0a7966a413b222974b70f04438a9c248333ef $ | |
| 31 | * @since 8.1M1 | |
| 32 | */ | |
| 33 | @Role | |
| 34 | public interface ErrorBlockGenerator | |
| 35 | { | |
| 36 | /** | |
| 37 | * The CSS class attribute name to use for the generated top level error block. | |
| 38 | */ | |
| 39 | String CLASS_ATTRIBUTE_NAME = "class"; | |
| 40 | ||
| 41 | /** | |
| 42 | * The CSS class attribute value to use for the block displaying the message. | |
| 43 | */ | |
| 44 | String CLASS_ATTRIBUTE_MESSAGE_VALUE = "xwikirenderingerror"; | |
| 45 | ||
| 46 | /** | |
| 47 | * The CSS class attribute value to use for the block displaying the description. | |
| 48 | */ | |
| 49 | String CLASS_ATTRIBUTE_DESCRIPTION_VALUE = "xwikirenderingerrordescription hidden"; | |
| 50 | ||
| 51 | /** | |
| 52 | * Generates error blocks to render an error in a wiki page. | |
| 53 | * | |
| 54 | * @param message the short message that will be displayed to the user | |
| 55 | * @param description the description that will be displayed to the user when he clicks on the message | |
| 56 | * @param isInline whether the generated blocks should be inline or not | |
| 57 | * @return the generated blocks | |
| 58 | */ | |
| 59 | List<Block> generateErrorBlocks(String message, String description, boolean isInline); | |
| 60 | ||
| 61 | /** | |
| 62 | * Generates error blocks to render an error in a wiki page. | |
| 63 | * | |
| 64 | * @param messagePrefix the prefix of the short message that will be displayed to the user. This message will be | |
| 65 | * augmented with the root cause of the error extracted from the passed throwable and an | |
| 66 | * additional text inviting the user to click the message will be added to the message prefix | |
| 67 | * @param throwable the exception from which the description will be extracted from | |
| 68 | * @param isInline whether the generated blocks should be inline or not | |
| 69 | * @return the generated blocks | |
| 70 | */ | |
| 71 | List<Block> generateErrorBlocks(String messagePrefix, Throwable throwable, boolean isInline); | |
| 72 | } |