From: Johannes Dahlström Date: Mon, 11 Jun 2012 08:47:04 +0000 (+0300) Subject: Merge commit '2a72a' X-Git-Tag: 7.0.0.alpha3~190 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8fcb17519486c4629d90df4bc8f8db12a3d7a3ba;p=vaadin-framework.git Merge commit '2a72a' Conflicts: src/com/vaadin/terminal/UserError.java --- 8fcb17519486c4629d90df4bc8f8db12a3d7a3ba diff --cc src/com/vaadin/terminal/UserError.java index baaf331fa0,678e936dec..a7a4fd89e2 --- a/src/com/vaadin/terminal/UserError.java +++ b/src/com/vaadin/terminal/UserError.java @@@ -41,20 -61,105 +41,30 @@@ public class UserError extends Abstract * the text of the error message. */ public UserError(String textErrorMessage) { - msg = textErrorMessage; + super(textErrorMessage); } + /** - * Creates a error message with level and content mode. ++ * Creates an 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 > 3) { - throw new java.lang.IllegalArgumentException( - "Unsupported content mode: " + contentMode); - } - - msg = message; - mode = contentMode; - level = errorLevel; - } - - /* Documented in interface */ - public int getErrorLevel() { - return level; - } - - /* Documented in interface */ - public void addListener(RepaintRequestListener listener) { - } - - /* Documented in interface */ - public void removeListener(RepaintRequestListener listener) { - } - - /* Documented in interface */ - public void requestRepaint() { - } - - /* Documented 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"); + public UserError(String message, ContentMode contentMode, + ErrorLevel errorLevel) { + super(message); + if (contentMode == null) { + contentMode = ContentMode.TEXT; } - - // Paint the message - switch (mode) { - case CONTENT_TEXT: - target.addText(AbstractApplicationServlet.safeEscapeForHtml(msg)); - break; - case CONTENT_UIDL: - target.addUIDL(msg); - break; - case CONTENT_PREFORMATTED: - target.addText("
"
 -                    + AbstractApplicationServlet.safeEscapeForHtml(msg)
 -                    + "
"); - break; - case CONTENT_XHTML: - target.addText(msg); - break; + if (errorLevel == null) { + errorLevel = ErrorLevel.ERROR; } - - target.endTag("error"); - } - - /* Documented in interface */ - public void requestRepaintRequests() { - } - - /* Documented in superclass */ - @Override - public String toString() { - return msg; - } - - public String getDebugId() { - return null; - } - - public void setDebugId(String id) { - throw new UnsupportedOperationException( - "Setting testing id for this Paintable is not implemented"); + setMode(contentMode); + setErrorLevel(errorLevel); } }