1 | // License: GPL. See LICENSE file for details.
|
---|
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 |
|
---|
11 | /** The error severity */
|
---|
12 | public enum Severity {
|
---|
13 | /** Error messages */
|
---|
14 | ERROR(tr("Errors"), /* ICON(data/) */"error", Main.pref.getColor(marktr("validation error"), Color.RED)),
|
---|
15 | /** Warning messages */
|
---|
16 | WARNING(tr("Warnings"), /* ICON(data/) */"warning", Main.pref.getColor(marktr("validation warning"), Color.YELLOW)),
|
---|
17 | /** Other messages */
|
---|
18 | OTHER(tr("Other"), /* ICON(data/) */"other", Main.pref.getColor(marktr("validation other"), Color.CYAN));
|
---|
19 |
|
---|
20 | /** Description of the severity code */
|
---|
21 | private final String message;
|
---|
22 |
|
---|
23 | /** Associated icon */
|
---|
24 | private final String icon;
|
---|
25 |
|
---|
26 | /** Associated color */
|
---|
27 | private final Color color;
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * Constructor
|
---|
31 | *
|
---|
32 | * @param message Description
|
---|
33 | * @param icon Associated icon
|
---|
34 | * @param color The color of this severity
|
---|
35 | */
|
---|
36 | Severity(String message, String icon, Color color) {
|
---|
37 | this.message = message;
|
---|
38 | this.icon = icon;
|
---|
39 | this.color = color;
|
---|
40 | }
|
---|
41 |
|
---|
42 | public static void getColors() {
|
---|
43 | for (Severity c:values()) {
|
---|
44 | c.getColor();
|
---|
45 | }
|
---|
46 | }
|
---|
47 |
|
---|
48 | @Override
|
---|
49 | public String toString() {
|
---|
50 | return message;
|
---|
51 | }
|
---|
52 |
|
---|
53 | /**
|
---|
54 | * Gets the associated icon
|
---|
55 | * @return the associated icon
|
---|
56 | */
|
---|
57 | public String getIcon() {
|
---|
58 | return icon;
|
---|
59 | }
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * Gets the associated color
|
---|
63 | * @return The associated color
|
---|
64 | */
|
---|
65 | public Color getColor() {
|
---|
66 | return color;
|
---|
67 | }
|
---|
68 |
|
---|
69 |
|
---|
70 | }
|
---|