Changeset 30738 in osm for applications/editors/josm/plugins/imagery_offset_db
- Timestamp:
- 2014-10-19T01:27:04+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/imagery_offset_db/src/iodb
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetPlugin.java
r30737 r30738 1 1 package iodb; 2 2 3 import static org.openstreetmap.josm.tools.I18n.marktr; 4 3 5 import java.awt.event.KeyEvent; 4 import java.util.*; 6 import java.util.Collection; 7 import java.util.LinkedList; 8 5 9 import javax.swing.JMenu; 10 6 11 import org.openstreetmap.josm.Main; 7 12 import org.openstreetmap.josm.data.Version; 13 import org.openstreetmap.josm.gui.preferences.ToolbarPreferences; 8 14 import org.openstreetmap.josm.plugins.Plugin; 9 15 import org.openstreetmap.josm.plugins.PluginInformation; 10 import static org.openstreetmap.josm.tools.I18n.marktr;11 16 12 17 /** 13 18 * A plugin to request and store imagery offsets in the centralized database. 14 * 19 * 15 20 * @author Zverik 16 21 * @license WTFPL … … 19 24 private GetImageryOffsetAction getAction; 20 25 private StoreImageryOffsetAction storeAction; 21 26 22 27 /** 23 28 * Add both actions to their own menu. This creates … … 28 33 public ImageryOffsetPlugin( PluginInformation info ) { 29 34 super(info); 30 35 31 36 getAction = new GetImageryOffsetAction(); 32 37 storeAction = new StoreImageryOffsetAction(); 33 38 34 39 // before 5803 imagery menu was constantly regenerated, erasing extra items 35 40 // before 5729 it was regenerated only when the imagery list was modified (also bad) … … 43 48 // an ugly hack to add this plugin to the toolbar 44 49 if( Main.pref.getBoolean("iodb.modify.toolbar", true) ) { 45 Collection<String> toolbar = new LinkedList<>( Main.toolbar.getToolString());50 Collection<String> toolbar = new LinkedList<>(ToolbarPreferences.getToolString()); 46 51 if( !toolbar.contains("getoffset") ) { 47 52 toolbar.add("getoffset"); -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java
r30737 r30738 1 1 package iodb; 2 2 3 import java.awt.*; 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 5 import java.awt.BasicStroke; 6 import java.awt.Color; 7 import java.awt.Component; 8 import java.awt.FlowLayout; 9 import java.awt.Graphics2D; 10 import java.awt.GridLayout; 11 import java.awt.Point; 12 import java.awt.RenderingHints; 4 13 import java.awt.event.ActionEvent; 5 14 import java.awt.event.ActionListener; … … 8 17 import java.net.HttpURLConnection; 9 18 import java.net.URL; 10 import java.util.*; 19 import java.util.ArrayList; 20 import java.util.Date; 11 21 import java.util.List; 12 import javax.swing.*; 22 23 import javax.swing.AbstractAction; 24 import javax.swing.Box; 25 import javax.swing.BoxLayout; 26 import javax.swing.JButton; 27 import javax.swing.JCheckBox; 28 import javax.swing.JComponent; 29 import javax.swing.JDialog; 30 import javax.swing.JOptionPane; 31 import javax.swing.JPanel; 32 import javax.swing.JPopupMenu; 33 import javax.swing.KeyStroke; 13 34 import javax.swing.border.CompoundBorder; 14 35 import javax.swing.border.EmptyBorder; 36 15 37 import org.openstreetmap.josm.Main; 16 38 import org.openstreetmap.josm.data.Bounds; … … 19 41 import org.openstreetmap.josm.gui.layer.ImageryLayer; 20 42 import org.openstreetmap.josm.gui.layer.MapViewPaintable; 21 import org.openstreetmap.josm.tools.*; 22 import static org.openstreetmap.josm.tools.I18n.tr; 43 import org.openstreetmap.josm.tools.ImageProvider; 44 import org.openstreetmap.josm.tools.LanguageInfo; 45 import org.openstreetmap.josm.tools.OpenBrowser; 46 import org.openstreetmap.josm.tools.Utils; 23 47 24 48 /** 25 49 * The dialog which presents a choice between imagery align options. 26 * 50 * 27 51 * @author Zverik 28 52 * @license WTFPL … … 31 55 protected static final String PREF_CALIBRATION = "iodb.show.calibration"; 32 56 protected static final String PREF_DEPRECATED = "iodb.show.deprecated"; 33 private static final int MAX_OFFSETS = Main. main.pref.getInteger("iodb.max.offsets", 4);57 private static final int MAX_OFFSETS = Main.pref.getInteger("iodb.max.offsets", 4); 34 58 35 59 /** … … 45 69 46 70 /** 47 * Initialize the dialog and install listeners. 71 * Initialize the dialog and install listeners. 48 72 * @param offsets The list of offset to choose from. 49 73 */ … … 60 84 JComponent.WHEN_IN_FOCUSED_WINDOW); 61 85 } 62 86 63 87 /** 64 88 * Creates the GUI. … … 69 93 calibrationBox.setSelected(Main.pref.getBoolean(PREF_CALIBRATION, true)); 70 94 calibrationBox.addActionListener(new ActionListener() { 71 public void actionPerformed( ActionEvent e ) { 95 @Override 96 public void actionPerformed( ActionEvent e ) { 72 97 Main.pref.put(PREF_CALIBRATION, calibrationBox.isSelected()); 73 98 updateButtonPanel(); … … 77 102 deprecatedBox.setSelected(Main.pref.getBoolean(PREF_DEPRECATED, false)); 78 103 deprecatedBox.addActionListener(new ActionListener() { 79 public void actionPerformed( ActionEvent e ) { 104 @Override 105 public void actionPerformed( ActionEvent e ) { 80 106 Main.pref.put(PREF_DEPRECATED, deprecatedBox.isSelected()); 81 107 updateButtonPanel(); … … 154 180 * It does nothing, only passes the event to all displayed offset buttons. 155 181 */ 156 public void zoomChanged() { 182 @Override 183 public void zoomChanged() { 157 184 for( Component c : buttonPanel.getComponents() ) { 158 185 if( c instanceof OffsetDialogButton ) { … … 166 193 * value, but looks nice. 167 194 */ 168 public void paint( Graphics2D g, MapView mv, Bounds bbox ) { 195 @Override 196 public void paint( Graphics2D g, MapView mv, Bounds bbox ) { 169 197 if( offsets == null ) 170 198 return; … … 181 209 } 182 210 } 183 211 184 212 /** 185 213 * Display the dialog and get the return value is case of a modal frame. … … 208 236 * @see #applyOffset() 209 237 */ 210 public void actionPerformed( ActionEvent e ) { 238 @Override 239 public void actionPerformed( ActionEvent e ) { 211 240 if( e.getSource() instanceof OffsetDialogButton ) { 212 241 selectedOffset = ((OffsetDialogButton)e.getSource()).getOffset(); … … 283 312 * Remove the deprecated offset from the offsets list. Then rebuild the button panel. 284 313 */ 285 public void queryPassed() { 314 @Override 315 public void queryPassed() { 286 316 offset.setDeprecated(new Date(), JosmUserIdentityManager.getInstance().getUserName(), ""); 287 317 updateButtonPanel(); … … 299 329 } 300 330 301 public void actionPerformed( ActionEvent e ) { 331 @Override 332 public void actionPerformed( ActionEvent e ) { 302 333 String base = Main.pref.get("url.openstreetmap-wiki", "http://wiki.openstreetmap.org/wiki/"); 303 334 String lang = LanguageInfo.getWikiLanguagePrefix(); -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/StoreImageryOffsetAction.java
r30737 r30738 117 117 query.append(key).append('=').append(URLEncoder.encode(params.get(key), "UTF8")); 118 118 } 119 Main. main.worker.submit(new SimpleOffsetQueryTask(query.toString(), tr("Uploading a new offset...")));119 Main.worker.submit(new SimpleOffsetQueryTask(query.toString(), tr("Uploading a new offset..."))); 120 120 } catch( UnsupportedEncodingException ex ) { 121 121 // WTF
Note:
See TracChangeset
for help on using the changeset viewer.