001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.gui.history;
003
004import javax.swing.JTable;
005import javax.swing.ListSelectionModel;
006
007/**
008 * TagInfoViewer is a UI component which displays the list of tags of two
009 * version of a {@link org.openstreetmap.josm.data.osm.OsmPrimitive} in a {@link org.openstreetmap.josm.data.osm.history.History}.
010 *
011 * <ul>
012 *   <li>on the left, it displays the list of tags for the version at {@link PointInTimeType#REFERENCE_POINT_IN_TIME}</li>
013 *   <li>on the right, it displays the list of tags for the version at {@link PointInTimeType#CURRENT_POINT_IN_TIME}</li>
014 * </ul>
015 *
016 */
017public class TagInfoViewer extends HistoryViewerPanel {
018
019    protected JTable buildReferenceTable() {
020        JTable table = new JTable(
021                model.getTagTableModel(PointInTimeType.REFERENCE_POINT_IN_TIME),
022                new TagTableColumnModel()
023        );
024        table.setName("table.referencetagtable");
025        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
026        selectionSynchronizer.participateInSynchronizedSelection(table.getSelectionModel());
027        return table;
028    }
029
030    protected JTable buildCurrentTable() {
031        JTable table = new JTable(
032                model.getTagTableModel(PointInTimeType.CURRENT_POINT_IN_TIME),
033                new TagTableColumnModel()
034        );
035        table.setName("table.currenttagtable");
036        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
037        selectionSynchronizer.participateInSynchronizedSelection(table.getSelectionModel());
038        return table;
039    }
040
041    /**
042     * Constructs a new {@code TagInfoViewer}.
043     * @param model The history browsing model
044     */
045    public TagInfoViewer(HistoryBrowserModel model) {
046        super(model);
047    }
048}