001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.gui.conflict;
003
004import static org.openstreetmap.josm.tools.I18n.marktr;
005
006import java.awt.Color;
007
008import org.openstreetmap.josm.data.preferences.NamedColorProperty;
009
010/**
011 * Conflict color constants.
012 * @since 4162
013 */
014public enum ConflictColors {
015
016    /** Conflict background: no conflict */
017    BGCOLOR_NO_CONFLICT(marktr("Conflict background: no conflict"), new Color(234, 234, 234)),
018    /** Conflict background: decided */
019    BGCOLOR_DECIDED(marktr("Conflict background: decided"), new Color(217, 255, 217)),
020    /** Conflict background: undecided */
021    BGCOLOR_UNDECIDED(marktr("Conflict background: undecided"), new Color(255, 197, 197)),
022    /** Conflict background: drop */
023    BGCOLOR_DROP(marktr("Conflict background: drop"), Color.white),
024    /** Conflict background: keep */
025    BGCOLOR_KEEP(marktr("Conflict background: keep"), new Color(217, 255, 217)),
026    /** Conflict background: combined */
027    BGCOLOR_COMBINED(marktr("Conflict background: combined"), new Color(217, 255, 217)),
028    /** Conflict background: selected */
029    BGCOLOR_SELECTED(marktr("Conflict background: selected"), new Color(143, 170, 255)),
030
031    /** Conflict foreground: undecided */
032    FGCOLOR_UNDECIDED(marktr("Conflict foreground: undecided"), Color.black),
033    /** Conflict foreground: drop */
034    FGCOLOR_DROP(marktr("Conflict foreground: drop"), Color.lightGray),
035    /** Conflict foreground: keep */
036    FGCOLOR_KEEP(marktr("Conflict foreground: keep"), Color.black),
037
038    /** Conflict background: empty row */
039    BGCOLOR_EMPTY_ROW(marktr("Conflict background: empty row"), new Color(234, 234, 234)),
040    /** Conflict background: frozen */
041    BGCOLOR_FROZEN(marktr("Conflict background: frozen"), new Color(234, 234, 234)),
042    /** Conflict background: in comparison */
043    BGCOLOR_PARTICIPATING_IN_COMPARISON(marktr("Conflict background: in comparison"), Color.black),
044    /** Conflict foreground: in comparison */
045    FGCOLOR_PARTICIPATING_IN_COMPARISON(marktr("Conflict foreground: in comparison"), Color.white),
046    /** Conflict background */
047    BGCOLOR(marktr("Conflict background"), Color.white),
048    /** Conflict foreground */
049    FGCOLOR(marktr("Conflict foreground"), Color.black),
050
051    /** Conflict background: not in opposite */
052    BGCOLOR_NOT_IN_OPPOSITE(marktr("Conflict background: not in opposite"), new Color(255, 197, 197)),
053    /** Conflict background: in opposite */
054    BGCOLOR_IN_OPPOSITE(marktr("Conflict background: in opposite"), new Color(255, 234, 213)),
055    /** Conflict background: same position in opposite */
056    BGCOLOR_SAME_POSITION_IN_OPPOSITE(marktr("Conflict background: same position in opposite"), new Color(217, 255, 217)),
057
058    /** Conflict background: keep one tag */
059    BGCOLOR_TAG_KEEP_ONE(marktr("Conflict background: keep one tag"), new Color(217, 255, 217)),
060    /** Conflict foreground: keep one tag */
061    FGCOLOR_TAG_KEEP_ONE(marktr("Conflict foreground: keep one tag"), Color.black),
062    /** Conflict background: drop tag */
063    BGCOLOR_TAG_KEEP_NONE(marktr("Conflict background: drop tag"), Color.lightGray),
064    /** Conflict foreground: drop tag */
065    FGCOLOR_TAG_KEEP_NONE(marktr("Conflict foreground: drop tag"), Color.black),
066    /** Conflict background: keep all tags */
067    BGCOLOR_TAG_KEEP_ALL(marktr("Conflict background: keep all tags"), new Color(255, 234, 213)),
068    /** Conflict foreground: keep all tags */
069    FGCOLOR_TAG_KEEP_ALL(marktr("Conflict foreground: keep all tags"), Color.black),
070    /** Conflict background: sum all numeric tags */
071    BGCOLOR_TAG_SUM_ALL_NUM(marktr("Conflict background: sum all numeric tags"), new Color(255, 234, 213)),
072    /** Conflict foreground: sum all numeric tags */
073    FGCOLOR_TAG_SUM_ALL_NUM(marktr("Conflict foreground: sum all numeric tags"), Color.black),
074
075    /** Conflict background: keep member */
076    BGCOLOR_MEMBER_KEEP(marktr("Conflict background: keep member"), new Color(217, 255, 217)),
077    /** Conflict foreground: keep member */
078    FGCOLOR_MEMBER_KEEP(marktr("Conflict foreground: keep member"), Color.black),
079    /** Conflict background: remove member */
080    BGCOLOR_MEMBER_REMOVE(marktr("Conflict background: remove member"), Color.lightGray),
081    /** Conflict foreground: remove member */
082    FGCOLOR_MEMBER_REMOVE(marktr("Conflict foreground: remove member"), Color.black);
083
084    private final NamedColorProperty property;
085
086    ConflictColors(String name, Color defaultColor) {
087        property = new NamedColorProperty(name, defaultColor);
088    }
089
090    /**
091     * Returns the color.
092     * @return the color
093     */
094    public Color get() {
095        return property.get();
096    }
097
098    /**
099     * Loads all colors from preferences.
100     */
101    public static void getColors() {
102        for (ConflictColors c : values()) {
103            c.get();
104        }
105    }
106}