Class 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 the Session.

    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 regular FeedbackPanel will do the trick. The hard part is configuring Feedback1. We can add a 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.

    This is where the FencedFeedbackPanel comes in. All we have to do is to make FeedbackPanel2 a FencedFeedbackPanel with the fencing component defined as Form2 and Feedback1 a FencedFeedbackPanel 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 another FencedFeedbackPanel.

    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 from Session. This acts as a catch-all panels showing messages that would not be shown using any other instance of the FencedFeedbackPanel 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
    • 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.
        Overrides:
        onRemove in class Component
      • 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 (see Component.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
        You can think of it as the opposite of onRemove. A component that was once removed will not be re-initialized but only re-added. Subclasses that override this must call super.onReAdd().
        Overrides:
        onReAdd in class Component