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

Last change on this file since 8760 was 8760, checked in by simon04, 9 years ago

fix #11686 - Error by uploading changeset with too long tag

Changeset tags table: limit key/value length to allowed maximum of API

  • Property svn:eol-style set to native
File size: 1.9 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 {@link ChangesetCacheManager}
18 *
19 */
20public class ChangesetTagsPanel extends JPanel implements PropertyChangeListener{
21
22 private TagEditorModel model;
23
24 protected void build() {
25 setLayout(new BorderLayout());
26 setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
27 model = new TagEditorModel();
28 TagTable tblTags = new TagTable(model, 0);
29 tblTags.setEnabled(false);
30 add(new JScrollPane(tblTags), BorderLayout.CENTER);
31 }
32
33 /**
34 * Constructs a new {@code ChangesetTagsPanel}.
35 */
36 public ChangesetTagsPanel() {
37 build();
38 }
39
40 protected void init(Changeset cs) {
41 if (cs == null) {
42 model.clear();
43 return;
44 }
45 model.initFromTags(cs.getKeys());
46 }
47
48 /* ---------------------------------------------------------------------------- */
49 /* interface PropertyChangeListener */
50 /* ---------------------------------------------------------------------------- */
51 @Override
52 public void propertyChange(PropertyChangeEvent evt) {
53 if (!evt.getPropertyName().equals(ChangesetCacheManagerModel.CHANGESET_IN_DETAIL_VIEW_PROP))
54 return;
55 Changeset cs = (Changeset) evt.getNewValue();
56 if (cs == null) {
57 model.clear();
58 } else {
59 model.initFromPrimitive(cs);
60 }
61 }
62}
Note: See TracBrowser for help on using the repository browser.