source: josm/trunk/src/org/openstreetmap/josm/gui/conflict/tags/MineTableCellRenderer.java@ 1654

Last change on this file since 1654 was 1654, checked in by Gubaer, 15 years ago

added merge support for coordinate conflicts
added merge support for conflicts due to different deleted states

File size: 2.6 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.conflict.tags;
3
4import java.awt.Color;
5
6import org.openstreetmap.josm.gui.conflict.MergeDecisionType;
7
8import static org.openstreetmap.josm.tools.I18n.tr;
9
10public 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);
16
17 protected void setBackgroundColor(TagMergeItem item, boolean isSelected) {
18 if (isSelected) {
19 setBackground(BGCOLOR_SELECTED);
20 return;
21 }
22
23 if (MergeDecisionType.KEEP_MINE.equals(item.getMergeDecision())) {
24 setBackground(BGCOLOR_MINE);
25 } else if (MergeDecisionType.KEEP_THEIR.equals(item.getMergeDecision())) {
26 setBackground(BGCOLOR_THEIR);
27 } else if (MergeDecisionType.UNDECIDED.equals(item.getMergeDecision())) {
28 setBackground(BGCOLOR_UNDECIDED);
29 }
30 }
31
32 protected void setTextColor(TagMergeItem item) {
33 if (MergeDecisionType.KEEP_MINE.equals(item.getMergeDecision())) {
34 setForeground(Color.black);
35 } else if (MergeDecisionType.KEEP_THEIR.equals(item.getMergeDecision())) {
36 setForeground(Color.LIGHT_GRAY);
37 } else if (MergeDecisionType.UNDECIDED.equals(item.getMergeDecision())) {
38 setForeground(Color.black);
39 }
40 }
41
42 @Override
43 protected void renderKey(TagMergeItem item, boolean isSelected) {
44 setBackgroundColor(item,isSelected);
45 setTextColor(item);
46 if (item.getMyTagValue() == null) {
47 setText(tr("<undefined>"));
48 setToolTipText(tr("My dataset does not include a tag with key {0}", item.getKey()));
49 } else {
50 setText(item.getKey());
51 setToolTipText(item.getKey());
52 }
53 }
54
55 @Override
56 protected void renderValue(TagMergeItem item, boolean isSelected) {
57 setBackgroundColor(item,isSelected);
58 setTextColor(item);
59 if (item.getMyTagValue() == null) {
60 setText(tr("<undefined>"));
61 setToolTipText(tr("My dataset does not include a tag with key {0}", item.getKey()));
62 } else {
63 setText(item.getMyTagValue());
64 setToolTipText(item.getMyTagValue());
65 }
66 }
67
68}
Note: See TracBrowser for help on using the repository browser.