wicket.feedback
Class FeedbackMessagesModel

java.lang.Object
  extended by wicket.model.AbstractDetachableModel
      extended by wicket.feedback.FeedbackMessagesModel
All Implemented Interfaces:
java.io.Serializable, IDetachable, IModel

public class FeedbackMessagesModel
extends AbstractDetachableModel

Model for extracting feedback messages.

Author:
Eelco Hillenius
See Also:
Serialized Form

Constructor Summary
FeedbackMessagesModel()
          Constructor.
FeedbackMessagesModel(IFeedbackMessageFilter filter)
          Constructor.
 
Method Summary
 IFeedbackMessageFilter getFilter()
           
 IModel getNestedModel()
          Gets the nested model.
 java.util.Comparator getSortingComparator()
           
protected  void onAttach()
          Attaches to the current request.
protected  void onDetach()
          Detaches from the current request.
 java.lang.Object onGetObject(Component component)
          Called when getObject is called in order to retrieve the detachable object.
protected  void onSetObject(Component component, java.lang.Object object)
          Called when setObject is called in order to change the detachable object.
protected  java.util.List processMessages(java.util.List messages)
          Override this method to post process to the FeedbackMessage list.
 void setFilter(IFeedbackMessageFilter filter)
           
 void setSortingComparator(java.util.Comparator sortingComparator)
          Sets the comparator used for sorting the messages.
 
Methods inherited from class wicket.model.AbstractDetachableModel
attach, detach, getObject, isAttached, setObject, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FeedbackMessagesModel

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


FeedbackMessagesModel

public FeedbackMessagesModel(IFeedbackMessageFilter filter)
Constructor. Creates a model for all feedback messags accepted by the given filter.

Parameters:
filter - The filter to apply
Method Detail

getFilter

public final IFeedbackMessageFilter getFilter()
Returns:
The current message filter

getNestedModel

public final IModel getNestedModel()
Description copied from interface: IModel
Gets the nested model.

Specified by:
getNestedModel in interface IModel
Specified by:
getNestedModel in class AbstractDetachableModel
Returns:
The nested model object.
See Also:
IModel.getNestedModel()

getSortingComparator

public final java.util.Comparator getSortingComparator()
Returns:
The current sorting comparator

onGetObject

public final java.lang.Object onGetObject(Component component)
Description copied from class: AbstractDetachableModel
Called when getObject is called in order to retrieve the detachable object. Before this method is called, getObject() always calls attach() to ensure that the object is attached.

Specified by:
onGetObject in class AbstractDetachableModel
Parameters:
component - The component asking for the object
Returns:
The object
See Also:
AbstractDetachableModel.onGetObject(wicket.Component)

setFilter

public final void setFilter(IFeedbackMessageFilter filter)
Parameters:
filter - Filter to apply to model

setSortingComparator

public final void setSortingComparator(java.util.Comparator sortingComparator)
Sets the comparator used for sorting the messages.

Parameters:
sortingComparator - comparator used for sorting the messages

onAttach

protected void onAttach()
Description copied from class: AbstractDetachableModel
Attaches to the current request. Implement this method with custom behavior, such as loading the model object.

Specified by:
onAttach in class AbstractDetachableModel
See Also:
AbstractDetachableModel.onAttach()

onDetach

protected void onDetach()
Description copied from class: AbstractDetachableModel
Detaches from the current request. Implement this method with custom behavior, such as setting the model object to null.

Specified by:
onDetach in class AbstractDetachableModel
See Also:
AbstractDetachableModel.onDetach()

onSetObject

protected void onSetObject(Component component,
                           java.lang.Object object)
Description copied from class: AbstractDetachableModel
Called when setObject is called in order to change the detachable object. Before this method is called, setObject() always calls attach() to ensure that the object is attached.

Specified by:
onSetObject in class AbstractDetachableModel
Parameters:
component - The component asking for replacement of the model object
object - The new model object
See Also:
AbstractDetachableModel.onSetObject(wicket.Component, java.lang.Object)

processMessages

protected java.util.List processMessages(java.util.List 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


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