Class FencedFeedbackPanel
- java.lang.Object
-
- org.apache.wicket.Component
-
- org.apache.wicket.MarkupContainer
-
- org.apache.wicket.markup.html.WebMarkupContainer
-
- org.apache.wicket.markup.html.panel.Panel
-
- org.apache.wicket.markup.html.panel.FeedbackPanel
-
- org.apache.wicket.feedback.FencedFeedbackPanel
-
- All Implemented Interfaces:
Serializable
,Iterable<Component>
,IEventSink
,IEventSource
,IFeedback
,IFeedbackContributor
,IConverterLocator
,IMetadataContext<Serializable,Component>
,IQueueRegion
,IHeaderContributor
,IRequestableComponent
,IHierarchical<Component>
,IClusterable
public class FencedFeedbackPanel extends FeedbackPanel
A specialized feedback panel that only displays messages from inside a fence defined by a container component. Instances will not show messages coming from inside a nested fence, allowing the nesting of these panels to work correctly without displaying the same feedback message twice. A constructor that does not takes a fencing component creates a catch-all panel that shows messages that do not come from inside any fence or from theSession
.IN DEPTH EXPLANATION
It is often very useful to have feedback panels that show feedback that comes from inside a certain container only. For example given a page with the following structure:
Page Form1 Feedback1 Input1 Form2 Feedback2 Input2
we want Feedback2 to show messages originating only from inside Form2 and Feedback1 to show messages only originating from Form1 but not Form2 (because messages originating from Form2 are already shown by Feedback2).
It is fairly simple to configure Feedback2 - a
ContainerFeedbackMessageFilter
added to the regularFeedbackPanel
will do the trick. The hard part is configuring Feedback1. We can add aContainerFeedbackMessageFilter
to it, but since Form2 is inside Form1 the container filter will allow messages from both Form1 and Form2 to be added to FeedbackPanel1.This is where the
FencedFeedbackPanel
comes in. All we have to do is to make FeedbackPanel2 aFencedFeedbackPanel
with the fencing component defined as Form2 and Feedback1 aFencedFeedbackPanel
with the fencing component defined as Form1.FencedFeedbackPanel
will only show messages that original from inside its fencing component and not from inside any descendant component that acts as a fence for anotherFencedFeedbackPanel
.When created with a
null
fencing component or using a constructor that does not take one the panel will only display messages that do not come from inside a fence. It will also display messages that come fromSession
. This acts as a catch-all panels showing messages that would not be shown using any other instance of theFencedFeedbackPanel
created with a fencing component. There is usually one instance of such a panel at the top of the page to display notifications of success.- Author:
- igor
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER, RFLAG_CONTAINER_DEQUEING, RFLAG_CONTAINER_HAS_REMOVALS
-
-
Constructor Summary
Constructors Constructor Description FencedFeedbackPanel(String id)
Creates a catch-all feedback panel that will show messages not coming from any fence, including messages coming fromSession
FencedFeedbackPanel(String id, Component fence)
Creates a feedback panel that will only show messages if they original from, or inside of, thefence
component and not from any inner fence.FencedFeedbackPanel(String id, Component fence, IFeedbackMessageFilter filter)
Creates a fenced feedback panel with a filter.FencedFeedbackPanel(String id, IFeedbackMessageFilter filter)
Creates a catch-all instance with a filter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FeedbackMessagesModel
newFeedbackMessagesModel()
Gets a new instance of FeedbackMessagesModel to use.protected void
onReAdd()
This method is called whenever a component is re-added to the page's component tree, if it had been removed at some earlier time, i.e., if it is already initialized (seeComponent.isInitialized()
).protected void
onRemove()
Called to notify the component it is being removed from the component hierarchy Overrides of this method MUST call the super implementation, the most logical place to do this is the last line of the override method.-
Methods inherited from class org.apache.wicket.markup.html.panel.FeedbackPanel
anyErrorMessage, anyMessage, anyMessage, getCSSClass, getCurrentMessages, getFeedbackMessagesModel, getFilter, getSortingComparator, isVersioned, newMessageDisplayComponent, newMessageItem, setFilter, setMaxMessages, setSortingComparator
-
Methods inherited from class org.apache.wicket.markup.html.panel.Panel
getRegionMarkup, 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, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, dequeuePreamble, findChildComponent, findComponentToDequeue, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onComponentTagBody, onDetach, onInitialize, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, stream, streamChildren, toString, toString, visitChildren, visitChildren
-
Methods inherited from class org.apache.wicket.Component
add, addStateChange, beforeRender, canCallListener, canCallListenerAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, createConverter, 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, getMarkupTag, 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, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isInitialized, isRenderAllowed, isRendering, isStateless, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, onAfterRender, onBeforeRender, onComponentTag, onConfigure, onEvent, onModelChanged, onModelChanging, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderPart, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlForListener, urlForListener, visitParents, visitParents, warn, wrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.wicket.feedback.IFeedback
beforeRender
-
Methods inherited from interface org.apache.wicket.IQueueRegion
dequeue, newDequeueContext
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
FencedFeedbackPanel
public FencedFeedbackPanel(String id)
Creates a catch-all feedback panel that will show messages not coming from any fence, including messages coming fromSession
- Parameters:
id
-
-
FencedFeedbackPanel
public FencedFeedbackPanel(String id, Component fence)
Creates a feedback panel that will only show messages if they original from, or inside of, thefence
component and not from any inner fence.- Parameters:
id
-fence
-
-
FencedFeedbackPanel
public FencedFeedbackPanel(String id, IFeedbackMessageFilter filter)
Creates a catch-all instance with a filter.- Parameters:
id
-filter
-- See Also:
FencedFeedbackPanel(String)
-
FencedFeedbackPanel
public FencedFeedbackPanel(String id, Component fence, IFeedbackMessageFilter filter)
Creates a fenced feedback panel with a filter.- Parameters:
id
-fence
-filter
-- See Also:
FencedFeedbackPanel(String, Component)
-
-
Method Detail
-
onRemove
protected void onRemove()
Description copied from class:Component
Called to notify the component it is being removed from the component hierarchy Overrides of this method MUST call the super implementation, the most logical place to do this is the last line of the override method.
-
newFeedbackMessagesModel
protected FeedbackMessagesModel newFeedbackMessagesModel()
Description copied from class:FeedbackPanel
Gets a new instance of FeedbackMessagesModel to use.- Overrides:
newFeedbackMessagesModel
in classFeedbackPanel
- Returns:
- Instance of FeedbackMessagesModel to use
-
onReAdd
protected void onReAdd()
Description copied from class:Component
This method is called whenever a component is re-added to the page's component tree, if it had been removed at some earlier time, i.e., if it is already initialized (seeComponent.isInitialized()
). This is similar to onInitialize, but only comes after the component has been removed and then added again:- onInitialize is only called the very first time a component is added
- onReAdd is not called the first time, but every time it is re-added after having been removed
-
-