Ignore:
Timestamp:
2009-05-17T13:19:29+02:00 (15 years ago)
Author:
stoecker
Message:

close #2589, #2310

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java

    r13497 r15091  
    11package wmsplugin;
    22
     3import java.awt.BorderLayout;
     4import java.awt.FlowLayout;
     5import javax.swing.JCheckBox;
     6import javax.swing.JSpinner;
     7import javax.swing.SpinnerNumberModel;
     8import org.openstreetmap.josm.Main;
    39import static org.openstreetmap.josm.tools.I18n.tr;
    410
     
    915import java.util.HashMap;
    1016import java.util.Map;
    11 
    1217
    1318import javax.swing.Box;
     
    2126import javax.swing.table.DefaultTableModel;
    2227
    23 
    2428import org.openstreetmap.josm.gui.preferences.PreferenceDialog;
    2529import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
     
    2731
    2832public class WMSPreferenceEditor implements PreferenceSetting {
    29 
    3033    private Map<String,String> orig;
    3134    private DefaultTableModel model;
    3235    private HashMap<Integer, WMSInfo> oldValues = new HashMap<Integer, WMSInfo>();
     36
     37    JCheckBox overlapCheckBox;
     38    JSpinner spinLat;
     39    JSpinner spinLon;
    3340
    3441    public void addGui(final PreferenceDialog gui) {
     
    5966        }
    6067
     68        JPanel buttonPanel = new JPanel(new FlowLayout());
     69
    6170        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));
    6472        add.addActionListener(new ActionListener(){
    6573            public void actionPerformed(ActionEvent e) {
     
    7987
    8088        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));
    8290        delete.addActionListener(new ActionListener(){
    8391            public void actionPerformed(ActionEvent e) {
     
    94102
    95103        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));
    97105        copy.addActionListener(new ActionListener(){
    98106            public void actionPerformed(ActionEvent e) {
     
    107115            }
    108116        });
     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);
    109135    }
    110136
     
    145171
    146172        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
    147182        return false;
    148183    }
Note: See TracChangeset for help on using the changeset viewer.