Changeset 4162 in josm
- Timestamp:
- 2011-06-24T23:13:02+02:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Preferences.java
r3938 r4162 30 30 import java.util.Map.Entry; 31 31 import java.util.concurrent.CopyOnWriteArrayList; 32 import java.util.regex.Matcher; 33 import java.util.regex.Pattern; 32 34 33 35 import javax.swing.JOptionPane; … … 72 74 protected final SortedMap<String, String> properties = new TreeMap<String, String>(); 73 75 protected final SortedMap<String, String> defaults = new TreeMap<String, String>(); 76 protected final SortedMap<String, String> colornames = new TreeMap<String, String>(); 74 77 75 78 public interface PreferenceChangeEvent{ … … 526 529 } 527 530 531 /* only for preferences */ 532 synchronized public String getColorName(String o) { 533 try 534 { 535 Matcher m = Pattern.compile("mappaint\\.(.+?)\\.(.+)").matcher(o); 536 m.matches(); 537 return tr("Paint style {0}: {1}", tr(m.group(1)), tr(m.group(2))); 538 } 539 catch (Exception e) {} 540 try 541 { 542 Matcher m = Pattern.compile("layer (.+)").matcher(o); 543 m.matches(); 544 return tr("Layer: {0}", tr(m.group(1))); 545 } 546 catch (Exception e) {} 547 return tr(colornames.containsKey(o) ? colornames.get(o) : o); 548 } 549 528 550 public Color getColor(ColorKey key) { 529 551 return getColor(key.getColorName(), key.getSpecialName(), key.getDefault()); … … 539 561 */ 540 562 synchronized public Color getColor(String colName, String specName, Color def) { 541 putDefault("color."+colName, ColorHelper.color2html(def)); 563 String colKey = colName.toLowerCase().replaceAll("[^a-z0-9]+","."); 564 if(!colKey.equals(colName)) 565 colornames.put(colKey, colName); 566 putDefault("color."+colKey, ColorHelper.color2html(def)); 542 567 String colStr = specName != null ? get("color."+specName) : ""; 543 568 if(colStr.equals("")) { 544 colStr = get("color."+col Name);569 colStr = get("color."+colKey); 545 570 } 546 571 return colStr.equals("") ? def : ColorHelper.html2color(colStr); -
trunk/src/org/openstreetmap/josm/data/validation/Severity.java
r3807 r4162 40 40 } 41 41 42 public static void getColors() { 43 for (Severity c:values()) { 44 c.getColor(); 45 } 46 } 47 42 48 @Override 43 49 public String toString() { -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ComparePairListCellRenderer.java
r3083 r4162 2 2 package org.openstreetmap.josm.gui.conflict.pair; 3 3 4 import java.awt.Color;5 4 import java.awt.Component; 6 5 … … 9 8 import javax.swing.ListCellRenderer; 10 9 10 import org.openstreetmap.josm.gui.conflict.ConflictColors; 11 11 12 public class ComparePairListCellRenderer extends JLabel implements ListCellRenderer { 12 public final static Color BGCOLOR_SELECTED = new Color(143,170,255);13 14 13 public ComparePairListCellRenderer() { 15 14 setOpaque(true); … … 24 23 ComparePairType type = (ComparePairType)value; 25 24 setText(type.getDisplayName()); 26 setBackground(isSelected ? BGCOLOR_SELECTED : Color.WHITE);27 setForeground(Co lor.BLACK);25 setBackground(isSelected ? ConflictColors.BGCOLOR_SELECTED.get() : ConflictColors.BGCOLOR.get()); 26 setForeground(ConflictColors.FGCOLOR.get()); 28 27 return this; 29 28 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListTableCellRenderer.java
r4072 r4162 2 2 package org.openstreetmap.josm.gui.conflict.pair.nodes; 3 3 4 import java.awt.Color;5 4 import java.awt.Component; 6 5 import java.text.MessageFormat; … … 18 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 18 import org.openstreetmap.josm.gui.DefaultNameFormatter; 19 import org.openstreetmap.josm.gui.conflict.ConflictColors; 20 20 import org.openstreetmap.josm.gui.conflict.pair.ListMergeModel; 21 21 import org.openstreetmap.josm.tools.ImageProvider; … … 26 26 */ 27 27 public class NodeListTableCellRenderer extends JLabel implements TableCellRenderer { 28 //static private final Logger logger = Logger.getLogger(NodeListTableCellRenderer.class.getName());29 //private static DecimalFormat COORD_FORMATTER = new DecimalFormat("###0.0000");30 public final static Color BGCOLOR_SELECTED = new Color(143,170,255);31 public final static Color BGCOLOR_EMPTY_ROW = new Color(234,234,234);32 public final static Color BGCOLOR_FROZEN = new Color(234,234,234);33 public final static Color BGCOLOR_PARTICIPAING_IN_COMPARISON = Color.BLACK;34 public final static Color FGCOLOR_PARTICIPAING_IN_COMPARISON = Color.WHITE;35 36 public final static Color BGCOLOR_NOT_IN_OPPOSITE = new Color(255,197,197);37 public final static Color BGCOLOR_IN_OPPOSITE = new Color(255,234,213);38 public final static Color BGCOLOR_SAME_POSITION_IN_OPPOSITE = new Color(217,255,217);39 28 40 29 private final ImageIcon icon; … … 102 91 */ 103 92 protected void reset() { 104 setBackground(Co lor.WHITE);105 setForeground(Co lor.BLACK);93 setBackground(ConflictColors.BGCOLOR.get()); 94 setForeground(ConflictColors.FGCOLOR.get()); 106 95 } 107 96 … … 116 105 setBorder(null); 117 106 if (model.getListMergeModel().isFrozen()) { 118 setBackground(BGCOLOR_FROZEN); 107 setBackground(ConflictColors.BGCOLOR_FROZEN.get()); 119 108 } else if (isSelected) { 120 setBackground(BGCOLOR_SELECTED); 109 setBackground(ConflictColors.BGCOLOR_SELECTED.get()); 121 110 } else if (model.isParticipatingInCurrentComparePair()) { 122 111 if (model.isSamePositionInOppositeList(row)) { 123 setBackground(BGCOLOR_SAME_POSITION_IN_OPPOSITE); 112 setBackground(ConflictColors.BGCOLOR_SAME_POSITION_IN_OPPOSITE.get()); 124 113 } else if (model.isIncludedInOppositeList(row)) { 125 setBackground(BGCOLOR_IN_OPPOSITE); 114 setBackground(ConflictColors.BGCOLOR_IN_OPPOSITE.get()); 126 115 } else { 127 setBackground(BGCOLOR_NOT_IN_OPPOSITE); 116 setBackground(ConflictColors.BGCOLOR_NOT_IN_OPPOSITE.get()); 128 117 } 129 118 } … … 137 126 protected void renderEmptyRow() { 138 127 setIcon(null); 139 setBackground(BGCOLOR_EMPTY_ROW); 128 setBackground(ConflictColors.BGCOLOR_EMPTY_ROW.get()); 140 129 setText(""); 141 130 } … … 151 140 setBorder(rowNumberBorder); 152 141 if (model.getListMergeModel().isFrozen()) { 153 setBackground(BGCOLOR_FROZEN); 142 setBackground(ConflictColors.BGCOLOR_FROZEN.get()); 154 143 } else if (model.isParticipatingInCurrentComparePair()) { 155 setBackground(BGCOLOR_PARTICIPAING_IN_COMPARISON); 156 setForeground(FGCOLOR_PARTICIPAING_IN_COMPARISON); 144 setBackground(ConflictColors.BGCOLOR_PARTICIPAING_IN_COMPARISON.get()); 145 setForeground(ConflictColors.FGCOLOR_PARTICIPAING_IN_COMPARISON.get()); 157 146 } 158 147 setText(Integer.toString(row+1)); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMerger.java
r3362 r4162 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.Color;7 6 import java.awt.GridBagConstraints; 8 7 import java.awt.GridBagLayout; … … 25 24 import org.openstreetmap.josm.data.osm.OsmPrimitive; 26 25 import org.openstreetmap.josm.gui.DefaultNameFormatter; 26 import org.openstreetmap.josm.gui.conflict.ConflictColors; 27 27 import org.openstreetmap.josm.gui.conflict.pair.IConflictResolver; 28 28 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; … … 36 36 public class PropertiesMerger extends JPanel implements Observer, IConflictResolver { 37 37 private static DecimalFormat COORD_FORMATTER = new DecimalFormat("###0.0000000"); 38 39 public final static Color BGCOLOR_NO_CONFLICT = new Color(234,234,234);40 public final static Color BGCOLOR_UNDECIDED = new Color(255,197,197);41 public final static Color BGCOLOR_DECIDED = new Color(217,255,217);42 38 43 39 private JLabel lblMyVersion; … … 328 324 lblTheirCoordinates.setText(coordToString(model.getTheirCoords())); 329 325 if (! model.hasCoordConflict()) { 330 lblMyCoordinates.setBackground(BGCOLOR_NO_CONFLICT); 331 lblMergedCoordinates.setBackground(BGCOLOR_NO_CONFLICT); 332 lblTheirCoordinates.setBackground(BGCOLOR_NO_CONFLICT); 326 lblMyCoordinates.setBackground(ConflictColors.BGCOLOR_NO_CONFLICT.get()); 327 lblMergedCoordinates.setBackground(ConflictColors.BGCOLOR_NO_CONFLICT.get()); 328 lblTheirCoordinates.setBackground(ConflictColors.BGCOLOR_NO_CONFLICT.get()); 333 329 } else { 334 330 if (!model.isDecidedCoord()) { 335 lblMyCoordinates.setBackground(BGCOLOR_UNDECIDED); 336 lblMergedCoordinates.setBackground(BGCOLOR_NO_CONFLICT); 337 lblTheirCoordinates.setBackground(BGCOLOR_UNDECIDED); 331 lblMyCoordinates.setBackground(ConflictColors.BGCOLOR_UNDECIDED.get()); 332 lblMergedCoordinates.setBackground(ConflictColors.BGCOLOR_NO_CONFLICT.get()); 333 lblTheirCoordinates.setBackground(ConflictColors.BGCOLOR_UNDECIDED.get()); 338 334 } else { 339 335 lblMyCoordinates.setBackground( 340 336 model.isCoordMergeDecision(MergeDecisionType.KEEP_MINE) 341 ? BGCOLOR_DECIDED :BGCOLOR_NO_CONFLICT337 ? ConflictColors.BGCOLOR_DECIDED.get() : ConflictColors.BGCOLOR_NO_CONFLICT.get() 342 338 ); 343 lblMergedCoordinates.setBackground(BGCOLOR_DECIDED); 339 lblMergedCoordinates.setBackground(ConflictColors.BGCOLOR_DECIDED.get()); 344 340 lblTheirCoordinates.setBackground( 345 341 model.isCoordMergeDecision(MergeDecisionType.KEEP_THEIR) 346 ? BGCOLOR_DECIDED :BGCOLOR_NO_CONFLICT342 ? ConflictColors.BGCOLOR_DECIDED.get() : ConflictColors.BGCOLOR_NO_CONFLICT.get() 347 343 ); 348 344 } … … 356 352 357 353 if (! model.hasDeletedStateConflict()) { 358 lblMyDeletedState.setBackground(BGCOLOR_NO_CONFLICT); 359 lblMergedDeletedState.setBackground(BGCOLOR_NO_CONFLICT); 360 lblTheirDeletedState.setBackground(BGCOLOR_NO_CONFLICT); 354 lblMyDeletedState.setBackground(ConflictColors.BGCOLOR_NO_CONFLICT.get()); 355 lblMergedDeletedState.setBackground(ConflictColors.BGCOLOR_NO_CONFLICT.get()); 356 lblTheirDeletedState.setBackground(ConflictColors.BGCOLOR_NO_CONFLICT.get()); 361 357 } else { 362 358 if (!model.isDecidedDeletedState()) { 363 lblMyDeletedState.setBackground(BGCOLOR_UNDECIDED); 364 lblMergedDeletedState.setBackground(BGCOLOR_NO_CONFLICT); 365 lblTheirDeletedState.setBackground(BGCOLOR_UNDECIDED); 359 lblMyDeletedState.setBackground(ConflictColors.BGCOLOR_UNDECIDED.get()); 360 lblMergedDeletedState.setBackground(ConflictColors.BGCOLOR_NO_CONFLICT.get()); 361 lblTheirDeletedState.setBackground(ConflictColors.BGCOLOR_UNDECIDED.get()); 366 362 } else { 367 363 lblMyDeletedState.setBackground( 368 364 model.isDeletedStateDecision(MergeDecisionType.KEEP_MINE) 369 ? BGCOLOR_DECIDED :BGCOLOR_NO_CONFLICT365 ? ConflictColors.BGCOLOR_DECIDED.get() : ConflictColors.BGCOLOR_NO_CONFLICT.get() 370 366 ); 371 lblMergedDeletedState.setBackground(BGCOLOR_DECIDED); 367 lblMergedDeletedState.setBackground(ConflictColors.BGCOLOR_DECIDED.get()); 372 368 lblTheirDeletedState.setBackground( 373 369 model.isDeletedStateDecision(MergeDecisionType.KEEP_THEIR) 374 ? BGCOLOR_DECIDED :BGCOLOR_NO_CONFLICT370 ? ConflictColors.BGCOLOR_DECIDED.get() : ConflictColors.BGCOLOR_NO_CONFLICT.get() 375 371 ); 376 372 } … … 380 376 protected void updateReferrers() { 381 377 lblMyReferrers.setText(referrersToString(model.getMyReferrers())); 382 lblMyReferrers.setBackground(BGCOLOR_NO_CONFLICT); 378 lblMyReferrers.setBackground(ConflictColors.BGCOLOR_NO_CONFLICT.get()); 383 379 lblTheirReferrers.setText(referrersToString(model.getTheirReferrers())); 384 lblTheirReferrers.setBackground(BGCOLOR_NO_CONFLICT); 380 lblTheirReferrers.setBackground(ConflictColors.BGCOLOR_NO_CONFLICT.get()); 385 381 } 386 382 -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberTableCellRenderer.java
r4072 r4162 17 17 import org.openstreetmap.josm.data.osm.RelationMember; 18 18 import org.openstreetmap.josm.gui.DefaultNameFormatter; 19 import org.openstreetmap.josm.gui.conflict.ConflictColors; 19 20 import org.openstreetmap.josm.gui.conflict.pair.ListMergeModel; 20 21 import org.openstreetmap.josm.tools.ImageProvider; … … 25 26 */ 26 27 public class RelationMemberTableCellRenderer extends JLabel implements TableCellRenderer { 27 public final static Color BGCOLOR_SELECTED = new Color(143,170,255);28 public final static Color BGCOLOR_EMPTY_ROW = new Color(234,234,234);29 30 public final static Color BGCOLOR_NOT_IN_OPPOSITE = new Color(255,197,197);31 public final static Color BGCOLOR_IN_OPPOSITE = new Color(255,234,213);32 public final static Color BGCOLOR_SAME_POSITION_IN_OPPOSITE = new Color(217,255,217);33 34 public final static Color BGCOLOR_PARTICIPAING_IN_COMPARISON = Color.BLACK;35 public final static Color FGCOLOR_PARTICIPAING_IN_COMPARISON = Color.WHITE;36 37 public final static Color BGCOLOR_FROZEN = new Color(234,234,234);38 39 28 private Border rowNumberBorder = null; 40 29 … … 84 73 */ 85 74 protected void reset() { 86 setBackground(Co lor.WHITE);87 setForeground(Co lor.BLACK);75 setBackground(ConflictColors.BGCOLOR.get()); 76 setForeground(ConflictColors.FGCOLOR.get()); 88 77 setBorder(null); 89 78 setIcon(null); … … 92 81 93 82 protected void renderBackground(ListMergeModel<Node>.EntriesTableModel model, RelationMember member, int row, int col, boolean isSelected) { 94 Color bgc = Co lor.WHITE;83 Color bgc = ConflictColors.BGCOLOR.get(); 95 84 if (col == 0) { 96 85 if (model.getListMergeModel().isFrozen()) { 97 bgc = BGCOLOR_FROZEN; 86 bgc = ConflictColors.BGCOLOR_FROZEN.get(); 98 87 } else if (model.isParticipatingInCurrentComparePair()) { 99 bgc = BGCOLOR_PARTICIPAING_IN_COMPARISON; 88 bgc = ConflictColors.BGCOLOR_PARTICIPAING_IN_COMPARISON.get(); 100 89 } else if (isSelected) { 101 bgc = BGCOLOR_SELECTED; 90 bgc = ConflictColors.BGCOLOR_SELECTED.get(); 102 91 } 103 92 } else { 104 93 if (model.getListMergeModel().isFrozen()) { 105 bgc = BGCOLOR_FROZEN; 94 bgc = ConflictColors.BGCOLOR_FROZEN.get(); 106 95 } else if (member == null) { 107 bgc = BGCOLOR_EMPTY_ROW; 96 bgc = ConflictColors.BGCOLOR_EMPTY_ROW.get(); 108 97 } else if (isSelected) { 109 bgc = BGCOLOR_SELECTED; 98 bgc = ConflictColors.BGCOLOR_SELECTED.get(); 110 99 } else { 111 100 if (model.isParticipatingInCurrentComparePair()) { 112 101 if (model.isSamePositionInOppositeList(row)) { 113 bgc = BGCOLOR_SAME_POSITION_IN_OPPOSITE; 102 bgc = ConflictColors.BGCOLOR_SAME_POSITION_IN_OPPOSITE.get(); 114 103 } else if (model.isIncludedInOppositeList(row)) { 115 bgc = BGCOLOR_IN_OPPOSITE; 104 bgc = ConflictColors.BGCOLOR_IN_OPPOSITE.get(); 116 105 } else { 117 bgc = BGCOLOR_NOT_IN_OPPOSITE; 106 bgc = ConflictColors.BGCOLOR_NOT_IN_OPPOSITE.get(); 118 107 } 119 108 } … … 124 113 125 114 protected void renderForeground(ListMergeModel<Node>.EntriesTableModel model, RelationMember member, int row, int col, boolean isSelected) { 126 Color fgc = Co lor.BLACK;115 Color fgc = ConflictColors.FGCOLOR.get(); 127 116 if (col == 0 && model.isParticipatingInCurrentComparePair() && ! model.getListMergeModel().isFrozen()) { 128 fgc = Co lor.WHITE;117 fgc = ConflictColors.FGCOLOR_PARTICIPAING_IN_COMPARISON.get(); 129 118 } 130 119 setForeground(fgc); … … 155 144 protected void renderEmptyRow() { 156 145 setIcon(null); 157 setBackground(BGCOLOR_EMPTY_ROW); 146 setBackground(ConflictColors.BGCOLOR_EMPTY_ROW.get()); 158 147 setText(""); 159 148 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/MergedTableCellRenderer.java
r3083 r4162 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.Color; 7 6 import org.openstreetmap.josm.gui.conflict.ConflictColors; 8 7 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; 9 8 10 9 public class MergedTableCellRenderer extends TagMergeTableCellRenderer { 11 12 public final static Color BGCOLOR_UNDECIDED = new Color(255,197,197);13 public final static Color BGCOLOR_MINE = new Color(217,255,217);14 public final static Color BGCOLOR_THEIR = new Color(217,255,217);15 public final static Color BGCOLOR_SELECTED = new Color(143,170,255);16 17 10 protected void setBackgroundColor(TagMergeItem item, boolean isSelected) { 18 11 if (isSelected) { 19 setBackground(BGCOLOR_SELECTED); 12 setBackground(ConflictColors.BGCOLOR_SELECTED.get()); 20 13 return; 21 14 } 22 15 if (MergeDecisionType.KEEP_MINE.equals(item.getMergeDecision())) { 23 setBackground(BGCOLOR_ MINE);16 setBackground(ConflictColors.BGCOLOR_COMBINED.get()); 24 17 } else if (MergeDecisionType.KEEP_THEIR.equals(item.getMergeDecision())) { 25 setBackground(BGCOLOR_ THEIR);18 setBackground(ConflictColors.BGCOLOR_COMBINED.get()); 26 19 } else if (MergeDecisionType.UNDECIDED.equals(item.getMergeDecision())) { 27 setBackground(BGCOLOR_UNDECIDED); 20 setBackground(ConflictColors.BGCOLOR_UNDECIDED.get()); 28 21 } 29 22 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/MineTableCellRenderer.java
r3083 r4162 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.Color; 7 6 import org.openstreetmap.josm.gui.conflict.ConflictColors; 8 7 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; 9 8 10 9 public class MineTableCellRenderer extends TagMergeTableCellRenderer { 11 12 public final static Color BGCOLOR_UNDECIDED = new Color(255,197,197); 13 public final static Color BGCOLOR_MINE = new Color(217,255,217); 14 public final static Color BGCOLOR_THEIR = Color.white; 15 public final static Color BGCOLOR_SELECTED = new Color(143,170,255); 10 /* NOTE: mine and their colors are reversed for this renderer */ 16 11 17 12 protected void setBackgroundColor(TagMergeItem item, boolean isSelected) { 18 13 if (isSelected) { 19 setBackground(BGCOLOR_SELECTED); 14 setBackground(ConflictColors.BGCOLOR_SELECTED.get()); 20 15 return; 21 16 } 22 17 23 18 if (MergeDecisionType.KEEP_MINE.equals(item.getMergeDecision())) { 24 setBackground(BGCOLOR_ MINE);19 setBackground(ConflictColors.BGCOLOR_THEIR.get()); 25 20 } else if (MergeDecisionType.KEEP_THEIR.equals(item.getMergeDecision())) { 26 setBackground(BGCOLOR_ THEIR);21 setBackground(ConflictColors.BGCOLOR_MINE.get()); 27 22 } else if (MergeDecisionType.UNDECIDED.equals(item.getMergeDecision())) { 28 setBackground(BGCOLOR_UNDECIDED); 23 setBackground(ConflictColors.BGCOLOR_UNDECIDED.get()); 29 24 } 30 25 } … … 32 27 protected void setTextColor(TagMergeItem item) { 33 28 if (MergeDecisionType.KEEP_MINE.equals(item.getMergeDecision())) { 34 setForeground(Co lor.black);29 setForeground(ConflictColors.FGCOLOR_THEIR.get()); 35 30 } else if (MergeDecisionType.KEEP_THEIR.equals(item.getMergeDecision())) { 36 setForeground(Co lor.LIGHT_GRAY);31 setForeground(ConflictColors.FGCOLOR_MINE.get()); 37 32 } else if (MergeDecisionType.UNDECIDED.equals(item.getMergeDecision())) { 38 setForeground(Co lor.black);33 setForeground(ConflictColors.FGCOLOR_UNDECIDED.get()); 39 34 } 40 35 } … … 65 60 } 66 61 } 67 68 62 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergeTableCellRenderer.java
r4072 r4162 2 2 package org.openstreetmap.josm.gui.conflict.pair.tags; 3 3 4 import java.awt.Color;5 4 import java.awt.Component; 6 5 import java.text.MessageFormat; … … 9 8 import javax.swing.JTable; 10 9 import javax.swing.table.TableCellRenderer; 10 11 import org.openstreetmap.josm.gui.conflict.ConflictColors; 11 12 12 13 public abstract class TagMergeTableCellRenderer extends JLabel implements TableCellRenderer { … … 18 19 protected void reset() { 19 20 setOpaque(true); 20 setBackground(Co lor.white);21 setForeground(Co lor.black);21 setBackground(ConflictColors.BGCOLOR.get()); 22 setForeground(ConflictColors.FGCOLOR.get()); 22 23 } 23 24 -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TheirTableCellRenderer.java
r3083 r4162 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.Color; 7 6 import org.openstreetmap.josm.gui.conflict.ConflictColors; 8 7 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; 9 8 10 9 public class TheirTableCellRenderer extends TagMergeTableCellRenderer { 11 10 12 public final static Color BGCOLOR_UNDECIDED = new Color(255,197,197);13 public final static Color BGCOLOR_MINE = Color.white;14 public final static Color BGCOLOR_THEIR = new Color(217,255,217);15 public final static Color BGCOLOR_SELECTED = new Color(143,170,255);16 17 11 protected void setBackgroundColor(TagMergeItem item, boolean isSelected) { 18 12 if (isSelected) { 19 setBackground(BGCOLOR_SELECTED); 13 setBackground(ConflictColors.BGCOLOR_SELECTED.get()); 20 14 return; 21 15 } 22 16 if (MergeDecisionType.KEEP_MINE.equals(item.getMergeDecision())) { 23 setBackground(BGCOLOR_MINE); 17 setBackground(ConflictColors.BGCOLOR_MINE.get()); 24 18 } else if (MergeDecisionType.KEEP_THEIR.equals(item.getMergeDecision())) { 25 setBackground(BGCOLOR_THEIR); 19 setBackground(ConflictColors.BGCOLOR_THEIR.get()); 26 20 } else if (MergeDecisionType.UNDECIDED.equals(item.getMergeDecision())) { 27 setBackground(BGCOLOR_UNDECIDED); 21 setBackground(ConflictColors.BGCOLOR_UNDECIDED.get()); 28 22 } 29 23 } … … 31 25 protected void setTextColor(TagMergeItem item) { 32 26 if (MergeDecisionType.KEEP_THEIR.equals(item.getMergeDecision())) { 33 setForeground(Co lor.black);27 setForeground(ConflictColors.FGCOLOR_THEIR.get()); 34 28 } else if (MergeDecisionType.KEEP_MINE.equals(item.getMergeDecision())) { 35 setForeground(Co lor.LIGHT_GRAY);29 setForeground(ConflictColors.FGCOLOR_MINE.get()); 36 30 } else if (MergeDecisionType.UNDECIDED.equals(item.getMergeDecision())) { 37 setForeground(Co lor.black);31 setForeground(ConflictColors.FGCOLOR_UNDECIDED.get()); 38 32 } 39 33 } -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellEditor.java
r3083 r4162 151 151 protected void renderColors(boolean selected) { 152 152 if (selected) { 153 setForeground( 153 setForeground(UIManager.getColor("ComboBox.selectionForeground")); 154 154 setBackground(UIManager.getColor("ComboBox.selectionBackground")); 155 155 } else { 156 setForeground( 156 setForeground(UIManager.getColor("ComboBox.foreground")); 157 157 setBackground(UIManager.getColor("ComboBox.background")); 158 158 } -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellRenderer.java
r4112 r4162 16 16 import javax.swing.table.TableCellRenderer; 17 17 18 import org.openstreetmap.josm.gui.conflict.ConflictColors; 18 19 import org.openstreetmap.josm.tools.ImageProvider; 19 20 … … 23 24 */ 24 25 public class MultiValueCellRenderer extends JLabel implements TableCellRenderer { 25 26 public final static Color BGCOLOR_UNDECIDED = new Color(255,197,197);27 26 28 27 private ImageIcon iconDecided; … … 46 45 case UNDECIDED: 47 46 setForeground(UIManager.getColor("Table.foreground")); 48 setBackground(BGCOLOR_UNDECIDED); 47 setBackground(ConflictColors.BGCOLOR_UNDECIDED.get()); 49 48 break; 50 49 case KEEP_NONE: -
trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
r4126 r4162 2 2 package org.openstreetmap.josm.gui.layer; 3 3 4 import static org.openstreetmap.josm.tools.I18n.marktr; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 import static org.openstreetmap.josm.tools.I18n.trc; … … 44 45 45 46 public static Color getFadeColor() { 46 return Main.pref.getColor( "imagery.fade", Color.white);47 return Main.pref.getColor(marktr("Imagery fade"), Color.white); 47 48 } 48 49 … … 53 54 54 55 public static void setFadeColor(Color color) { 55 Main.pref.putColor( "imagery.fade", color);56 Main.pref.putColor(marktr("Imagery fade"), color); 56 57 } 57 58 -
trunk/src/org/openstreetmap/josm/gui/preferences/ColorPreference.java
r4072 r4162 16 16 import java.util.TreeMap; 17 17 import java.util.Vector; 18 import java.util.regex.Matcher;19 import java.util.regex.Pattern;20 18 21 19 import javax.swing.BorderFactory; … … 35 33 import org.openstreetmap.josm.Main; 36 34 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors; 35 import org.openstreetmap.josm.data.validation.Severity; 37 36 import org.openstreetmap.josm.gui.MapScaler; 37 import org.openstreetmap.josm.gui.conflict.ConflictColors; 38 38 import org.openstreetmap.josm.gui.dialogs.ConflictDialog; 39 39 import org.openstreetmap.josm.gui.layer.GpxLayer; 40 import org.openstreetmap.josm.gui.layer.ImageryLayer; 40 41 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 41 42 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; … … 132 133 private String getName(String o) 133 134 { 134 try 135 { 136 Matcher m = Pattern.compile("mappaint\\.(.+?)\\.(.+)").matcher(o); 137 m.matches(); 138 return tr("Paint style {0}: {1}", tr(m.group(1)), tr(m.group(2))); 139 } 140 catch (Exception e) {} 141 try 142 { 143 Matcher m = Pattern.compile("layer (.+)").matcher(o); 144 m.matches(); 145 return tr("Layer: {0}", tr(m.group(1))); 146 } 147 catch (Exception e) {} 148 return tr(o); 135 return Main.pref.getColorName(o); 149 136 } 150 137 … … 260 247 private void fixColorPrefixes() { 261 248 PaintColors.getColors(); 249 ConflictColors.getColors(); 250 Severity.getColors(); 262 251 MarkerLayer.getColor(null); 263 252 GpxLayer.getColor(null); 264 253 OsmDataLayer.getOutsideColor(); 254 ImageryLayer.getFadeColor(); 265 255 MapScaler.getColor(); 266 256 ConflictDialog.getColor();
Note:
See TracChangeset
for help on using the changeset viewer.