1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.validation;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.marktr;
|
---|
5 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
6 |
|
---|
7 | import java.awt.Color;
|
---|
8 |
|
---|
9 | import org.openstreetmap.josm.Main;
|
---|
10 | import org.openstreetmap.josm.data.preferences.ColorProperty;
|
---|
11 |
|
---|
12 | /** The error severity */
|
---|
13 | public enum Severity {
|
---|
14 | // CHECKSTYLE.OFF: SingleSpaceSeparator
|
---|
15 | /** Error messages */
|
---|
16 | ERROR(tr("Errors"), /* ICON(data/) */"error", new ColorProperty(marktr("validation error"), Color.RED).get()),
|
---|
17 | /** Warning messages */
|
---|
18 | WARNING(tr("Warnings"), /* ICON(data/) */"warning", new ColorProperty(marktr("validation warning"), Color.YELLOW).get()),
|
---|
19 | /** Other messages */
|
---|
20 | OTHER(tr("Other"), /* ICON(data/) */"other", new ColorProperty(marktr("validation other"), Color.CYAN).get());
|
---|
21 | // CHECKSTYLE.ON: SingleSpaceSeparator
|
---|
22 |
|
---|
23 | /** Description of the severity code */
|
---|
24 | private final String message;
|
---|
25 |
|
---|
26 | /** Associated icon */
|
---|
27 | private final String icon;
|
---|
28 |
|
---|
29 | /** Associated color */
|
---|
30 | private final Color color;
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * Constructor
|
---|
34 | *
|
---|
35 | * @param message Description
|
---|
36 | * @param icon Associated icon
|
---|
37 | * @param color The color of this severity
|
---|
38 | */
|
---|
39 | Severity(String message, String icon, Color color) {
|
---|
40 | this.message = message;
|
---|
41 | this.icon = icon;
|
---|
42 | this.color = color;
|
---|
43 | }
|
---|
44 |
|
---|
45 | public static void getColors() {
|
---|
46 | for (Severity c : values()) {
|
---|
47 | if (Main.isDebugEnabled()) {
|
---|
48 | Main.debug(c.toString());
|
---|
49 | }
|
---|
50 | }
|
---|
51 | }
|
---|
52 |
|
---|
53 | @Override
|
---|
54 | public String toString() {
|
---|
55 | return message;
|
---|
56 | }
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * Gets the associated icon
|
---|
60 | * @return the associated icon
|
---|
61 | */
|
---|
62 | public String getIcon() {
|
---|
63 | return icon;
|
---|
64 | }
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * Gets the associated color
|
---|
68 | * @return The associated color
|
---|
69 | */
|
---|
70 | public Color getColor() {
|
---|
71 | return color;
|
---|
72 | }
|
---|
73 | }
|
---|