source: josm/trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolver.java@ 2712

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

i18n updated, fixed files to reduce problems when applying patches, fix #4017

File size: 2.8 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.conflict.tags;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.BorderLayout;
7import java.awt.GridBagConstraints;
8import java.awt.GridBagLayout;
9
10import javax.swing.BorderFactory;
11import javax.swing.JCheckBox;
12import javax.swing.JLabel;
13import javax.swing.JPanel;
14import javax.swing.JScrollPane;
15import javax.swing.event.ChangeEvent;
16import javax.swing.event.ChangeListener;
17
18import org.openstreetmap.josm.Main;
19
20/**
21 * This is a UI widget for resolving tag conflicts, i.e. differences of the tag values
22 * of multiple {@see OsmPrimitive}s.
23 *
24 *
25 */
26public class TagConflictResolver extends JPanel {
27
28 /** the model for the tag conflict resolver */
29 private TagConflictResolverModel model;
30 /** selects wheter only tags with conflicts are displayed */
31 private JCheckBox cbShowTagsWithConflictsOnly;
32
33 protected JPanel buildInfoPanel() {
34 JPanel pnl = new JPanel();
35 pnl.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
36 pnl.setLayout(new GridBagLayout());
37 GridBagConstraints gc = new GridBagConstraints();
38 gc.fill = GridBagConstraints.BOTH;
39 gc.weighty = 1.0;
40 gc.weightx = 1.0;
41 gc.anchor = GridBagConstraints.LINE_START;
42 pnl.add(new JLabel(tr("<html>Please select the values to keep for the following tags.</html>")), gc);
43
44 gc.gridy = 1;
45 gc.fill = GridBagConstraints.HORIZONTAL;
46 gc.weighty = 0.0;
47 pnl.add(cbShowTagsWithConflictsOnly = new JCheckBox(tr("Show tags with conflicts only")), gc);
48 cbShowTagsWithConflictsOnly.addChangeListener(
49 new ChangeListener() {
50 public void stateChanged(ChangeEvent e) {
51 model.setShowTagsWithConflictsOnly(cbShowTagsWithConflictsOnly.isSelected());
52 }
53 }
54 );
55 cbShowTagsWithConflictsOnly.setSelected(
56 Main.pref.getBoolean(getClass().getName() + ".showTagsWithConflictsOnly", false)
57 );
58 return pnl;
59 }
60
61 /**
62 * Remembers the current settings in the global preferences
63 *
64 */
65 public void rememberPreferences() {
66 Main.pref.put(getClass().getName() + ".showTagsWithConflictsOnly", cbShowTagsWithConflictsOnly.isSelected());
67 }
68
69 protected void build() {
70 setLayout(new BorderLayout());
71 add(buildInfoPanel(), BorderLayout.NORTH);
72 add(new JScrollPane(new TagConflictResolverTable(model)), BorderLayout.CENTER);
73 }
74
75 public TagConflictResolver() {
76 this.model = new TagConflictResolverModel();
77 build();
78 }
79
80 /**
81 * Replies the model used by this dialog
82 *
83 * @return the model
84 */
85 public TagConflictResolverModel getModel() {
86 return model;
87 }
88}
Note: See TracBrowser for help on using the repository browser.