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 015 package 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 */ 023 public interface AlertManager 024 { 025 /** 026 * Adds an {@link Severity#INFO} alert with the default duration, {@link Duration#SINGLE}. 027 * 028 * @param message to present to the user 029 */ 030 void info(String message); 031 032 /** 033 * Adds an {@link Severity#WARN} alert with the default duration, {@link Duration#SINGLE}. 034 * 035 * @param message to present to the user 036 */ 037 void warn(String message); 038 039 /** 040 * Adds an {@link Severity#ERROR} alert with the default duration, {@link Duration#SINGLE}. 041 * 042 * @param message to present to the user 043 */ 044 void error(String message); 045 046 /** 047 * Adds an alert with configurable severity and duration. 048 * 049 * @param duration controls how long the alert is presented to the user 050 * @param severity controls how the alert is presented to the user 051 * @param message to present to the user 052 */ 053 void alert(Duration duration, Severity severity, String message); 054 }