com.databasesandlife.util.wicket.DisappearingFeedbackPanel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-common Show documentation
Show all versions of java-common Show documentation
Utility classes developed at Adrian Smith Software (A.S.S.)
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());
}
}