Changeset 29394 in osm for applications
- Timestamp:
- 2013-03-24T20:08:00+01:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/imagery_offset_db
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagery_offset_db/src/iodb/GetImageryOffsetAction.java
r29384 r29394 7 7 import java.net.*; 8 8 import java.util.*; 9 import javax.swing.Action; 10 import javax.swing.Icon; 9 11 import javax.swing.JOptionPane; 10 12 import org.openstreetmap.josm.Main; … … 15 17 import org.openstreetmap.josm.gui.layer.ImageryLayer; 16 18 import static org.openstreetmap.josm.tools.I18n.tr; 19 import org.openstreetmap.josm.tools.ImageProvider; 17 20 import org.openstreetmap.josm.tools.Shortcut; 18 21 … … 24 27 */ 25 28 public class GetImageryOffsetAction extends JosmAction { 29 private Icon iconOffsetOk; 30 private Icon iconOffsetBad; 26 31 27 32 /** 28 33 * Initialize the action. Sets "Ctrl+Alt+I" shortcut: the only shortcut in this plugin. 34 * Also registers itself with {@link ImageryOffsetWatcher}. 29 35 */ 30 36 public GetImageryOffsetAction() { … … 32 38 Shortcut.registerShortcut("imageryoffset:get", tr("Imagery: {0}", tr("Get Imagery Offset...")), 33 39 KeyEvent.VK_I, Shortcut.ALT_CTRL), true); 40 iconOffsetOk = ImageProvider.get("getoffset"); 41 iconOffsetBad = ImageProvider.get("getoffsetnow"); // todo: create icon 42 ImageryOffsetWatcher.getInstance().register(this); 34 43 } 35 44 … … 84 93 85 94 /** 95 * Update action icon based on an offset state. 96 */ 97 public void offsetStateChanged( boolean isOffsetGood ) { 98 putValue(Action.SMALL_ICON, isOffsetGood ? iconOffsetOk : iconOffsetBad); 99 } 100 101 /** 102 * Remove offset listener. 103 */ 104 @Override 105 public void destroy() { 106 ImageryOffsetWatcher.getInstance().unregister(this); 107 super.destroy(); 108 } 109 110 /** 86 111 * A task that downloads offsets for a given position and imagery layer, 87 112 * then parses resulting XML and calls 88 113 * {@link #showOffsetDialog(java.util.List)} on success. 89 114 */ 90 class DownloadOffsetsTask extends SimpleOffsetQueryTask {115 private class DownloadOffsetsTask extends SimpleOffsetQueryTask { 91 116 private ImageryLayer layer; 92 117 private List<ImageryOffsetBase> offsets; -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java
r29388 r29394 17 17 import org.openstreetmap.josm.gui.JosmUserIdentityManager; 18 18 import org.openstreetmap.josm.gui.MapView; 19 import org.openstreetmap.josm.gui.NavigatableComponent;20 19 import org.openstreetmap.josm.gui.layer.ImageryLayer; 21 20 import org.openstreetmap.josm.gui.layer.MapViewPaintable; … … 29 28 * @license WTFPL 30 29 */ 31 public class OffsetDialog extends JDialog implements ActionListener, NavigatableComponent.ZoomChangeListener, MapViewPaintable {30 public class OffsetDialog extends JDialog implements ActionListener, MapView.ZoomChangeListener, MapViewPaintable { 32 31 protected static final String PREF_CALIBRATION = "iodb.show.calibration"; 33 32 protected static final String PREF_DEPRECATED = "iodb.show.deprecated"; … … 55 54 setResizable(false); 56 55 this.offsets = offsets; 57 NavigatableComponent.addZoomChangeListener(this);58 56 59 57 // make this dialog close on "escape" … … 194 192 selectedOffset = null; 195 193 prepareDialog(); 194 MapView.addZoomChangeListener(this); 196 195 if( !MODAL ) { 197 196 Main.map.mapView.addTemporaryLayer(this); … … 218 217 || Main.pref.getBoolean("iodb.close.on.select", true); 219 218 if( closeDialog ) { 220 NavigatableComponent.removeZoomChangeListener(this);219 MapView.removeZoomChangeListener(this); 221 220 setVisible(false); 222 221 } -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialogButton.java
r29390 r29394 74 74 description = description.replace("<", "<").replace(">", ">"); 75 75 JLabel descriptionLabel = new JLabel("<html><div style=\"width: 300px;\">"+description+"</div></html>"); 76 Font descriptionFont = new Font(descriptionLabel.getFont().getName(), Font.BOLD, descriptionLabel.getFont().getSize() - 2);76 Font descriptionFont = new Font(descriptionLabel.getFont().getName(), Font.BOLD, descriptionLabel.getFont().getSize()); 77 77 descriptionLabel.setFont(descriptionFont); 78 78
Note:
See TracChangeset
for help on using the changeset viewer.