aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/terminal/UserError.java
diff options
context:
space:
mode:
authorMarc Englund <marc.englund@itmill.com>2007-11-19 14:03:05 +0000
committerMarc Englund <marc.englund@itmill.com>2007-11-19 14:03:05 +0000
commitf2e3722df9676436680afc0f1991e91e1696fb99 (patch)
tree6f255ff78abaf96f1e71a1f2c9ecd3b66647f4a2 /src/com/itmill/toolkit/terminal/UserError.java
parent93291f532db9d545cf2a8dd98e2671f27cd197b0 (diff)
downloadvaadin-framework-f2e3722df9676436680afc0f1991e91e1696fb99.tar.gz
vaadin-framework-f2e3722df9676436680afc0f1991e91e1696fb99.zip
MASS REFORMAT.
According to http://toolkit.intra.itmill.com/trac/itmilltoolkit/wiki/CodingConventions svn changeset:2864/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/terminal/UserError.java')
-rw-r--r--src/com/itmill/toolkit/terminal/UserError.java246
1 files changed, 124 insertions, 122 deletions
diff --git a/src/com/itmill/toolkit/terminal/UserError.java b/src/com/itmill/toolkit/terminal/UserError.java
index 53b44fded8..6915f07378 100644
--- a/src/com/itmill/toolkit/terminal/UserError.java
+++ b/src/com/itmill/toolkit/terminal/UserError.java
@@ -39,127 +39,129 @@ package com.itmill.toolkit.terminal;
*/
public class UserError implements ErrorMessage {
- /**
- * Content mode, where the error contains only plain text.
- */
- public static final int CONTENT_TEXT = 0;
-
- /**
- * Content mode, where the error contains preformatted text.
- */
- public static final int CONTENT_PREFORMATTED = 1;
-
- /**
- * Formatted content mode, where the contents is XML restricted to the UIDL
- * 1.0 formatting markups.
- */
- public static final int CONTENT_UIDL = 2;
-
- /**
- * Content mode.
- */
- private int mode = CONTENT_TEXT;
-
- /**
- * Message in content mode.
- */
- private String msg;
-
- /**
- * Error level.
- */
- private int level = ErrorMessage.ERROR;
-
- /**
- * Creates a textual error message of level ERROR.
- *
- * @param textErrorMessage
- * the text of the error message.
- */
- public UserError(String textErrorMessage) {
- this.msg = textErrorMessage;
- }
-
- /**
- * Creates a error message with level and content mode.
- *
- * @param message
- * the error message.
- * @param contentMode
- * the content Mode.
- * @param errorLevel
- * the level of error.
- */
- public UserError(String message, int contentMode, int errorLevel) {
-
- // Check the parameters
- if (contentMode < 0 || contentMode > 2)
- throw new java.lang.IllegalArgumentException(
- "Unsupported content mode: " + contentMode);
-
- this.msg = message;
- this.mode = contentMode;
- this.level = errorLevel;
- }
-
- /* Documenten in interface */
- public int getErrorLevel() {
- return level;
- }
-
- /* Documenten in interface */
- public void addListener(RepaintRequestListener listener) {
- }
-
- /* Documenten in interface */
- public void removeListener(RepaintRequestListener listener) {
- }
-
- /* Documenten in interface */
- public void requestRepaint() {
- }
-
- /* Documenten in interface */
- public void paint(PaintTarget target) throws PaintException {
-
- target.startTag("error");
-
- // Error level
- if (level >= ErrorMessage.SYSTEMERROR)
- target.addAttribute("level", "system");
- else if (level >= ErrorMessage.CRITICAL)
- target.addAttribute("level", "critical");
- else if (level >= ErrorMessage.ERROR)
- target.addAttribute("level", "error");
- else if (level >= ErrorMessage.WARNING)
- target.addAttribute("level", "warning");
- else
- target.addAttribute("level", "info");
-
- // Paint the message
- switch (mode) {
- case CONTENT_TEXT:
- target.addText(msg);
- break;
- case CONTENT_UIDL:
- target.addUIDL(msg);
- break;
- case CONTENT_PREFORMATTED:
- target.startTag("pre");
- target.addText(msg);
- target.endTag("pre");
- }
-
- target.endTag("error");
- }
-
- /* Documenten in interface */
- public void requestRepaintRequests() {
- }
-
- /* Documented in superclass */
- public String toString() {
- return msg;
- }
+ /**
+ * Content mode, where the error contains only plain text.
+ */
+ public static final int CONTENT_TEXT = 0;
+
+ /**
+ * Content mode, where the error contains preformatted text.
+ */
+ public static final int CONTENT_PREFORMATTED = 1;
+
+ /**
+ * Formatted content mode, where the contents is XML restricted to the UIDL
+ * 1.0 formatting markups.
+ */
+ public static final int CONTENT_UIDL = 2;
+
+ /**
+ * Content mode.
+ */
+ private int mode = CONTENT_TEXT;
+
+ /**
+ * Message in content mode.
+ */
+ private String msg;
+
+ /**
+ * Error level.
+ */
+ private int level = ErrorMessage.ERROR;
+
+ /**
+ * Creates a textual error message of level ERROR.
+ *
+ * @param textErrorMessage
+ * the text of the error message.
+ */
+ public UserError(String textErrorMessage) {
+ msg = textErrorMessage;
+ }
+
+ /**
+ * Creates a error message with level and content mode.
+ *
+ * @param message
+ * the error message.
+ * @param contentMode
+ * the content Mode.
+ * @param errorLevel
+ * the level of error.
+ */
+ public UserError(String message, int contentMode, int errorLevel) {
+
+ // Check the parameters
+ if (contentMode < 0 || contentMode > 2) {
+ throw new java.lang.IllegalArgumentException(
+ "Unsupported content mode: " + contentMode);
+ }
+
+ msg = message;
+ mode = contentMode;
+ level = errorLevel;
+ }
+
+ /* Documenten in interface */
+ public int getErrorLevel() {
+ return level;
+ }
+
+ /* Documenten in interface */
+ public void addListener(RepaintRequestListener listener) {
+ }
+
+ /* Documenten in interface */
+ public void removeListener(RepaintRequestListener listener) {
+ }
+
+ /* Documenten in interface */
+ public void requestRepaint() {
+ }
+
+ /* Documenten in interface */
+ public void paint(PaintTarget target) throws PaintException {
+
+ target.startTag("error");
+
+ // Error level
+ if (level >= ErrorMessage.SYSTEMERROR) {
+ target.addAttribute("level", "system");
+ } else if (level >= ErrorMessage.CRITICAL) {
+ target.addAttribute("level", "critical");
+ } else if (level >= ErrorMessage.ERROR) {
+ target.addAttribute("level", "error");
+ } else if (level >= ErrorMessage.WARNING) {
+ target.addAttribute("level", "warning");
+ } else {
+ target.addAttribute("level", "info");
+ }
+
+ // Paint the message
+ switch (mode) {
+ case CONTENT_TEXT:
+ target.addText(msg);
+ break;
+ case CONTENT_UIDL:
+ target.addUIDL(msg);
+ break;
+ case CONTENT_PREFORMATTED:
+ target.startTag("pre");
+ target.addText(msg);
+ target.endTag("pre");
+ }
+
+ target.endTag("error");
+ }
+
+ /* Documenten in interface */
+ public void requestRepaintRequests() {
+ }
+
+ /* Documented in superclass */
+ public String toString() {
+ return msg;
+ }
}