source: josm/trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentTableCellRenderer.java@ 7715

Last change on this file since 7715 was 7715, checked in by Don-vip, 10 years ago

see #10701 - display discussion comments in changeset dialog

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.dialogs.changeset;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.Component;
7
8import javax.swing.JTable;
9
10import org.openstreetmap.josm.data.osm.ChangesetDataSet.ChangesetModificationType;
11import org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive;
12
13/**
14 * The table cell renderer used in the changeset content table, except for the "name"
15 * column in which we use a {@link org.openstreetmap.josm.gui.OsmPrimitivRenderer}.
16 */
17public class ChangesetContentTableCellRenderer extends AbstractCellRenderer {
18
19 protected void renderModificationType(ChangesetModificationType type) {
20 switch(type) {
21 case CREATED: setText(tr("Created")); break;
22 case UPDATED: setText(tr("Updated")); break;
23 case DELETED: setText(tr("Deleted")); break;
24 }
25 setToolTipText(null);
26 }
27
28 @Override
29 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
30 int row, int column) {
31 if (value == null)
32 return this;
33 reset();
34 renderColors(isSelected);
35 switch(column) {
36 case 0:
37 ChangesetModificationType type = (ChangesetModificationType)value;
38 renderModificationType(type);
39 break;
40 case 1:
41 HistoryOsmPrimitive primitive = (HistoryOsmPrimitive)value;
42 renderId(primitive.getId());
43 break;
44 default:
45 /* do nothing */
46 }
47 return this;
48 }
49}
Note: See TracBrowser for help on using the repository browser.