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.Main; 009import org.openstreetmap.josm.data.Preferences.ColorKey; 010 011/** 012 * Conflict color constants. 013 * @since 4162 014 */ 015public enum ConflictColors implements ColorKey { 016 017 /** Conflict background: no conflict */ 018 BGCOLOR_NO_CONFLICT(marktr("Conflict background: no conflict"), new Color(234, 234, 234)), 019 /** Conflict background: decided */ 020 BGCOLOR_DECIDED(marktr("Conflict background: decided"), new Color(217, 255, 217)), 021 /** Conflict background: undecided */ 022 BGCOLOR_UNDECIDED(marktr("Conflict background: undecided"), new Color(255, 197, 197)), 023 /** Conflict background: drop */ 024 BGCOLOR_DROP(marktr("Conflict background: drop"), Color.white), 025 /** Conflict background: keep */ 026 BGCOLOR_KEEP(marktr("Conflict background: keep"), new Color(217, 255, 217)), 027 /** Conflict background: combined */ 028 BGCOLOR_COMBINED(marktr("Conflict background: combined"), new Color(217, 255, 217)), 029 /** Conflict background: selected */ 030 BGCOLOR_SELECTED(marktr("Conflict background: selected"), new Color(143, 170, 255)), 031 032 /** Conflict foreground: undecided */ 033 FGCOLOR_UNDECIDED(marktr("Conflict foreground: undecided"), Color.black), 034 /** Conflict foreground: drop */ 035 FGCOLOR_DROP(marktr("Conflict foreground: drop"), Color.lightGray), 036 /** Conflict foreground: keep */ 037 FGCOLOR_KEEP(marktr("Conflict foreground: keep"), Color.black), 038 039 /** Conflict background: empty row */ 040 BGCOLOR_EMPTY_ROW(marktr("Conflict background: empty row"), new Color(234, 234, 234)), 041 /** Conflict background: frozen */ 042 BGCOLOR_FROZEN(marktr("Conflict background: frozen"), new Color(234, 234, 234)), 043 /** Conflict background: in comparison */ 044 BGCOLOR_PARTICIPATING_IN_COMPARISON(marktr("Conflict background: in comparison"), Color.black), 045 /** Conflict foreground: in comparison */ 046 FGCOLOR_PARTICIPATING_IN_COMPARISON(marktr("Conflict foreground: in comparison"), Color.white), 047 /** Conflict background */ 048 BGCOLOR(marktr("Conflict background"), Color.white), 049 /** Conflict foreground */ 050 FGCOLOR(marktr("Conflict foreground"), Color.black), 051 052 /** Conflict background: not in opposite */ 053 BGCOLOR_NOT_IN_OPPOSITE(marktr("Conflict background: not in opposite"), new Color(255, 197, 197)), 054 /** Conflict background: in opposite */ 055 BGCOLOR_IN_OPPOSITE(marktr("Conflict background: in opposite"), new Color(255, 234, 213)), 056 /** Conflict background: same position in opposite */ 057 BGCOLOR_SAME_POSITION_IN_OPPOSITE(marktr("Conflict background: same position in opposite"), new Color(217, 255, 217)), 058 059 /** Conflict background: keep one tag */ 060 BGCOLOR_TAG_KEEP_ONE(marktr("Conflict background: keep one tag"), new Color(217, 255, 217)), 061 /** Conflict foreground: keep one tag */ 062 FGCOLOR_TAG_KEEP_ONE(marktr("Conflict foreground: keep one tag"), Color.black), 063 /** Conflict background: drop tag */ 064 BGCOLOR_TAG_KEEP_NONE(marktr("Conflict background: drop tag"), Color.lightGray), 065 /** Conflict foreground: drop tag */ 066 FGCOLOR_TAG_KEEP_NONE(marktr("Conflict foreground: drop tag"), Color.black), 067 /** Conflict background: keep all tags */ 068 BGCOLOR_TAG_KEEP_ALL(marktr("Conflict background: keep all tags"), new Color(255, 234, 213)), 069 /** Conflict foreground: keep all tags */ 070 FGCOLOR_TAG_KEEP_ALL(marktr("Conflict foreground: keep all tags"), Color.black), 071 /** Conflict background: sum all numeric tags */ 072 BGCOLOR_TAG_SUM_ALL_NUM(marktr("Conflict background: sum all numeric tags"), new Color(255, 234, 213)), 073 /** Conflict foreground: sum all numeric tags */ 074 FGCOLOR_TAG_SUM_ALL_NUM(marktr("Conflict foreground: sum all numeric tags"), Color.black), 075 076 /** Conflict background: keep member */ 077 BGCOLOR_MEMBER_KEEP(marktr("Conflict background: keep member"), new Color(217, 255, 217)), 078 /** Conflict foreground: keep member */ 079 FGCOLOR_MEMBER_KEEP(marktr("Conflict foreground: keep member"), Color.black), 080 /** Conflict background: remove member */ 081 BGCOLOR_MEMBER_REMOVE(marktr("Conflict background: remove member"), Color.lightGray), 082 /** Conflict foreground: remove member */ 083 FGCOLOR_MEMBER_REMOVE(marktr("Conflict foreground: remove member"), Color.black); 084 085 private final String name; 086 private final Color defaultColor; 087 088 ConflictColors(String name, Color defaultColor) { 089 this.name = name; 090 this.defaultColor = defaultColor; 091 } 092 093 @Override 094 public String getColorName() { 095 return name; 096 } 097 098 @Override 099 public Color getDefaultValue() { 100 return defaultColor; 101 } 102 103 @Override 104 public String getSpecialName() { 105 return null; 106 } 107 108 /** 109 * Returns the color. 110 * @return the color 111 */ 112 public Color get() { 113 return Main.pref.getColor(this); 114 } 115 116 /** 117 * Loads all colors from preferences. 118 */ 119 public static void getColors() { 120 for (ConflictColors c : values()) { 121 c.get(); 122 } 123 } 124}