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

Last change on this file since 12410 was 12390, checked in by michael2402, 7 years ago

See #14794: Document data.validation package and subpackages.

  • Property svn:eol-style set to native
File size: 2.0 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.Main;
10import org.openstreetmap.josm.data.preferences.ColorProperty;
11
12/** The error severity */
13public 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 /**
46 * Retrieves all colors once from the preferences to register them
47 */
48 public static void getColors() {
49 for (Severity c : values()) {
50 if (Main.isDebugEnabled()) {
51 Main.debug(c.toString());
52 }
53 }
54 }
55
56 @Override
57 public String toString() {
58 return message;
59 }
60
61 /**
62 * Gets the associated icon
63 * @return the associated icon
64 */
65 public String getIcon() {
66 return icon;
67 }
68
69 /**
70 * Gets the associated color
71 * @return The associated color
72 */
73 public Color getColor() {
74 return color;
75 }
76}
Note: See TracBrowser for help on using the repository browser.