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

Last change on this file since 17994 was 17889, checked in by simon04, 3 years ago

see #20880 - Extract class VersionTableCellRenderer

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