Package org.apache.wicket.feedback
Class FeedbackMessagesModel
- java.lang.Object
-
- org.apache.wicket.feedback.FeedbackMessagesModel
-
- All Implemented Interfaces:
Serializable
,IDetachable
,IModel<List<FeedbackMessage>>
,IClusterable
public class FeedbackMessagesModel extends Object implements IModel<List<FeedbackMessage>>
Model for extracting feedback messages.- Author:
- Eelco Hillenius
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FeedbackMessagesModel(Component pageResolvingComponent)
Constructor.FeedbackMessagesModel(Page page, IFeedbackMessageFilter filter)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<FeedbackMessage>
collectMessages(Component pageResolvingComponent, IFeedbackMessageFilter filter)
Collects feedback messagesvoid
detach()
Detaches model after use.IFeedbackMessageFilter
getFilter()
List<FeedbackMessage>
getObject()
Gets the model object.Comparator<FeedbackMessage>
getSortingComparator()
protected List<FeedbackMessage>
processMessages(List<FeedbackMessage> messages)
Override this method to post process to the FeedbackMessage list.FeedbackMessagesModel
setFilter(IFeedbackMessageFilter filter)
FeedbackMessagesModel
setIncludeSession(boolean includeSession)
Controls whether or not feedback from theSession
will be collected.void
setObject(List<FeedbackMessage> object)
Sets the model object.FeedbackMessagesModel
setSortingComparator(Comparator<FeedbackMessage> sortingComparator)
Sets the comparator used for sorting the messages.
-
-
-
Constructor Detail
-
FeedbackMessagesModel
public FeedbackMessagesModel(Component pageResolvingComponent)
Constructor. Creates a model for all feedback messages on the page.- Parameters:
pageResolvingComponent
- The component where the page will be get from for which messages will be displayed usually the same page as the one feedbackpanel is attached to
-
FeedbackMessagesModel
public FeedbackMessagesModel(Page page, IFeedbackMessageFilter filter)
Constructor. Creates a model for all feedback messages accepted by the given filter.- Parameters:
filter
- The filter to applypage
- Page for which messages will be displayed - usually the same page as the one feedbackpanel is attached to
-
-
Method Detail
-
getFilter
public final IFeedbackMessageFilter getFilter()
- Returns:
- The current message filter
-
getSortingComparator
public final Comparator<FeedbackMessage> getSortingComparator()
- Returns:
- The current sorting comparator
-
getObject
public final List<FeedbackMessage> getObject()
Description copied from interface:IModel
Gets the model object.- Specified by:
getObject
in interfaceIModel<List<FeedbackMessage>>
- Returns:
- The model object
-
collectMessages
protected List<FeedbackMessage> collectMessages(Component pageResolvingComponent, IFeedbackMessageFilter filter)
Collects feedback messages- Parameters:
pageResolvingComponent
-filter
-- Returns:
- list of feedback messages
-
setFilter
public final FeedbackMessagesModel setFilter(IFeedbackMessageFilter filter)
- Parameters:
filter
- Filter to apply to model- Returns:
- this
-
setSortingComparator
public final FeedbackMessagesModel setSortingComparator(Comparator<FeedbackMessage> sortingComparator)
Sets the comparator used for sorting the messages.- Parameters:
sortingComparator
- comparator used for sorting the messages- Returns:
- this
-
processMessages
protected List<FeedbackMessage> processMessages(List<FeedbackMessage> messages)
Override this method to post process to the FeedbackMessage list.- Parameters:
messages
- List of sorted and filtered FeedbackMessages for further processing- Returns:
- The processed FeedbackMessage list
-
setObject
public void setObject(List<FeedbackMessage> object)
Description copied from interface:IModel
Sets the model object.- Specified by:
setObject
in interfaceIModel<List<FeedbackMessage>>
- Parameters:
object
- The model object
-
detach
public void detach()
Description copied from interface:IDetachable
Detaches model after use. This is generally used to null out transient references that can be re-attached later.- Specified by:
detach
in interfaceIDetachable
- Specified by:
detach
in interfaceIModel<List<FeedbackMessage>>
-
setIncludeSession
public FeedbackMessagesModel setIncludeSession(boolean includeSession)
Controls whether or not feedback from theSession
will be collected. SeeFeedbackCollector.setIncludeSession(boolean)
andSession.getFeedbackMessages()
- Parameters:
includeSession
-- Returns:
this
for chaining
-
-