You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Pedro Santos <pe...@gmail.com> on 2011/01/03 12:10:40 UTC

Re: Display component feedback message once: "safety net" renders them always before

Hi Joseph, I didn't understood your solution

If have an page with 3 form components and 5 feedback panels: 1 for each
form component, 1 for the form, and the last one for the page. And I want
feedback messages address to form components to be presented only by the
correspondent feedback panel.
I would create:
FeedbackPanel fp1 = new
ComponentFeedbackPanel("formComponent1FeedbackPanel", formComponent1);
FeedbackPanel fp2 = new
ComponentFeedbackPanel("formComponent2FeedbackPanel", formComponent2);
FeedbackPanel fp3 = new
ComponentFeedbackPanel("formComponent3FeedbackPanel", formComponent3);
FeedbackPanel fp4 = new ComponentFeedbackPanel("formFeedbackPanel", form);
FeedbackPanel fp5 = new ComponentFeedbackPanel("pageFeedbackPanel", page);

formComponent1.info("some message") register an message that will only be
presented by fp1
form.error("some message") register an message that will only be presented
by the form

On Wed, Dec 29, 2010 at 12:05 PM, joseph.pachod <jp...@thomas-daily.de> wrote:

>
> Hi Pedro Santos
>
> I hadn't seen your answer, sorry.
>
> In between, I had time again to look into my issue.
>
> Actually, the root of it was about not displaying the feedback message
> twice: once in the general feedback panel and once close from the
> generating
> component.
>
> As such, while helpful, your solution didn't help there.
>
> But I now found this "workaround" for this:
>  add(new FeedbackPanel("plainFeedback", new IFeedbackMessageFilter()
>            {
>
>                @Override
>                public boolean accept(final FeedbackMessage message)
>                {
>                    List<IBehavior> behaviors =
> message.getReporter().getBehaviors();
>                    for (IBehavior behavior : behaviors)
>                    {
>                        if (behavior instanceof FeedbackHighlightBehavior)
>                        {
>                            return false;
>                        }
>                    }
>                    return true;
>                }
>            }));
>
> => the feedback panel doesn't display the message twice :)
>
> I have yet to put this change in production, where maybe I would have to do
> extra check (like to check that the reporter component is effectively
> visible in order to be sure of the feedback message display), but at least
> I've found a way to go.
>
> :)
>
> ++
> joseph
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Display-component-feedback-message-once-safety-net-renders-them-always-before-tp3068969p3167130.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Pedro Henrique Oliveira dos Santos