wicket.feedback
Class FeedbackMessages

java.lang.Object
  extended bywicket.feedback.FeedbackMessages
All Implemented Interfaces:
java.io.Serializable

public final class FeedbackMessages
extends java.lang.Object
implements java.io.Serializable

Holds list of feedback messages. The list can be added to, cleared, queried and filtered.

Author:
Eelco Hillenius, Jonathan Locke
See Also:
Serialized Form

Constructor Summary
FeedbackMessages()
          Package local constructor; clients are not allowed to create instances as this class is managed by the framework.
 
Method Summary
(package private)  void add(FeedbackMessage message)
          Adds a message.
 void clear()
          Clears any existing messages
 void debug(Component reporter, java.lang.String message)
          Adds a new ui message with level DEBUG to the current messages.
 void error(Component reporter, java.lang.String message)
          Adds a new ui message with level ERROR to the current messages.
 void fatal(Component reporter, java.lang.String message)
          Adds a new ui message with level FATAL to the current messages.
 boolean hasErrorMessageFor(Component component)
          Convenience method that looks up whether the given component registered a message with this list with the level ERROR.
 boolean hasMessage(IFeedbackMessageFilter filter)
           
 boolean hasMessageFor(Component component)
          Looks up whether the given component registered a message with this list.
 boolean hasMessageFor(Component component, int level)
          Looks up whether the given component registered a message with this list with the given level.
 void info(Component reporter, java.lang.String message)
          Adds a new ui message with level INFO to the current messages.
 boolean isEmpty()
          Gets whether there are no messages.
 FeedbackMessage messageForComponent(Component component)
          Looks up a message for the given component.
 java.util.List messages(IFeedbackMessageFilter filter)
          Gets a list of messages from the page using a filter.
 java.lang.String toString()
           
 void warn(Component reporter, java.lang.String 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
 

Constructor Detail

FeedbackMessages

public FeedbackMessages()
Package local constructor; clients are not allowed to create instances as this class is managed by the framework.

Method Detail

clear

public final void clear()
Clears any existing messages


hasErrorMessageFor

public final boolean hasErrorMessageFor(Component component)
Convenience method that looks up whether the given component registered a message with this list with the level ERROR.

Parameters:
component - the component to look up whether it registered a message
Returns:
whether the given component registered a message with this list with level ERROR

hasMessageFor

public final boolean hasMessageFor(Component component)
Looks up whether the given component registered a message with this list.

Parameters:
component - the component to look up whether it registered a message
Returns:
whether the given component registered a message with this list

hasMessageFor

public final boolean hasMessageFor(Component component,
                                   int level)
Looks up whether the given component registered a message with this list with the given level.

Parameters:
component - The component to look up whether it registered a message
level - The level of the message
Returns:
Whether the given component registered a message with this list with the given level

isEmpty

public final boolean isEmpty()
Gets whether there are no messages.

Returns:
True when there are no messages

messageForComponent

public final FeedbackMessage messageForComponent(Component component)
Looks up a message for the given component.

Parameters:
component - the component to look up the message for
Returns:
the message that is found for the given component (first match) or null if none was found

hasMessage

public final boolean hasMessage(IFeedbackMessageFilter filter)
Parameters:
filter - Filter for selecting messages
Returns:
True if one or more messages matches the filter

messages

public final java.util.List messages(IFeedbackMessageFilter filter)
Gets a list of messages from the page using a filter.

Parameters:
filter - Filter for selecting messages
Returns:
The messages or an empty list if no messages are found

toString

public java.lang.String toString()
See Also:
Object.toString()

add

final void add(FeedbackMessage message)
Adds a message.

Parameters:
message - the message

debug

public final void debug(Component reporter,
                        java.lang.String message)
Adds a new ui message with level DEBUG to the current messages.

Parameters:
reporter - the reporting component
message - the actual message

error

public final void error(Component reporter,
                        java.lang.String message)
Adds a new ui message with level ERROR to the current messages.

Parameters:
reporter - the reporting component
message - the actual message

fatal

public final void fatal(Component reporter,
                        java.lang.String message)
Adds a new ui message with level FATAL to the current messages.

Parameters:
reporter - the reporting component
message - the actual message

info

public final void info(Component reporter,
                       java.lang.String message)
Adds a new ui message with level INFO to the current messages.

Parameters:
reporter - The reporting component
message - The actual message

warn

public final void warn(Component reporter,
                       java.lang.String message)
Adds a new ui message with level WARNING to the current messages.

Parameters:
reporter - the reporting component
message - the actual message


Copyright © 2004-2006 Wicket developers. All Rights Reserved.