You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Igor Vaynberg <ig...@gmail.com> on 2012/11/26 06:38:55 UTC

new hierarchical feedback panel added

a common question on this list is how to build "hierarchical" feedback
panels. i just checked in my attempt to help solve this problem into
master. here is the javadoc that explains what it does. feedback
welcome.

-igor

/**
 * 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 the {@link Session}.
 *
 * <h2>IN DEPTH EXPLANATION</h2>
 * <p>
 * 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:
 * </p>
 *
 * <pre>
 * Page
 *   Form1
 *     Feedback1
 *     Input1
 *     Form2
 *       Feedback2
 *       Input2
 * </pre>
 * <p>
 * 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).
 * </p>
 * <p>
 * It is fairly simple to configure Feedback2 - a {@link
ContainerFeedbackMessageFilter} added to
 * the regular {@link FeedbackPanel} will do the trick. The hard part
is configuring Feedback1. We
 * can add a {@link ContainerFeedbackMessageFilter} to it, but since
Form2 is inside Form1 the
 * container filter will allow messages from both Form1 and Form2 to
be added to FeedbackPanel1.
 * </p>
 * <p>
 * This is where the {@link FencedFeedbackPanel} comes in. All we have
to do is to make
 * FeedbackPanel2 a {@link FencedFeedbackPanel} with the fencing
component defined as Form2 and
 * Feedback1 a {@link FencedFeedbackPanel} with the fencing component
defiend as Form1.
 * {@link 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 another
 * {@link FencedFeedbackPanel}.
 * </p>
 * <p>
 * When created with a {@code 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 from {@link Session}. This acts as a catch-all
panels showing messages that
 * would not be shown using any other instance of the {@link
FencedFeedbackPanel} created witha
 * fencing component. There is usually one instance of such a panel at
the top of the page to
 * display notifications of success.
 * </p>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org