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 | * @since 1709
|
---|
14 | */
|
---|
15 | public 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 | /** Column index for editor */
|
---|
28 | public static final int COL_EDITOR = 5;
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * Creates a new {@code VersionTableColumnModel}.
|
---|
32 | */
|
---|
33 | public VersionTableColumnModel() {
|
---|
34 | createColumns();
|
---|
35 | }
|
---|
36 |
|
---|
37 | protected void createColumns() {
|
---|
38 | VersionTable.RadioButtonRenderer bRenderer = new VersionTable.RadioButtonRenderer();
|
---|
39 |
|
---|
40 | // column 0 - Version
|
---|
41 | TableColumn col = new TableColumn(COL_VERSION);
|
---|
42 | /* translation note: 3 letter abbr. for "Version" */
|
---|
43 | col.setHeaderValue(tr("Ver"));
|
---|
44 | col.setCellRenderer(new VersionTable.AlignedRenderer(SwingConstants.CENTER));
|
---|
45 | col.setResizable(false);
|
---|
46 | addColumn(col);
|
---|
47 | // column 1 - Reference
|
---|
48 | col = new TableColumn(COL_REFERENCE);
|
---|
49 | col.setHeaderValue(tr("A"));
|
---|
50 | col.setCellRenderer(bRenderer);
|
---|
51 | col.setCellEditor(new VersionTable.RadioButtonEditor());
|
---|
52 | col.setResizable(false);
|
---|
53 | addColumn(col);
|
---|
54 | // column 2 - Current
|
---|
55 | col = new TableColumn(COL_CURRENT);
|
---|
56 | col.setHeaderValue(tr("B"));
|
---|
57 | col.setCellRenderer(bRenderer);
|
---|
58 | col.setCellEditor(new VersionTable.RadioButtonEditor());
|
---|
59 | col.setResizable(false);
|
---|
60 | addColumn(col);
|
---|
61 | // column 3 - Date
|
---|
62 | col = new TableColumn(COL_DATE);
|
---|
63 | col.setHeaderValue(tr("Date"));
|
---|
64 | col.setResizable(false);
|
---|
65 | addColumn(col);
|
---|
66 | // column 4 - User
|
---|
67 | col = new TableColumn(COL_USER);
|
---|
68 | col.setHeaderValue(tr("User"));
|
---|
69 | col.setResizable(false);
|
---|
70 | addColumn(col);
|
---|
71 | // column 5 - Editor
|
---|
72 | col = new TableColumn(COL_EDITOR);
|
---|
73 | col.setHeaderValue(tr("Editor"));
|
---|
74 | col.setResizable(false);
|
---|
75 | addColumn(col);
|
---|
76 | }
|
---|
77 | }
|
---|