package de.fred4jupiter.fredbet.web;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

@Component
public class MessageUtil {

	public void addInfoMsg(RedirectAttributes redirect, String text) {
		addMessage(redirect, "alert-success",text);
	}

	private void addMessage(RedirectAttributes redirect, String cssClass,String text) {
		redirect.addFlashAttribute("globalMessage", new WebMessage(cssClass, text));
	}

	public void addWarnMsg(RedirectAttributes redirect, String text) {
		addMessage(redirect, "alert-success",text);
	}

	public void addErrorMsg(RedirectAttributes redirect, String text) {
		addMessage(redirect, "alert-success",text);
	}

	public static final class WebMessage {
		private String cssClass;

		private String text;

		public WebMessage(String cssClass, String text) {
			super();
			this.cssClass = cssClass;
			this.text = text;
		}

		public String getCssClass() {
			return cssClass;
		}

		public String getText() {
			return text;
		}

	}
}

@@ -567,39 +567,39 @@
 edirect, %22alert-
-success
+warning
 %22,text);%0A%09%7D%0A%0A%09pu
@@ -686,39 +686,38 @@
 edirect, %22alert-
-success
+danger
 %22,text);%0A%09%7D%0A%0A%09pu

update css classes