public static void addMessage(MessageType type, String message) {
		List<HTMLElement> messages = (List<HTMLElement>) Session.getCurrent()
				.get("message.list");
		switch (type) {
		case ERROR:
			messages.add(new Error(message));
			break;
		case INFO:
			messages.add(new Info(message));
			break;
		case ALERT:
			messages.add(new Warning(message));
			break;
		case SUCCESS:
			messages.add(new Success(message));
			break;
		default:
			break;
		}
		String msgs = "";
		for (Iterator<HTMLElement> iterator = messages.iterator(); iterator
				.hasNext();) {
			HTMLElement htmlElement = (HTMLElement) iterator.next();
			msgs += htmlElement.renderHTML() + " ";
		}
		Session.getCurrent().getUpdates().addUpdate("messages", msgs);
		Session.getCurrent().store("message.list", messages);
	}