org.apache.wicket.feedback
Class FeedbackMessagesModel

java.lang.Object
  extended by org.apache.wicket.feedback.FeedbackMessagesModel
All Implemented Interfaces:
Serializable, IClusterable, IDetachable, IModel<List<FeedbackMessage>>

public class FeedbackMessagesModel
extends Object
implements IModel<List<FeedbackMessage>>

Model for extracting feedback messages.

Author:
Eelco Hillenius
See Also:
Serialized Form

Constructor Summary
FeedbackMessagesModel(Component component)
          Constructor.
FeedbackMessagesModel(Page page, IFeedbackMessageFilter filter)
          Constructor.
 
Method Summary
 void 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)
           
 void setObject(List<FeedbackMessage> object)
          Sets the model object.
 FeedbackMessagesModel setSortingComparator(Comparator<FeedbackMessage> sortingComparator)
          Sets the comparator used for sorting the messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeedbackMessagesModel

public FeedbackMessagesModel(Component component)
Constructor. Creates a model for all feedback messages on the page.

Parameters:
component - 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 apply
page - 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 interface IModel<List<FeedbackMessage>>
Returns:
The model object
See Also:
IModel.getObject()

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 interface IModel<List<FeedbackMessage>>
Parameters:
object - The model object
See Also:
IModel.setObject(java.lang.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 interface IDetachable
See Also:
IDetachable.detach()


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.