Changeset 9194 in josm
- Timestamp:
- 2015-12-28T14:13:30+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/history/TagTableCellRenderer.java
r8893 r9194 15 15 */ 16 16 public class TagTableCellRenderer extends JLabel implements TableCellRenderer { 17 public static final Color BGCOLOR_ DIFFERENCE = new Color(255, 197, 197);17 public static final Color BGCOLOR_SELECTED = new Color(143, 170, 255); 18 18 19 19 /** … … 24 24 } 25 25 26 protected void renderName(String key, HistoryBrowserModel.TagTableModel model, boolean isSelected) { 27 String text = key; 26 protected void setBackground(String key, HistoryBrowserModel.TagTableModel model, boolean isSelected) { 28 27 Color bgColor = UIManager.getColor("Table.background"); 29 Color fgColor = UIManager.getColor("Table.foreground"); 30 if (!model.hasTag(key)) { 31 text = ""; 32 bgColor = BGCOLOR_DIFFERENCE; 33 } else if (!model.oppositeHasTag(key)) { 34 bgColor = BGCOLOR_DIFFERENCE; 28 if (!model.hasTag(key) && model.isCurrentPointInTime() 29 || !model.oppositeHasTag(key) && model.isReferencePointInTime()) { 30 bgColor = TwoColumnDiff.Item.DiffItemType.DELETED.getColor(); 31 } else if (!model.oppositeHasTag(key) && model.isCurrentPointInTime() 32 || !model.hasTag(key) && model.isReferencePointInTime()) { 33 bgColor = TwoColumnDiff.Item.DiffItemType.INSERTED.getColor(); 34 } else if (model.hasTag(key) && model.oppositeHasTag(key) && !model.hasSameValueAsOpposite(key)) { 35 bgColor = TwoColumnDiff.Item.DiffItemType.CHANGED.getColor(); 35 36 } 36 37 if (isSelected) { 37 bgColor = UIManager.getColor("Table.backgroundSelected"); 38 fgColor = UIManager.getColor("Table.foregroundSelected"); 38 bgColor = BGCOLOR_SELECTED; 39 39 } 40 40 41 setText(text);42 setToolTipText(text);43 41 setBackground(bgColor); 44 setForeground(fgColor);45 }46 47 protected void renderValue(String key, HistoryBrowserModel.TagTableModel model, boolean isSelected) {48 String text = "";49 Color bgColor = UIManager.getColor("Table.background");50 Color fgColor = UIManager.getColor("Table.foreground");51 if (!model.hasTag(key)) {52 bgColor = BGCOLOR_DIFFERENCE;53 } else {54 text = model.getValue(key);55 if (!model.hasSameValueAsOpposite(key)) {56 bgColor = BGCOLOR_DIFFERENCE;57 }58 }59 if (isSelected) {60 bgColor = UIManager.getColor("Table.backgroundSelected");61 fgColor = UIManager.getColor("Table.foregroundSelected");62 }63 64 setText(text);65 setToolTipText(text);66 setBackground(bgColor);67 setForeground(fgColor);68 42 } 69 43 … … 81 55 case 0: 82 56 // the name column 83 renderName(key, model, isSelected); 57 setText(model.hasTag(key) ? key : ""); 58 setToolTipText(getText()); 59 setBackground(key, model, isSelected); 84 60 break; 85 61 case 1: 86 62 // the value column 87 renderValue(key, model, isSelected); 63 setText(model.hasTag(key) ? model.getValue(key) : ""); 64 setToolTipText(getText()); 65 setBackground(key, model, isSelected); 88 66 break; 89 67 }
Note:
See TracChangeset
for help on using the changeset viewer.