org.apache.wicket.markup.html.panel
Class FeedbackPanel

java.lang.Object
  extended by org.apache.wicket.Component
      extended by org.apache.wicket.MarkupContainer
          extended by org.apache.wicket.markup.html.WebMarkupContainer
              extended by org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup
                  extended by org.apache.wicket.markup.html.panel.Panel
                      extended by org.apache.wicket.markup.html.panel.FeedbackPanel
All Implemented Interfaces:
Serializable, IFeedback, IClusterable, IConverterLocator, IHeaderPartContainerProvider
Direct Known Subclasses:
ComponentFeedbackPanel

public class FeedbackPanel
extends Panel
implements IFeedback

A panel that displays FeedbackMessages in a list view. The maximum number of messages to show can be set with setMaxMessages().

Author:
Jonathan Locke, Eelco Hillenius
See Also:
FeedbackMessage, FeedbackMessages, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.wicket.Component
Component.ComponentModelChange, Component.EnabledChange, Component.IVisitor<T extends Component>, Component.VisibilityChange
 
Field Summary
 
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_CONFIGURED, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER
 
Constructor Summary
FeedbackPanel(String id)
           
FeedbackPanel(String id, IFeedbackMessageFilter filter)
           
 
Method Summary
 boolean anyErrorMessage()
          Search messages that this panel will render, and see if there is any message of level ERROR or up.
 boolean anyMessage()
          Search messages that this panel will render, and see if there is any message.
 boolean anyMessage(int level)
          Search messages that this panel will render, and see if there is any message of the given level.
protected  String getCSSClass(FeedbackMessage message)
          Gets the css class for the given message.
protected  List<FeedbackMessage> getCurrentMessages()
          Gets the currently collected messages for this panel.
 boolean getEscapeMessages()
          Deprecated. use Component.getEscapeModelStrings() instead
 FeedbackMessagesModel getFeedbackMessagesModel()
           
 IFeedbackMessageFilter getFilter()
           
 Comparator<FeedbackMessage> getSortingComparator()
           
 boolean isVersioned()
           
protected  FeedbackMessagesModel newFeedbackMessagesModel()
          Gets a new instance of FeedbackMessagesModel to use.
protected  Component newMessageDisplayComponent(String id, FeedbackMessage message)
          Generates a component that is used to display the message inside the feedback panel.
 void setEscapeMessages(boolean escapeMessages)
          Deprecated. use Component.setEscapeModelStrings(boolean)
 FeedbackPanel setFilter(IFeedbackMessageFilter filter)
          Sets a filter to use on the feedback messages model
 FeedbackPanel setMaxMessages(int maxMessages)
           
 FeedbackPanel setSortingComparator(Comparator<FeedbackMessage> sortingComparator)
          Sets the comparator used for sorting the messages.
 
Methods inherited from class org.apache.wicket.markup.html.panel.Panel
onComponentTag, onComponentTagBody, renderHead
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup
newHeaderPartContainer, renderHeadFromAssociatedMarkupFile
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getMarkupType, getWebPage, getWebRequest
 
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, autoAdd, contains, findMarkupStream, get, get, getAssociatedMarkupStream, getMarkupStream, hasAssociatedMarkup, internalAdd, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onAfterRenderChildren, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, renderNext, replace, setDefaultModel, setMarkupStream, size, swap, toString, toString, visitChildren, visitChildren
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, callOnBeforeRenderIfNotVisible, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, configure, continueToOriginalDestination, debug, detach, detachBehaviors, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviors, getBehaviors, getBehaviorsRawList, getClassRelativePath, getComponentBorder, getConverter, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessage, getFlag, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdImpl, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalAttach, internalDetach, internalOnAttach, internalOnDetach, internalOnModelChanged, isActionAuthorized, isAncestorOf, isAttached, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVisibilityAllowed, isVisible, isVisibleInHierarchy, locateMarkupStream, markAttached, markRendering, modelChanged, modelChanging, onAfterRender, onAttach, onBeforeRender, onBeginRequest, onConfigure, onDetach, onEndRequest, onInitialize, onModelChanged, onModelChanging, onRemove, prepareForRender, prepareForRender, redirectToInterceptPage, remove, remove, render, render, renderComponent, renderComponent, renderComponentTag, rendered, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, setAuto, setComponentBorder, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setFlag, setIgnoreAttributeModifier, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FeedbackPanel

