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

Last change on this file since 5299 was 4163, checked in by stoecker, 13 years ago

improve color names of last checkin

  • Property svn:eol-style set to native
File size: 2.4 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.conflict.pair.tags;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import org.openstreetmap.josm.gui.conflict.ConflictColors;
7import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType;
8
9public class MineTableCellRenderer extends TagMergeTableCellRenderer {
10
11 protected void setBackgroundColor(TagMergeItem item, boolean isSelected) {
12 if (isSelected) {
13 setBackground(ConflictColors.BGCOLOR_SELECTED.get());
14 return;
15 }
16 if (MergeDecisionType.KEEP_MINE.equals(item.getMergeDecision())) {
17 setBackground(ConflictColors.BGCOLOR_KEEP.get());
18 } else if (MergeDecisionType.KEEP_THEIR.equals(item.getMergeDecision())) {
19 setBackground(ConflictColors.BGCOLOR_DROP.get());
20 } else if (MergeDecisionType.UNDECIDED.equals(item.getMergeDecision())) {
21 setBackground(ConflictColors.BGCOLOR_UNDECIDED.get());
22 }
23 }
24
25 protected void setTextColor(TagMergeItem item) {
26 if (MergeDecisionType.KEEP_MINE.equals(item.getMergeDecision())) {
27 setForeground(ConflictColors.FGCOLOR_KEEP.get());
28 } else if (MergeDecisionType.KEEP_THEIR.equals(item.getMergeDecision())) {
29 setForeground(ConflictColors.FGCOLOR_DROP.get());
30 } else if (MergeDecisionType.UNDECIDED.equals(item.getMergeDecision())) {
31 setForeground(ConflictColors.FGCOLOR_UNDECIDED.get());
32 }
33 }
34
35 @Override
36 protected void renderKey(TagMergeItem item, boolean isSelected) {
37 setBackgroundColor(item, isSelected);
38 setTextColor(item);
39 if (item.getMyTagValue() == null) {
40 setText(tr("<undefined>"));
41 setToolTipText(tr("My dataset does not include a tag with key {0}", item.getKey()));
42 } else {
43 setText(item.getKey());
44 setToolTipText(item.getKey());
45 }
46 }
47
48 @Override
49 protected void renderValue(TagMergeItem item, boolean isSelected) {
50 setBackgroundColor(item,isSelected);
51 setTextColor(item);
52 if (item.getMyTagValue() == null) {
53 setText(tr("<undefined>"));
54 setToolTipText(tr("My dataset does not include a tag with key {0}", item.getKey()));
55 } else {
56 setText(item.getMyTagValue());
57 setToolTipText(item.getMyTagValue());
58 }
59 }
60}
Note: See TracBrowser for help on using the repository browser.