You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

The problem I had with FeedbackPanel is that it doesn't allow me to change the CSS style based on the kinds of messages it contains. So, with some help from wicket-user, I was able to put this together:

public class CSSFeedbackPanel extends FeedbackPanel {
public CSSFeedbackPanel(final String id) {
super(id);
WebMarkupContainer feedbackul = (WebMarkupContainer) get("feedbackul");
if (feedbackul != null) {
feedbackul.add(new AttributeModifier("class", true, new Model() {
public Object getObject(Component comp) {
if (anyMessage()) {
if (anyMessage(FeedbackMessage.INFO))

Unknown macro: { return "feedbackulINFO"; }

else if (anyMessage(FeedbackMessage.ERROR))

Unknown macro: { return "feedbackulERROR"; }

else

Unknown macro: { return "feedbackulNONE"; }

}
else

Unknown macro: { return "feedbackulNONE"; }

}
}));
}
}
}

It's just a drop-in replacement for FeedbackPanel that changes the CSS style based on the type of messages contained. The problem is that it doesn't work well if there are multiple message types in the panel.

  • No labels