source: josm/trunk/src/org/openstreetmap/josm/data/validation/Severity.java@ 12841

Last change on this file since 12841 was 12667, checked in by Don-vip, 7 years ago

see #14704 - allow to export validator errors ("Save as" in validator layer contextual menu). Same format than Osmose

  • Property svn:eol-style set to native
File size: 2.4 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.validation;
3
4import static org.openstreetmap.josm.tools.I18n.marktr;
5import static org.openstreetmap.josm.tools.I18n.tr;
6
7import java.awt.Color;
8
9import org.openstreetmap.josm.data.preferences.ColorProperty;
10import org.openstreetmap.josm.tools.Logging;
11
12/** The error severity */
13public enum Severity {
14 // CHECKSTYLE.OFF: SingleSpaceSeparator
15 /** Error messages */
16 ERROR(1, tr("Errors"), /* ICON(data/) */"error", new ColorProperty(marktr("validation error"), Color.RED).get()),
17 /** Warning messages */
18 WARNING(2, tr("Warnings"), /* ICON(data/) */"warning", new ColorProperty(marktr("validation warning"), Color.YELLOW).get()),
19 /** Other messages */
20 OTHER(3, tr("Other"), /* ICON(data/) */"other", new ColorProperty(marktr("validation other"), Color.CYAN).get());
21 // CHECKSTYLE.ON: SingleSpaceSeparator
22
23 /** Numeric ordering of the severities, 1 being major, 3 being minor */
24 private final int level;
25
26 /** Description of the severity code */
27 private final String message;
28
29 /** Associated icon */
30 private final String icon;
31
32 /** Associated color */
33 private final Color color;
34
35 /**
36 * Constructor
37 *
38 * @param level Numeric ordering, 1 being major, 3 being minor
39 * @param message Description
40 * @param icon Associated icon
41 * @param color The color of this severity
42 */
43 Severity(int level, String message, String icon, Color color) {
44 this.level = level;
45 this.message = message;
46 this.icon = icon;
47 this.color = color;
48 }
49
50 /**
51 * Retrieves all colors once from the preferences to register them
52 */
53 public static void getColors() {
54 for (Severity c : values()) {
55 Logging.debug("{0}", c);
56 }
57 }
58
59 @Override
60 public String toString() {
61 return message;
62 }
63
64 /**
65 * Gets the associated icon
66 * @return the associated icon
67 */
68 public String getIcon() {
69 return icon;
70 }
71
72 /**
73 * Gets the associated color
74 * @return The associated color
75 */
76 public Color getColor() {
77 return color;
78 }
79
80 /**
81 * Gets the severity level, 1 being major, 3 being minor
82 * @return The severity level
83 * @since 12667
84 */
85 public int getLevel() {
86 return level;
87 }
88}
Note: See TracBrowser for help on using the repository browser.