// Path: core/src/main/java/com/premiumminds/webapp/wicket/UniqueFeedbackMessageFilter.java
// public class UniqueFeedbackMessageFilter implements IFeedbackMessageFilter {
// 	private static final long serialVersionUID = 1230282488271953295L;
// 	
// 	private List<FeedbackMessage> messages = new ArrayList<FeedbackMessage>();
// 	
// 	public void clearMessages(){
// 		messages.clear();
// 	}
// 
// 	@Override
// 	public boolean accept(FeedbackMessage message) {
// 		// too bad that FeedbackMessage doesnt have an equals implementation
// 		for(FeedbackMessage m : messages){
// 			if(m.getMessage().toString().equals(message.getMessage())) return false;
// 		}
// 		return true;
// 	}
// 
// }


import org.apache.wicket.Component;
import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
import org.apache.wicket.feedback.FeedbackMessage;
import org.apache.wicket.feedback.IFeedbackMessageFilter;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.util.visit.IVisitor;
import org.apache.wicket.util.visit.IVisit;
import com.premiumminds.webapp.wicket.UniqueFeedbackMessageFilter;
		
		add(new WebMarkupContainer("close"){
			private static final long serialVersionUID = 1566780832755857170L;

			@Override
			public void renderHead(IHeaderResponse response) {
				super.renderHead(response);
				
				StringBuilder sb = new StringBuilder();
				sb.append("$('#"+this.getMarkupId()+"').click(function(){");
				sb.append("  $('#"+BootstrapFeedbackPanel.this.getMarkupId()+"').hide();");
				sb.append("})");
				
				response.render(OnDomReadyHeaderItem.forScript(sb.toString()));
			}
		});
	}
	
	@Override
	protected void onConfigure() {
		super.onConfigure();
		setVisible(anyMessage());
	}

	/**
	 * Enable filter to only display unique feedback messages (enabled by default)
	 * @return this panel for fluent api
	 */
	public BootstrapFeedbackPanel uniqueMessages(){
		if(filter!=null){
// Path: core/src/main/java/com/premiumminds/webapp/wicket/UniqueFeedbackMessageFilter.java
// public class UniqueFeedbackMessageFilter implements IFeedbackMessageFilter {
// 	private static final long serialVersionUID = 1230282488271953295L;
// 	
// 	private List<FeedbackMessage> messages = new ArrayList<FeedbackMessage>();
// 	
// 	public void clearMessages(){
// 		messages.clear();
// 	}
// 
// 	@Override
// 	public boolean accept(FeedbackMessage message) {
// 		// too bad that FeedbackMessage doesnt have an equals implementation
// 		for(FeedbackMessage m : messages){
// 			if(m.getMessage().toString().equals(message.getMessage())) return false;
// 		}
// 		return true;
// 	}
// 
// }


// Path: core/src/main/java/com/premiumminds/webapp/wicket/bootstrap/BootstrapFeedbackPanel.java
import org.apache.wicket.Component;
import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
import org.apache.wicket.feedback.FeedbackMessage;
import org.apache.wicket.feedback.IFeedbackMessageFilter;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.util.visit.IVisitor;
import org.apache.wicket.util.visit.IVisit;
import com.premiumminds.webapp.wicket.UniqueFeedbackMessageFilter;

		
		add(new WebMarkupContainer("close"){
			private static final long serialVersionUID = 1566780832755857170L;

			@Override
			public void renderHead(IHeaderResponse response) {
				super.renderHead(response);
				
				StringBuilder sb = new StringBuilder();
				sb.append("$('#"+this.getMarkupId()+"').click(function(){");
				sb.append("  $('#"+BootstrapFeedbackPanel.this.getMarkupId()+"').hide();");
				sb.append("})");
				
				response.render(OnDomReadyHeaderItem.forScript(sb.toString()));
			}
		});
	}
	
	@Override
	protected void onConfigure() {
		super.onConfigure();
		setVisible(anyMessage());
	}

	/**
	 * Enable filter to only display unique feedback messages (enabled by default)
	 * @return this panel for fluent api
	 */
	public BootstrapFeedbackPanel uniqueMessages(){
		if(filter!=null){
			setFilter(new AndComposedFeedbackMessageFilter(new UniqueFeedbackMessageFilter(), new ExcludePopoverMessageFilter(), filter));