Changeset 7 in josm for src/org/openstreetmap/josm/actions/mapmode/MapMode.java
- Timestamp:
- 2005-10-02T20:32:00+02:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/actions/mapmode/MapMode.java
r4 r7 2 2 3 3 import java.awt.event.ActionEvent; 4 import java.awt.event.MouseEvent; 5 import java.awt.event.MouseListener; 6 import java.awt.event.MouseMotionListener; 4 7 5 8 import javax.swing.AbstractAction; 6 9 import javax.swing.ImageIcon; 10 import javax.swing.JComponent; 11 import javax.swing.KeyStroke; 7 12 13 import org.openstreetmap.josm.data.osm.DataSet; 8 14 import org.openstreetmap.josm.gui.MapFrame; 9 15 import org.openstreetmap.josm.gui.MapView; … … 17 23 * control. 18 24 */ 19 abstract public class MapMode extends AbstractAction { 25 abstract public class MapMode extends AbstractAction implements MouseListener, MouseMotionListener { 20 26 21 27 /** … … 23 29 */ 24 30 protected final MapFrame mapFrame; 31 /** 32 * Shortcut to the MapView. 33 */ 34 protected final MapView mv; 35 /** 36 * Shortcut to the DataSet. 37 */ 38 protected final DataSet ds; 25 39 26 40 /** … … 31 45 */ 32 46 public MapMode(String name, String iconName, String tooltip, int mnemonic, MapFrame mapFrame) { 33 super(name, new ImageIcon("images/"+iconName+".png")); 47 super(name, new ImageIcon("images/mapmode/"+iconName+".png")); 34 48 putValue(MNEMONIC_KEY, mnemonic); 49 putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(mnemonic,0)); 35 50 putValue(LONG_DESCRIPTION, tooltip); 51 mapFrame.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(mnemonic,0), this); 52 mapFrame.getActionMap().put(this, this); 36 53 this.mapFrame = mapFrame; 54 mv = mapFrame.mapView; 55 ds = mv.dataSet; 37 56 } 38 57 … … 41 60 * @param mapView The view, where the listener should be registered. 42 61 */ 43 abstract public void registerListener(MapView mapView); 62 public void registerListener() { 63 firePropertyChange("active", false, true); 64 } 44 65 45 66 /** … … 47 68 * @param mapView The view from which the listener should be deregistered. 48 69 */ 49 abstract public void unregisterListener(MapView mapView); 70 public void unregisterListener() { 71 firePropertyChange("active", true, false); 72 } 50 73 51 74 /** … … 55 78 mapFrame.selectMapMode(this); 56 79 } 80 81 /** 82 * Does nothing. Only to subclass. 83 */ 84 public void mouseClicked(MouseEvent e) {} 85 /** 86 * Does nothing. Only to subclass. 87 */ 88 public void mousePressed(MouseEvent e) {} 89 /** 90 * Does nothing. Only to subclass. 91 */ 92 public void mouseReleased(MouseEvent e) {} 93 /** 94 * Does nothing. Only to subclass. 95 */ 96 public void mouseEntered(MouseEvent e) {} 97 /** 98 * Does nothing. Only to subclass. 99 */ 100 public void mouseExited(MouseEvent e) {} 101 /** 102 * Does nothing. Only to subclass. 103 */ 104 public void mouseMoved(MouseEvent e) {} 105 /** 106 * Does nothing. Only to subclass. 107 */ 108 public void mouseDragged(MouseEvent e) {} 57 109 }
Note:
See TracChangeset
for help on using the changeset viewer.
