java.lang.Object
org.apache.wicket.feedback.FeedbackMessages
- All Implemented Interfaces:
Serializable
,Iterable<FeedbackMessage>
,IClusterable
public final class FeedbackMessages
extends Object
implements IClusterable, Iterable<FeedbackMessage>
Holds list of feedback messages. The list can be added to, cleared, queried and filtered.
WARNING: This class should typically NOT be used directly.
- Author:
- Eelco Hillenius, Jonathan Locke
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
add
(Component reporter, Serializable message, int level) Adds a messagefinal void
add
(FeedbackMessage message) Adds a message.final int
clear()
Clears any existing messages.final int
clear
(IFeedbackMessageFilter filter) Clears all messages that are accepted by the filter.final void
debug
(Component reporter, Serializable message) Adds a new ui message with level DEBUG to the current messages.void
detach()
Detaches each stored messagefinal void
error
(Component reporter, Serializable message) Adds a new ui message with level ERROR to the current messages.final void
fatal
(Component reporter, Serializable message) Adds a new ui message with level FATAL to the current messages.final FeedbackMessage
first()
Retrieves the first messagefinal FeedbackMessage
first
(int level) Retrieves the first message that level is greater than or equal to the given levelfinal boolean
hasMessage
(int level) Checks if a message of the specifiedlevel
or greater was registered.
To check for a preciselevel
usehasMessage(IFeedbackMessageFilter)
and pass it a reference toExactLevelFeedbackMessageFilter
.final boolean
hasMessage
(IFeedbackMessageFilter filter) final void
info
(Component reporter, Serializable message) Adds a new ui message with level INFO to the current messages.final boolean
isEmpty()
Gets whether there are no messages.final Iterator<FeedbackMessage>
iterator()
Gets an iterator over stored messagesfinal List<FeedbackMessage>
messages
(IFeedbackMessageFilter filter) Gets a list of messages from the page using a filter.final int
size()
Gets the number of messagesfinal int
size
(IFeedbackMessageFilter filter) Gets the number of messages.final void
success
(Component reporter, Serializable message) Adds a new ui message with level SUCCESS to the current messages.toList()
Retrieves all stored messages as an unmodifiable listtoString()
final void
warn
(Component reporter, Serializable message) Adds a new ui message with level WARNING to the current messages.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
FeedbackMessages
public FeedbackMessages()Construct.
-
-
Method Details
-
add
Adds a message.- Parameters:
message
- the message
-
add
Adds a message- Parameters:
reporter
-message
-level
-
-
debug
Adds a new ui message with level DEBUG to the current messages.- Parameters:
reporter
- the reporting componentmessage
- the actual message
-
info
Adds a new ui message with level INFO to the current messages.- Parameters:
reporter
- The reporting componentmessage
- The actual message
-
success
Adds a new ui message with level SUCCESS to the current messages.- Parameters:
reporter
- The reporting componentmessage
- The actual message
-
warn
Adds a new ui message with level WARNING to the current messages.- Parameters:
reporter
- the reporting componentmessage
- the actual message
-
error
Adds a new ui message with level ERROR to the current messages.- Parameters:
reporter
- the reporting componentmessage
- the actual message
-
fatal
Adds a new ui message with level FATAL to the current messages.- Parameters:
reporter
- the reporting componentmessage
- the actual message
-
clear
Clears any existing messages.- Returns:
- The number of messages deleted
-
clear
Clears all messages that are accepted by the filter.- Parameters:
filter
- Filter for selecting messages. If null, all messages will be returned- Returns:
- The number of messages deleted
-
hasMessage
- Parameters:
filter
- Filter for selecting messages- Returns:
- True if one or more messages matches the filter
-
hasMessage
Checks if a message of the specifiedlevel
or greater was registered.
To check for a preciselevel
usehasMessage(IFeedbackMessageFilter)
and pass it a reference toExactLevelFeedbackMessageFilter
.- Parameters:
level
- The level of the message- Returns:
true
if a message with the specifiedlevel
or greater was registered
-
first
Retrieves the first message- Returns:
- message or
null
if none
-
first
Retrieves the first message that level is greater than or equal to the given level- Parameters:
level
- The minimum level of the message- Returns:
- a message with the same or a higher level, or
null
if none
-
iterator
Gets an iterator over stored messages- Specified by:
iterator
in interfaceIterable<FeedbackMessage>
- Returns:
- iterator over stored messages
-
messages
Gets a list of messages from the page using a filter.- Parameters:
filter
- Filter for selecting messages. If null, all messages will be returned- Returns:
- The messages or an empty list if no messages are found
-
isEmpty
Gets whether there are no messages.- Returns:
- True when there are no messages
-
size
Gets the number of messages- Returns:
- the number of messages
-
size
Gets the number of messages.- Parameters:
filter
- Filter for counting messages. If null, the count of all messages will be returned- Returns:
- the number of messages
-
toString
-
toList
Retrieves all stored messages as an unmodifiable list- Returns:
- stored messages as unmodifiable list
-
detach
Detaches each stored message
-