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 - CT state
042            col = new TableColumn(3);
043            /* translation note: short for "Contributor Terms" */
044            col.setHeaderValue(tr("CT"));
045            col.setCellRenderer(new VersionTable.LabelRenderer());
046            col.setPreferredWidth(22);
047            col.setResizable(false);
048            addColumn(col);
049            // column 4 - Date
050            col = new TableColumn(4);
051            col.setHeaderValue(tr("Date"));
052            col.setResizable(false);
053            addColumn(col);
054            // column 5 - User
055            col = new TableColumn(5);
056            col.setHeaderValue(tr("User"));
057            col.setResizable(false);
058            addColumn(col);
059        }
060    
061        /**
062         * Creates a new {@code VersionTableColumnModel}.
063         */
064        public VersionTableColumnModel() {
065            createColumns();
066        }
067    }