source: josm/trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetTagsPanel.java@ 2711

Last change on this file since 2711 was 2711, checked in by stoecker, 14 years ago

fix bad line endings

File size: 1.8 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.dialogs.changeset;
3
4import java.awt.BorderLayout;
5import java.beans.PropertyChangeEvent;
6import java.beans.PropertyChangeListener;
7
8import javax.swing.BorderFactory;
9import javax.swing.JPanel;
10import javax.swing.JScrollPane;
11
12import org.openstreetmap.josm.data.osm.Changeset;
13import org.openstreetmap.josm.gui.tagging.TagEditorModel;
14import org.openstreetmap.josm.gui.tagging.TagTable;
15
16/**
17 * This panel displays the tags of the currently selected changeset in the {@see ChangesetCacheManager}
18 *
19 */
20public class ChangesetTagsPanel extends JPanel implements PropertyChangeListener{
21
22 private TagTable tblTags;
23 private TagEditorModel model;
24
25 protected void build() {
26 setLayout(new BorderLayout());
27 setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
28
29 tblTags = new TagTable(model = new TagEditorModel());
30 tblTags.setEnabled(false);
31 add(new JScrollPane(tblTags), BorderLayout.CENTER);
32 }
33
34 public ChangesetTagsPanel() {
35 build();
36 }
37
38 protected void init(Changeset cs) {
39 model.clear();
40 if (cs == null)
41 return;
42 model.initFromTags(cs.getKeys());
43 }
44
45 /* ---------------------------------------------------------------------------- */
46 /* interface PropertyChangeListener */
47 /* ---------------------------------------------------------------------------- */
48 public void propertyChange(PropertyChangeEvent evt) {
49 if (!evt.getPropertyName().equals(ChangesetCacheManagerModel.CHANGESET_IN_DETAIL_VIEW_PROP))
50 return;
51 Changeset cs = (Changeset)evt.getNewValue();
52 if (cs == null) {
53 model.clear();
54 } else {
55 model.initFromPrimitive(cs);
56 }
57 }
58}
Note: See TracBrowser for help on using the repository browser.