I am trying to subclass FormComponentFeedbackIndicator and attach the panel to individual components.  My solution works in some scenarios, but with others the panel is always visible (with no messages, just an empty box).

This is my class

public class MessagePanel extends FormComponentFeedbackIndicator
{

    private static Log log = LogFactory.getLog(MessagePanel.class);

    MarkupContainer parent;

    public MessagePanel( String id, MarkupContainer parent )
    {
        super( id );

        FeedbackPanel feedback = new FeedbackPanel( "messages" );

        this.parent = parent;

        add( feedback );

    }


    @Override
    protected IFeedbackMessageFilter getFeedbackMessageFilter()
    {
        return new IFeedbackMessageFilter()
        {
            public boolean accept(FeedbackMessage feedbackMessage)
            {
                log.debug( "feedback:  " + feedbackMessage );
                
                if ( !feedbackMessage.isInfo() )
                    return false;

                return parent.contains( feedbackMessage.getReporter(), true ) || parent == feedbackMessage.getReporter();
            }
        };
    }

}


and here is the markup:

<wicket:panel>
    <div style="width: 100%; padding-top: 5px; border: 1px solid green; background-color: #F0FFF0">
        <span wicket:id="messages">Messages go here</span>
    </div>        
</wicket:panel>

So the code is attempting to isolate each message panel per-component (by filtering messages not reported by a child of the component).  The messages display when they should, and per-component as expected, I just can't figure out how to keep the panel hidden when there are no messages.  The isVisible() from FormComponentFeedbackIndicator should hide the panel, right?

Am I even attacking this solution the right way, or is there a better way to do it?

Aaron

_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to