001// License: GPL. See LICENSE file for details.
002package org.openstreetmap.josm.data.validation;
003
004import static org.openstreetmap.josm.tools.I18n.marktr;
005import static org.openstreetmap.josm.tools.I18n.tr;
006
007import java.awt.Color;
008
009import org.openstreetmap.josm.Main;
010
011/** The error severity */
012public enum Severity {
013    /** Error messages */
014    ERROR(tr("Errors"), /* ICON(data/) */"error",       Main.pref.getColor(marktr("validation error"), Color.RED)),
015    /** Warning messages */
016    WARNING(tr("Warnings"), /* ICON(data/) */"warning", Main.pref.getColor(marktr("validation warning"), Color.YELLOW)),
017    /** Other messages */
018    OTHER(tr("Other"), /* ICON(data/) */"other",        Main.pref.getColor(marktr("validation other"), Color.CYAN));
019
020    /** Description of the severity code */
021    private final String message;
022
023    /** Associated icon */
024    private final String icon;
025
026    /** Associated color */
027    private final Color color;
028
029    /**
030     * Constructor
031     *
032     * @param message Description
033     * @param icon Associated icon
034     * @param color The color of this severity
035     */
036    Severity(String message, String icon, Color color) {
037        this.message = message;
038        this.icon = icon;
039        this.color = color;
040    }
041
042    public static void getColors() {
043        for (Severity c:values()) {
044            c.getColor();
045        }
046    }
047
048    @Override
049    public String toString() {
050        return message;
051    }
052
053    /**
054     * Gets the associated icon
055     * @return the associated icon
056     */
057    public String getIcon() {
058        return icon;
059    }
060
061    /**
062     * Gets the associated color
063     * @return The associated color
064     */
065    public Color getColor() {
066        return color;
067    }
068
069
070}