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

Last change on this file since 19050 was 19050, checked in by taylor.smock, 15 months ago

Revert most var changes from r19048, fix most new compile warnings and checkstyle issues

Also, document why various ErrorProne checks were originally disabled and fix
generic SonarLint issues.

  • Property svn:eol-style set to native
File size: 1.7 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.PrimitiveRenderer}.
16 */
17public class ChangesetContentTableCellRenderer extends AbstractCellRenderer {
18
19 /**
20 * Renders primitive modification type.
21 * @param type modification type
22 */
23 protected void renderModificationType(ChangesetModificationType type) {
24 switch (type) {
25 case CREATED: setText(tr("Created")); break;
26 case UPDATED: setText(tr("Updated")); break;
27 case DELETED: setText(tr("Deleted")); break;
28 }
29 setToolTipText(null);
30 }
31
32 @Override
33 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
34 int row, int column) {
35 if (value == null)
36 return this;
37 reset();
38 renderColors(isSelected);
39 switch (column) {
40 case 0:
41 if (value instanceof ChangesetModificationType) {
42 renderModificationType((ChangesetModificationType) value);
43 }
44 break;
45 case 1:
46 if (value instanceof HistoryOsmPrimitive) {
47 renderId(((HistoryOsmPrimitive) value).getId());
48 }
49 break;
50 default:
51 /* do nothing */
52 }
53 return this;
54 }
55}
Note: See TracBrowser for help on using the repository browser.