Changeset 32556 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePreferenceSetting.java
- Timestamp:
- 2016-07-04T14:18:17+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePreferenceSetting.java
r30703 r32556 1 // License: GPL. v2 and later. Copyright 2008-2009 by Pieren <pieren3@gmail.com> and others1 // License: GPL. For details, see LICENSE file. 2 2 package cadastre_fr; 3 3 … … 7 7 import java.awt.event.ActionEvent; 8 8 import java.awt.event.ActionListener; 9 import javax.swing.*; 9 10 import javax.swing.AbstractButton; 11 import javax.swing.BorderFactory; 12 import javax.swing.Box; 13 import javax.swing.ButtonGroup; 14 import javax.swing.JCheckBox; 15 import javax.swing.JComboBox; 16 import javax.swing.JLabel; 17 import javax.swing.JPanel; 18 import javax.swing.JRadioButton; 19 import javax.swing.JScrollPane; 20 import javax.swing.JSeparator; 21 import javax.swing.JSlider; 22 import javax.swing.JTextField; 23 import javax.swing.SwingConstants; 10 24 11 25 import org.openstreetmap.josm.Main; … … 19 33 * Preference settings for the French Cadastre plugin 20 34 * 21 * @author Pieren <pieren3@gmail.com>35 * @author Pieren <pieren3@gmail.com> 22 36 */ 23 37 public class CadastrePreferenceSetting extends DefaultTabPreferenceSetting { … … 42 56 43 57 private JCheckBox enableTableauAssemblage = new JCheckBox(tr("Use \"Tableau d''assemblage\"")); 44 58 45 59 private JCheckBox simplify2BitsColors = new JCheckBox(tr("Replace grey shades by white color only")); 46 60 … … 92 106 93 107 static final int DEFAULT_CROSSPIECES = 0; 94 108 95 109 static final String DEFAULT_GRAB_MULTIPLIER = Scale.SQUARE_100M.value; 96 110 … … 108 122 } 109 123 124 @Override 110 125 public void addGui(final PreferenceTabbedPane gui) { 111 126 JPanel cadastrewmsMast = gui.createPreferenceTab(this); 112 127 113 128 JPanel cadastrewms = new JPanel(new GridBagLayout()); 114 cadastrewms.setBorder(BorderFactory.createEmptyBorder(0, 0,0,0));129 cadastrewms.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); 115 130 116 131 // option to automatically set the source tag when uploading … … 128 143 // option to reverse the grey colors (to see texts background) 129 144 reversGrey.setSelected(Main.pref.getBoolean("cadastrewms.invertGrey", false)); 130 reversGrey.setToolTipText(tr("Invert the original black and white colors (and all intermediate greys). Useful for texts on dark backgrounds.")); 145 reversGrey.setToolTipText( 146 tr("Invert the original black and white colors (and all intermediate greys). Useful for texts on dark backgrounds.")); 131 147 cadastrewms.add(reversGrey, GBC.eop().insets(0, 0, 0, 0)); 132 148 133 149 // option to enable transparency 134 150 transparency.addActionListener(new ActionListener() { 151 @Override 135 152 public void actionPerformed(ActionEvent e) { 136 153 sliderTrans.setEnabled(transparency.isSelected()); … … 146 163 sliderTrans.setMajorTickSpacing(10); 147 164 sliderTrans.setMinorTickSpacing(1); 148 sliderTrans.setValue((int) (Float.parseFloat(Main.pref.get("cadastrewms.brightness", "1.0f"))*10));165 sliderTrans.setValue((int) (Float.parseFloat(Main.pref.get("cadastrewms.brightness", "1.0f"))*10)); 149 166 sliderTrans.setPaintTicks(true); 150 167 sliderTrans.setPaintLabels(false); … … 201 218 ButtonGroup bgGrabMultiplier = new ButtonGroup(); 202 219 ActionListener multiplierActionListener = new ActionListener() { 220 @Override 203 221 public void actionPerformed(ActionEvent actionEvent) { 204 222 AbstractButton button = (AbstractButton) actionEvent.getSource(); … … 208 226 grabMultiplier1.setIcon(ImageProvider.get("preferences", "unsel_box_1")); 209 227 grabMultiplier1.setSelectedIcon(ImageProvider.get("preferences", "sel_box_1")); 210 grabMultiplier1.addActionListener( 228 grabMultiplier1.addActionListener(multiplierActionListener); 211 229 grabMultiplier1.setToolTipText(tr("Grab one image full screen")); 212 230 grabMultiplier2.setIcon(ImageProvider.get("preferences", "unsel_box_2")); 213 231 grabMultiplier2.setSelectedIcon(ImageProvider.get("preferences", "sel_box_2")); 214 grabMultiplier2.addActionListener( 232 grabMultiplier2.addActionListener(multiplierActionListener); 215 233 grabMultiplier2.setToolTipText(tr("Grab smaller images (higher quality but use more memory)")); 216 234 grabMultiplier3.setIcon(ImageProvider.get("preferences", "unsel_box_3")); 217 235 grabMultiplier3.setSelectedIcon(ImageProvider.get("preferences", "sel_box_3")); 218 grabMultiplier3.addActionListener( 236 grabMultiplier3.addActionListener(multiplierActionListener); 219 237 grabMultiplier3.setToolTipText(tr("Grab smaller images (higher quality but use more memory)")); 220 238 grabMultiplier4.setIcon(ImageProvider.get("preferences", "unsel_box_4")); 221 239 grabMultiplier4.setSelectedIcon(ImageProvider.get("preferences", "sel_box_4")); 222 grabMultiplier4.addActionListener( 240 grabMultiplier4.addActionListener(multiplierActionListener); 223 241 grabMultiplier4.setToolTipText(tr("Fixed size square (default is 100m)")); 224 242 bgGrabMultiplier.add(grabMultiplier1); … … 321 339 // option to enable automatic caching 322 340 enableCache.addActionListener(new ActionListener() { 341 @Override 323 342 public void actionPerformed(ActionEvent e) { 324 343 jLabelCacheSize.setEnabled(enableCache.isSelected()); … … 356 375 cadastrewms.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL)); 357 376 JScrollPane scrollpane = new JScrollPane(cadastrewms); 358 scrollpane.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0));377 scrollpane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); 359 378 cadastrewmsMast.add(scrollpane, GBC.eol().fill(GBC.BOTH)); 360 379 } 361 380 381 @Override 362 382 public boolean ok() { 363 383 Main.pref.put("cadastrewms.source", sourcing.getText()); … … 366 386 Main.pref.put("cadastrewms.invertGrey", reversGrey.isSelected()); 367 387 Main.pref.put("cadastrewms.backgroundTransparent", transparency.isSelected()); 368 Main.pref.put("cadastrewms.brightness", Float.toString((float) sliderTrans.getValue()/10));388 Main.pref.put("cadastrewms.brightness", Float.toString((float) sliderTrans.getValue()/10)); 369 389 Main.pref.put("cadastrewms.drawBoundaries", drawBoundaries.isSelected()); 370 390 if (grabRes1.isSelected()) … … 392 412 if (squareSize >= 25 && squareSize <= 1000) 393 413 Main.pref.put("cadastrewms.squareSize", grabMultiplier4Size.getText()); 394 } catch (NumberFormatException e) { // ignore the last input 414 } catch (NumberFormatException e) { 415 Main.debug(e); 395 416 } 396 417 } … … 408 429 if (i > 0 && i < 13) 409 430 Main.pref.put("cadastrewms.rasterDivider", String.valueOf(i)); 410 } catch (NumberFormatException e) { // ignore the last input 431 } catch (NumberFormatException e) { 432 Main.debug(e); 411 433 } 412 434 Main.pref.put("cadastrewms.noImageCropping", disableImageCropping.isSelected()); … … 423 445 CacheControl.cacheSize = Integer.parseInt(cacheSize.getText()); 424 446 Main.pref.put("cadastrewms.cacheSize", String.valueOf(CacheControl.cacheSize)); 425 } catch (NumberFormatException e) { // ignore the last input 447 } catch (NumberFormatException e) { 448 Main.debug(e); 426 449 } 427 450 Main.pref.put("cadastrewms.autoFirstLayer", autoFirstLayer.isSelected());
Note:
See TracChangeset
for help on using the changeset viewer.