source: josm/trunk/src/org/openstreetmap/josm/gui/history/VersionTableColumnModel.java@ 10308

Last change on this file since 10308 was 10308, checked in by Don-vip, 8 years ago

sonar - squid:S1854 - Dead stores should be removed

  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.history;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import javax.swing.SwingConstants;
7import javax.swing.table.DefaultTableColumnModel;
8import javax.swing.table.TableColumn;
9import javax.swing.table.TableColumnModel;
10
11/**
12 * The {@link TableColumnModel} for the table with the list of versions
13 * @since 1709
14 */
15public class VersionTableColumnModel extends DefaultTableColumnModel {
16
17 /** Column index for version */
18 public static final int COL_VERSION = 0;
19 /** Column index for reference */
20 public static final int COL_REFERENCE = 1;
21 /** Column index for current */
22 public static final int COL_CURRENT = 2;
23 /** Column index for date */
24 public static final int COL_DATE = 3;
25 /** Column index for user */
26 public static final int COL_USER = 4;
27
28 /**
29 * Creates a new {@code VersionTableColumnModel}.
30 */
31 public VersionTableColumnModel() {
32 createColumns();
33 }
34
35 protected void createColumns() {
36 VersionTable.RadioButtonRenderer bRenderer = new VersionTable.RadioButtonRenderer();
37
38 // column 0 - Version
39 TableColumn col = new TableColumn(COL_VERSION);
40 /* translation note: 3 letter abbr. for "Version" */
41 col.setHeaderValue(tr("Ver"));
42 col.setCellRenderer(new VersionTable.AlignedRenderer(SwingConstants.CENTER));
43 col.setResizable(false);
44 addColumn(col);
45 // column 1 - Reference
46 col = new TableColumn(COL_REFERENCE);
47 col.setHeaderValue(tr("A"));
48 col.setCellRenderer(bRenderer);
49 col.setCellEditor(new VersionTable.RadioButtonEditor());
50 col.setResizable(false);
51 addColumn(col);
52 // column 2 - Current
53 col = new TableColumn(COL_CURRENT);
54 col.setHeaderValue(tr("B"));
55 col.setCellRenderer(bRenderer);
56 col.setCellEditor(new VersionTable.RadioButtonEditor());
57 col.setResizable(false);
58 addColumn(col);
59 // column 3 - Date
60 col = new TableColumn(COL_DATE);
61 col.setHeaderValue(tr("Date"));
62 col.setResizable(false);
63 addColumn(col);
64 // column 4 - User
65 col = new TableColumn(COL_USER);
66 col.setHeaderValue(tr("User"));
67 col.setResizable(false);
68 addColumn(col);
69 }
70}
Note: See TracBrowser for help on using the repository browser.