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