diff options
author | Jens Jansson <peppe@vaadin.com> | 2011-12-01 15:08:55 +0200 |
---|---|---|
committer | Jens Jansson <peppe@vaadin.com> | 2011-12-01 15:08:55 +0200 |
commit | ff8a6a02c0c29e16dd8dcf6ffa4d86c928c32637 (patch) | |
tree | b93a790bdc6705d8a1ebdab1217a6630caf85906 /src/com/vaadin/terminal/CompositeErrorMessage.java | |
parent | 3e7d5dd41743bb643262b5c8a47f97731c984165 (diff) | |
download | vaadin-framework-ff8a6a02c0c29e16dd8dcf6ffa4d86c928c32637.tar.gz vaadin-framework-ff8a6a02c0c29e16dd8dcf6ffa4d86c928c32637.zip |
Modified ErrorMessage's error level from int's to an enum called ErrorLevel.
Diffstat (limited to 'src/com/vaadin/terminal/CompositeErrorMessage.java')
-rw-r--r-- | src/com/vaadin/terminal/CompositeErrorMessage.java | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/com/vaadin/terminal/CompositeErrorMessage.java b/src/com/vaadin/terminal/CompositeErrorMessage.java index bd70008523..ab7c017d0b 100644 --- a/src/com/vaadin/terminal/CompositeErrorMessage.java +++ b/src/com/vaadin/terminal/CompositeErrorMessage.java @@ -29,7 +29,7 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable { /** * Level of the error. */ - private int level; + private ErrorLevel level; /** * Constructor for CompositeErrorMessage. @@ -40,7 +40,7 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable { */ public CompositeErrorMessage(ErrorMessage[] errorMessages) { errors = new ArrayList<ErrorMessage>(errorMessages.length); - level = Integer.MIN_VALUE; + level = ErrorLevel.INFORMATION; for (int i = 0; i < errorMessages.length; i++) { addErrorMessage(errorMessages[i]); @@ -63,7 +63,7 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable { public CompositeErrorMessage( Collection<? extends ErrorMessage> errorMessages) { errors = new ArrayList<ErrorMessage>(errorMessages.size()); - level = Integer.MIN_VALUE; + level = ErrorLevel.INFORMATION; for (final Iterator<? extends ErrorMessage> i = errorMessages .iterator(); i.hasNext();) { @@ -81,7 +81,7 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable { * * @see com.vaadin.terminal.ErrorMessage#getErrorLevel() */ - public final int getErrorLevel() { + public final ErrorLevel getErrorLevel() { return level; } @@ -95,9 +95,8 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable { private void addErrorMessage(ErrorMessage error) { if (error != null && !errors.contains(error)) { errors.add(error); - final int l = error.getErrorLevel(); - if (l > level) { - level = l; + if (error.getErrorLevel().ordinal() > level.ordinal()) { + level = error.getErrorLevel(); } } } @@ -121,13 +120,13 @@ public class CompositeErrorMessage implements ErrorMessage, Serializable { } else { target.startTag("error"); - if (level > 0 && level <= ErrorMessage.INFORMATION) { + if (level == ErrorLevel.INFORMATION) { target.addAttribute("level", "info"); - } else if (level <= ErrorMessage.WARNING) { + } else if (level == ErrorLevel.WARNING) { target.addAttribute("level", "warning"); - } else if (level <= ErrorMessage.ERROR) { + } else if (level == ErrorLevel.ERROR) { target.addAttribute("level", "error"); - } else if (level <= ErrorMessage.CRITICAL) { + } else if (level == ErrorLevel.CRITICAL) { target.addAttribute("level", "critical"); } else { target.addAttribute("level", "system"); |