001    // License: GPL. For details, see LICENSE file.
002    package org.openstreetmap.josm.gui.history;
003    
004    import static org.openstreetmap.josm.tools.I18n.tr;
005    
006    import javax.swing.SwingConstants;
007    import javax.swing.table.DefaultTableColumnModel;
008    import javax.swing.table.TableColumn;
009    import javax.swing.table.TableColumnModel;
010    
011    /**
012     * The {@link TableColumnModel} for the table with the list of versions
013     *
014     */
015    public class VersionTableColumnModel extends DefaultTableColumnModel {
016        protected void createColumns() {
017            TableColumn col = null;
018            VersionTable.RadioButtonRenderer bRenderer = new VersionTable.RadioButtonRenderer();
019    
020            // column 0 - Version
021            col = new TableColumn(0);
022            /* translation note: 3 letter abbr. for "Version" */
023            col.setHeaderValue(tr("Ver"));
024            col.setCellRenderer(new VersionTable.AlignedRenderer(SwingConstants.CENTER));
025            col.setResizable(false);
026            addColumn(col);
027            // column 1 - Reference
028            col = new TableColumn(1);
029            col.setHeaderValue(tr("A"));
030            col.setCellRenderer(bRenderer);
031            col.setCellEditor(new VersionTable.RadioButtonEditor());
032            col.setResizable(false);
033            addColumn(col);
034            // column 2 - Current
035            col = new TableColumn(2);
036            col.setHeaderValue(tr("B"));
037            col.setCellRenderer(bRenderer);
038            col.setCellEditor(new VersionTable.RadioButtonEditor());
039            col.setResizable(false);
040            addColumn(col);
041            // column 3 - Date
042            col = new TableColumn(3);
043            col.setHeaderValue(tr("Date"));
044            col.setResizable(false);
045            addColumn(col);
046            // column 4 - User
047            col = new TableColumn(4);
048            col.setHeaderValue(tr("User"));
049            col.setResizable(false);
050            addColumn(col);
051        }
052    
053        /**
054         * Creates a new {@code VersionTableColumnModel}.
055         */
056        public VersionTableColumnModel() {
057            createColumns();
058        }
059    }