⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 feedbackmessage.java

📁 Wicket一个开发Java Web应用程序框架。它使得开发web应用程序变得容易而轻松。 Wicket利用一个POJO data beans组件使得它可以与任何持久层技术相结合。
💻 JAVA
字号:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements.  See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License.  You may obtain a copy of the License at * *      http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.apache.wicket.feedback;import java.io.Serializable;import java.util.HashMap;import java.util.Map;import org.apache.wicket.Component;import org.apache.wicket.IClusterable;/** * Represents a generic message meant for the end-user/ pages. *  * @author Eelco Hillenius * @author Jonathan Locke */public class FeedbackMessage implements IClusterable{	private static final long serialVersionUID = 1L;	/** Constant for debug level. */	public static final int DEBUG = 100;	/** Constant for error level. */	public static final int ERROR = 400;	/** Constant for fatal level. */	public static final int FATAL = 500;	/** Constant for info level. */	public static final int INFO = 200;	/**	 * Constant for an undefined level; note that components might decide not to render anything	 * when this level is used.	 */	public static final int UNDEFINED = 0;	/** Constant for warning level. */	public static final int WARNING = 300;	/** Levels as strings for debugging. */	private static final Map levelStrings = new HashMap();	static	{		levelStrings.put(new Integer(0), "UNDEFINED");		levelStrings.put(new Integer(100), "DEBUG");		levelStrings.put(new Integer(200), "INFO");		levelStrings.put(new Integer(300), "WARNING");		levelStrings.put(new Integer(400), "ERROR");		levelStrings.put(new Integer(500), "FATAL");	}	/**	 * The message level; can be used by rendering components. Note that what actually happens with	 * the level indication is totally up to the components that render messages like these. The	 * default level is UNDEFINED.	 */	private final int level;	/** The actual message. */	private final Serializable message;	/** The reporting component. */	private final Component reporter;	/** Whether or not this message has been rendered */	private boolean rendered = false;	/**	 * Construct using fields.	 * 	 * @param reporter	 *            The message reporter	 * @param message	 *            The actual message	 * @param level	 *            The level of the message	 */	public FeedbackMessage(final Component reporter, final Serializable message, final int level)	{		this.reporter = reporter;		this.message = message;		this.level = level;	}	/**	 * Gets whether or not this message has been rendered	 * 	 * @return true if this message has been rendered, false otherwise	 */	public final boolean isRendered()	{		return rendered;	}	/**	 * Marks this message as rendered.	 */	public final void markRendered()	{		rendered = true;	}	/**	 * Gets the message level; can be used by rendering components. Note that what actually happens	 * with the level indication is totally up to the components that render feedback messages.	 * 	 * @return The message level indicator.	 */	public final int getLevel()	{		return level;	}	/**	 * Gets the current level as a String	 * 	 * @return The current level as a String	 */	public String getLevelAsString()	{		return (String)levelStrings.get(new Integer(getLevel()));	}	/**	 * Gets the actual message.	 * 	 * @return the message.	 */	public final Serializable getMessage()	{		return message;	}	/**	 * Gets the reporting component.	 * 	 * @return the reporting component.	 */	public final Component getReporter()	{		return reporter;	}	/**	 * Gets whether the current level is DEBUG or up.	 * 	 * @return whether the current level is DEBUG or up.	 */	public final boolean isDebug()	{		return isLevel(DEBUG);	}	/**	 * Gets whether the current level is ERROR or up.	 * 	 * @return whether the current level is ERROR or up.	 */	public final boolean isError()	{		return isLevel(ERROR);	}	/**	 * Gets whether the current level is FATAL or up.	 * 	 * @return whether the current level is FATAL or up.	 */	public final boolean isFatal()	{		return isLevel(FATAL);	}	/**	 * Gets whether the current level is INFO or up.	 * 	 * @return whether the current level is INFO or up.	 */	public final boolean isInfo()	{		return isLevel(INFO);	}	/**	 * Returns whether this level is greater than or equal to the given level.	 * 	 * @param level	 *            the level	 * @return whether this level is greater than or equal to the given level	 */	public final boolean isLevel(int level)	{		return (getLevel() >= level);	}	/**	 * Gets whether the current level is UNDEFINED.	 * 	 * @return whether the current level is UNDEFINED.	 */	public final boolean isUndefined()	{		return (getLevel() == UNDEFINED);	}	/**	 * Gets whether the current level is WARNING or up.	 * 	 * @return whether the current level is WARNING or up.	 */	public final boolean isWarning()	{		return isLevel(WARNING);	}	/**	 * @see java.lang.Object#toString()	 */	public String toString()	{		return "[FeedbackMessage message = \"" + getMessage() + "\", reporter = " +				((getReporter() == null) ? "null" : getReporter().getId()) + ", level = " +				getLevelAsString() + "]";	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -