java.lang.Object
org.apache.wicket.feedback.FeedbackMessagesModel
- All Implemented Interfaces:
Serializable
,IDetachable
,IModel<List<FeedbackMessage>>
,IClusterable
Model for extracting feedback messages.
- Author:
- Eelco Hillenius
- See Also:
-
Constructor Summary
ConstructorDescriptionFeedbackMessagesModel
(Component pageResolvingComponent) Constructor.FeedbackMessagesModel
(Page page, IFeedbackMessageFilter filter) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected List<FeedbackMessage>
collectMessages
(Component pageResolvingComponent, IFeedbackMessageFilter filter) Collects feedback messagesvoid
detach()
Detaches model after use.final IFeedbackMessageFilter
final List<FeedbackMessage>
Gets the model object.final Comparator<FeedbackMessage>
protected List<FeedbackMessage>
processMessages
(List<FeedbackMessage> messages) Override this method to post process to the FeedbackMessage list.final FeedbackMessagesModel
setFilter
(IFeedbackMessageFilter filter) setIncludeSession
(boolean includeSession) Controls whether or not feedback from theSession
will be collected.void
setObject
(List<FeedbackMessage> object) Sets the model object.final FeedbackMessagesModel
setSortingComparator
(Comparator<FeedbackMessage> sortingComparator) Sets the comparator used for sorting the messages.
-
Constructor Details
-
FeedbackMessagesModel
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
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 Details
-
getFilter
- Returns:
- The current message filter
-
getSortingComparator
- Returns:
- The current sorting comparator
-
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
- 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
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
Description copied from interface:IModel
Sets the model object.- Specified by:
setObject
in interfaceIModel<List<FeedbackMessage>>
- Parameters:
object
- The model object
-
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
Controls whether or not feedback from theSession
will be collected. SeeFeedbackCollector.setIncludeSession(boolean)
andSession.getFeedbackMessages()
- Parameters:
includeSession
-- Returns:
this
for chaining
-