1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.dialogs.relation;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import javax.swing.table.DefaultTableColumnModel;
|
---|
7 | import javax.swing.table.TableColumn;
|
---|
8 |
|
---|
9 | import org.openstreetmap.josm.data.osm.DataSet;
|
---|
10 | import org.openstreetmap.josm.data.osm.Relation;
|
---|
11 |
|
---|
12 | public class MemberTableColumnModel extends DefaultTableColumnModel {
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Constructs a new {@code MemberTableColumnModel}.
|
---|
16 | * @param ds the data set. Must not be null
|
---|
17 | * @param relation the relation. Can be null
|
---|
18 | */
|
---|
19 | public MemberTableColumnModel(DataSet ds, Relation relation) {
|
---|
20 | TableColumn col = null;
|
---|
21 |
|
---|
22 | // column 0 - the member role
|
---|
23 | col = new TableColumn(0);
|
---|
24 | col.setHeaderValue(tr("Role"));
|
---|
25 | col.setResizable(true);
|
---|
26 | col.setPreferredWidth(100);
|
---|
27 | col.setCellRenderer(new MemberTableRoleCellRenderer());
|
---|
28 | col.setCellEditor(new MemberRoleCellEditor(ds, relation));
|
---|
29 | addColumn(col);
|
---|
30 |
|
---|
31 | // column 1 - the member
|
---|
32 | col = new TableColumn(1);
|
---|
33 | col.setHeaderValue(tr("Refers to"));
|
---|
34 | col.setResizable(true);
|
---|
35 | col.setPreferredWidth(300);
|
---|
36 | col.setCellRenderer(new MemberTableMemberCellRenderer());
|
---|
37 | addColumn(col);
|
---|
38 |
|
---|
39 | // column 2 -
|
---|
40 | col = new TableColumn(2);
|
---|
41 | col.setHeaderValue("");
|
---|
42 | col.setResizable(false);
|
---|
43 | col.setPreferredWidth(20);
|
---|
44 | col.setCellRenderer(new MemberTableLinkedCellRenderer());
|
---|
45 | addColumn(col);
|
---|
46 | }
|
---|
47 | }
|
---|