Author: pete
Date: Thu May 12 13:50:09 2011
New Revision: 1102303
URL: http://svn.apache.org/viewvc?rev=1102303&view=rev
Log:
WICKET-3707 add FeedbackMessages#messagesForComponent
Modified:
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/feedback/FeedbackMessages.java
Modified:
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/feedback/FeedbackMessages.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/feedback/FeedbackMessages.java?rev=1102303&r1=1102302&r2=1102303&view=diff
==============================================================================
---
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/feedback/FeedbackMessages.java
(original)
+++
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/feedback/FeedbackMessages.java
Thu May 12 13:50:09 2011
@@ -220,7 +220,7 @@ public final class FeedbackMessages impl
*/
public final boolean hasMessageFor(Component component)
{
- return messageForComponent(component) != null;
+ return messagesForComponent(component).isEmpty() == false;
}
/**
@@ -296,12 +296,12 @@ public final class FeedbackMessages impl
/**
* Looks up a message for the given component.
*
- * TODO: 1.5 This should be deprecated and return a Collection.
- *
* @param component
* the component to look up the message for
* @return the message that is found for the given component (first
match) or null if none was
* found
+ *
+ * @deprecated use {@link
FeedbackMessages#messagesForComponent(org.apache.wicket.Component)} instead
*/
public final FeedbackMessage messageForComponent(final Component
component)
{
@@ -316,6 +316,18 @@ public final class FeedbackMessages impl
}
/**
+ * Looks up the messages for the given component.
+ *
+ * @param component
+ * the component to look up the message for
+ * @return the messages that were found for the given component
+ */
+ public final List<FeedbackMessage> messagesForComponent(final Component
component)
+ {
+ return messages(new ComponentFeedbackMessageFilter(component));
+ }
+
+ /**
* Gets whether there are no messages.
*
* @return True when there are no messages