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.panel.Panel
                  extended by org.apache.wicket.markup.html.panel.FeedbackPanel
All Implemented Interfaces:
Serializable, Iterable<Component>, IEventSink, IEventSource, IFeedback, IConverterLocator, IHeaderContributor, IRequestableComponent, IHierarchical<Component>, IClusterable
Direct Known Subclasses:
ComponentFeedbackPanel, FencedFeedbackPanel

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

Field Summary
 
Fields inherited from class org.apache.wicket.markup.html.panel.Panel
PANEL
 
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, 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.
 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.
 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
newMarkupSourcingStrategy
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession
 
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isRendering, isStateless, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, onAfterRender, onBeforeRender, onComponentTag, onConfigure, onDetach, onEvent, onInitialize, onModelChanged, onModelChanging, onReAdd, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, 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

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 should notify its holding page about changes in its state. If a Page is not versioned then it wont track changes in its components and will use the same Page.getPageId() during its lifetime
See Also:
Component.isVersioned()

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 © 2006–2017 Apache Software Foundation. All rights reserved.