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 * Controls how long an {@link Alert} is displayed to the end user.
019 *
020 * @since 5.3
021 */
022 public enum Duration
023 {
024 /**
025 * Transient alerts are displayed to the user, then automatically clear themselves after a few seconds. Transient alerts
026 * are not stored in the {@link AlertStorage}.
027 */
028 TRANSIENT(false),
029
030 /**
031 * The default duration; displayed to the user a single time; once the page updates, the alert will not be presented to the
032 * user. Single duration alerts are not stored in {@link AlertStorage}.
033 */
034 SINGLE(false),
035
036 /**
037 * For most important alerts; the alert will continue to be presented to the user until it is dismissed by the user
038 * (either by clicking on the individual alert to dismiss it, or by clicking the UI control for dismissing all alerts).
039 * Such alerts are stored persistently in {@link AlertStorage}.
040 */
041 UNTIL_DISMISSED(true);
042
043 /**
044 * True if the alert type should persist between requests. This is only true for {@link #UNTIL_DISMISSED}.
045 */
046 public final boolean persistent;
047
048 private Duration(boolean persistent)
049 {
050 this.persistent = persistent;
051 }
052 }