public FeedbackPanel(String id)
See Also:
Component.Component(String)

FeedbackPanel

public FeedbackPanel(String id,
                     IFeedbackMessageFilter filter)
Parameters:
id -
filter -
See Also:
Component.Component(String)
Method Detail

anyErrorMessage

public final boolean anyErrorMessage()
Search messages that this panel will render, and see if there is any message of level ERROR or up. This is a convenience method; same as calling 'anyMessage(FeedbackMessage.ERROR)'.

Returns:
whether there is any message for this panel of level ERROR or up

anyMessage

public final boolean anyMessage()
Search messages that this panel will render, and see if there is any message.

Returns:
whether there is any message for this panel

anyMessage

public final boolean anyMessage(int level)
Search messages that this panel will render, and see if there is any message of the given level.

Parameters:
level - the level, see FeedbackMessage
Returns:
whether there is any message for this panel of the given level

getEscapeMessages

@Deprecated
public final boolean getEscapeMessages()
Deprecated. use Component.getEscapeModelStrings() instead

Gets whether model messages should be HTML escaped. Default is true.

Returns:
whether model messages should be HTML escaped

getFeedbackMessagesModel

public final FeedbackMessagesModel getFeedbackMessagesModel()
Returns:
Model for feedback messages on which you can install filters and other properties

getFilter

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

getSortingComparator

public final Comparator<FeedbackMessage> getSortingComparator()
Returns:
The current sorting comparator

isVersioned

public boolean isVersioned()
Overrides:
isVersioned in class Component
Returns:
True if this component is versioned
See Also:
Component.isVersioned()

setEscapeMessages

@Deprecated
public final void setEscapeMessages(boolean escapeMessages)
Deprecated. use Component.setEscapeModelStrings(boolean)

Sets whether model messages should be HTML escaped. Default is true.

Parameters:
escapeMessages - whether model messages should be HTML escaped

setFilter

public final FeedbackPanel setFilter(IFeedbackMessageFilter filter)
Sets a filter to use on the feedback messages model

Parameters:
filter - The message filter to install on the feedback messages model
Returns:
FeedbackPanel this.

setMaxMessages

public final FeedbackPanel setMaxMessages(int maxMessages)
Parameters:
maxMessages - The maximum number of feedback messages that this feedback panel should show at one time
Returns:
FeedbackPanel this.

setSortingComparator

public final FeedbackPanel setSortingComparator(Comparator<FeedbackMessage> sortingComparator)
Sets the comparator used for sorting the messages.

Parameters:
sortingComparator - comparator used for sorting the messages.
Returns:
FeedbackPanel this.

getCSSClass

protected String getCSSClass(FeedbackMessage message)
Gets the css class for the given message.

Parameters:
message - the message
Returns:
the css class; by default, this returns feedbackPanel + the message level, eg 'feedbackPanelERROR', but you can override this method to provide your own

getCurrentMessages

protected final List<FeedbackMessage> getCurrentMessages()
Gets the currently collected messages for this panel.

Returns:
the currently collected messages for this panel, possibly empty

newFeedbackMessagesModel

protected FeedbackMessagesModel newFeedbackMessagesModel()
Gets a new instance of FeedbackMessagesModel to use.

Returns:
Instance of FeedbackMessagesModel to use

newMessageDisplayComponent

protected Component newMessageDisplayComponent(String id,
                                               FeedbackMessage message)
Generates a component that is used to display the message inside the feedback panel. This component must handle being attached to span tags. By default a Label is used. Note that the created component is expected to respect feedback panel's Component.getEscapeModelStrings() value

Parameters:
id - parent id
message - feedback message
Returns:
component used to display the message


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