Thursday, July 26, 2012

Custom Wicket FeedbackPanel markup

I had to add custom static markup to the Wickets FeedBackPanel for a project I'm currently working on. The markup has to be visible only when the the feedback panel itself is visible. The easiest way to do this is to extend the original class, and provide a corresponding HTML file with the custom markup.
package com.javaeenotes;

import org.apache.wicket.markup.html.panel.FeedbackPanel;

public class ErrorPanel extends FeedbackPanel {
    private static final long serialVersionUID = 1L;

    public ErrorPanel(String id, IFeedbackMessageFilter filter) {
        super(id, filter);

    public ErrorPanel(String id) {
  <div class="feedbackPanel" wicket:id="feedbackul">
    <div class="errorlevel" wicket:id="messages">
      <span class="errorlevel" wicket:id="message">A message</span>
The HTML file is basically the same as the original file. I added an error header as an example.

No comments:

Post a Comment