001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.gui.history;
003
004import static org.openstreetmap.josm.tools.I18n.tr;
005
006import javax.swing.table.DefaultTableColumnModel;
007import javax.swing.table.TableColumn;
008
009/**
010 * The {@link javax.swing.table.TableColumnModel} for the table with the list of tags
011 * @since 1709
012 */
013public class TagTableColumnModel extends DefaultTableColumnModel {
014    protected static final int COLUMN_KEY = 0;
015    protected static final int COLUMN_VALUE = 1;
016
017    /**
018     * Constructs a new {@code TagTableColumnModel}.
019     */
020    public TagTableColumnModel() {
021        createColumns();
022    }
023
024    protected void createColumns() {
025        TagTableCellRenderer renderer = new TagTableCellRenderer();
026
027        // column 0 - Key
028        TableColumn col = new TableColumn(0);
029        col.setHeaderValue(tr("Key"));
030        col.setCellRenderer(renderer);
031        addColumn(col);
032
033        // column 1 - Value
034        col = new TableColumn(1);
035        col.setHeaderValue(tr("Value"));
036        col.setCellRenderer(renderer);
037        addColumn(col);
038    }
039}