All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.databasesandlife.util.wicket.DisappearingFeedbackPanel Maven / Gradle / Ivy

There is a newer version: 21.0.1
Show newest version
package com.databasesandlife.util.wicket;

import org.apache.wicket.Component;
import org.apache.wicket.feedback.FeedbackMessage;
import org.apache.wicket.feedback.IFeedbackMessageFilter;
import org.apache.wicket.markup.html.basic.MultiLineLabel;
import org.apache.wicket.markup.html.panel.FeedbackPanel;

/** 
 * Same as a FeedbackPanel but:
 * 
    *
  • The whole component is deleted from the markup in case there are no messages to display. *
  • If newlines are used in error messages, they are displayed as <br> characters in errors *
* * @author This source is copyright Adrian Smith and licensed under the LGPL 3. * @see Project on GitHub */ @SuppressWarnings("serial") public class DisappearingFeedbackPanel extends FeedbackPanel { public DisappearingFeedbackPanel(String id, IFeedbackMessageFilter filter) { super(id, filter); } public DisappearingFeedbackPanel(String id) { super(id); } public boolean isVisible() { if ( ! anyMessage()) return false; else return super.isVisible(); } @Override protected Component newMessageDisplayComponent(String id, FeedbackMessage message) { return new MultiLineLabel(id, message.getMessage().toString()); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy