001// Copyright 2011 The Apache Software Foundation 002// 003// Licensed under the Apache License, Version 2.0 (the "License"); 004// you may not use this file except in compliance with the License. 005// You may obtain a copy of the License at 006// 007// http://www.apache.org/licenses/LICENSE-2.0 008// 009// Unless required by applicable law or agreed to in writing, software 010// distributed under the License is distributed on an "AS IS" BASIS, 011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012// See the License for the specific language governing permissions and 013// limitations under the License. 014 015package org.apache.tapestry5.alerts; 016 017/** 018 * Manages {@link Alert}s (using the {@link AlertStorage} SSO. The behavior of the service switches during 019 * an Ajax request to directly add JavaScript to present the alerts. 020 * 021 * @since 5.3 022 */ 023public interface AlertManager 024{ 025 /** 026 * Adds an {@link Severity#SUCCESS} alert with the default duration, {@link Duration#SINGLE}. 027 * 028 * @param message to present to the user 029 * @since 5.3.6 030 */ 031 void success(String message); 032 033 /** 034 * Adds an {@link Severity#INFO} alert with the default duration, {@link Duration#SINGLE}. 035 * 036 * @param message to present to the user 037 */ 038 void info(String message); 039 040 /** 041 * Adds an {@link Severity#WARN} alert with the default duration, {@link Duration#SINGLE}. 042 * 043 * @param message to present to the user 044 */ 045 void warn(String message); 046 047 /** 048 * Adds an {@link Severity#ERROR} alert with the default duration, {@link Duration#SINGLE}. 049 * 050 * @param message to present to the user 051 */ 052 void error(String message); 053 054 /** 055 * Adds an alert with configurable severity and duration. 056 * 057 * @param duration controls how long the alert is presented to the user 058 * @param severity controls how the alert is presented to the user 059 * @param message to present to the user 060 */ 061 void alert(Duration duration, Severity severity, String message); 062}