Changeset 15091 in osm for applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java
- Timestamp:
- 2009-05-17T13:19:29+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java
r13497 r15091 1 1 package wmsplugin; 2 2 3 import java.awt.BorderLayout; 4 import java.awt.FlowLayout; 5 import javax.swing.JCheckBox; 6 import javax.swing.JSpinner; 7 import javax.swing.SpinnerNumberModel; 8 import org.openstreetmap.josm.Main; 3 9 import static org.openstreetmap.josm.tools.I18n.tr; 4 10 … … 9 15 import java.util.HashMap; 10 16 import java.util.Map; 11 12 17 13 18 import javax.swing.Box; … … 21 26 import javax.swing.table.DefaultTableModel; 22 27 23 24 28 import org.openstreetmap.josm.gui.preferences.PreferenceDialog; 25 29 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; … … 27 31 28 32 public class WMSPreferenceEditor implements PreferenceSetting { 29 30 33 private Map<String,String> orig; 31 34 private DefaultTableModel model; 32 35 private HashMap<Integer, WMSInfo> oldValues = new HashMap<Integer, WMSInfo>(); 36 37 JCheckBox overlapCheckBox; 38 JSpinner spinLat; 39 JSpinner spinLon; 33 40 34 41 public void addGui(final PreferenceDialog gui) { … … 59 66 } 60 67 68 JPanel buttonPanel = new JPanel(new FlowLayout()); 69 61 70 JButton add = new JButton(tr("Add")); 62 p.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL)); 63 p.add(add, GBC.std().insets(0,5,0,0)); 71 buttonPanel.add(add, GBC.std().insets(0,5,0,0)); 64 72 add.addActionListener(new ActionListener(){ 65 73 public void actionPerformed(ActionEvent e) { … … 79 87 80 88 JButton delete = new JButton(tr("Delete")); 81 p.add(delete, GBC.std().insets(0,5,0,0));89 buttonPanel.add(delete, GBC.std().insets(0,5,0,0)); 82 90 delete.addActionListener(new ActionListener(){ 83 91 public void actionPerformed(ActionEvent e) { … … 94 102 95 103 JButton copy = new JButton(tr("Copy Default")); 96 p.add(copy, GBC.std().insets(0,5,0,0));104 buttonPanel.add(copy, GBC.std().insets(0,5,0,0)); 97 105 copy.addActionListener(new ActionListener(){ 98 106 public void actionPerformed(ActionEvent e) { … … 107 115 } 108 116 }); 117 118 p.add(buttonPanel); 119 p.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL)); 120 121 overlapCheckBox = new JCheckBox(tr("Overlap tiles"), WMSPlugin.doOverlap ); 122 JLabel labelLat = new JLabel(tr("% of lat:")); 123 JLabel labelLon = new JLabel(tr("% of lon:")); 124 spinLat = new JSpinner(new SpinnerNumberModel(WMSPlugin.overlapLat, 1, 50, 1)); 125 spinLon = new JSpinner(new SpinnerNumberModel(WMSPlugin.overlapLon, 1, 50, 1)); 126 127 JPanel overlapPanel = new JPanel(new FlowLayout()); 128 overlapPanel.add(overlapCheckBox); 129 overlapPanel.add(labelLat); 130 overlapPanel.add(spinLat); 131 overlapPanel.add(labelLon); 132 overlapPanel.add(spinLon); 133 134 p.add(overlapPanel); 109 135 } 110 136 … … 145 171 146 172 if (change) WMSPlugin.refreshMenu(); 173 174 WMSPlugin.doOverlap = overlapCheckBox.getModel().isSelected(); 175 WMSPlugin.overlapLat = (Integer) spinLat.getModel().getValue(); 176 WMSPlugin.overlapLon = (Integer) spinLon.getModel().getValue(); 177 178 Main.pref.put("wmsplugin.url.overlap", String.valueOf(WMSPlugin.doOverlap)); 179 Main.pref.put("wmsplugin.url.overlapLat", String.valueOf(WMSPlugin.overlapLat)); 180 Main.pref.put("wmsplugin.url.overlapLon", String.valueOf(WMSPlugin.overlapLon)); 181 147 182 return false; 148 183 }
Note:
See TracChangeset
for help on using the changeset viewer.