Changeset 138 in josm for src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java
- Timestamp:
- 2006-09-09T00:18:24+02:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java
r137 r138 24 24 import javax.swing.JRadioButton; 25 25 import javax.swing.JSeparator; 26 import javax.swing.SwingUtilities; 26 27 import javax.swing.filechooser.FileFilter; 27 28 28 29 import org.openstreetmap.josm.Main; 29 30 import org.openstreetmap.josm.actions.GpxExportAction; 31 import org.openstreetmap.josm.actions.RenameLayerAction; 30 32 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; 31 33 import org.openstreetmap.josm.data.coor.EastNorth; … … 37 39 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 38 40 import org.openstreetmap.josm.gui.MapView; 41 import org.openstreetmap.josm.gui.MapView.LayerChangeListener; 39 42 import org.openstreetmap.josm.gui.dialogs.LayerList; 40 43 import org.openstreetmap.josm.gui.dialogs.LayerListPopup; … … 71 74 ds.ways.add(w); 72 75 } 73 Main.main.addLayer(new OsmDataLayer(ds, tr("Data Layer"), true));76 Main.main.addLayer(new OsmDataLayer(ds, tr("Data Layer"), null)); 74 77 Main.main.removeLayer(RawGpsLayer.this); 75 78 } … … 92 95 public final Collection<Collection<GpsPoint>> data; 93 96 94 public RawGpsLayer(Collection<Collection<GpsPoint>> data, String name) { 97 public RawGpsLayer(Collection<Collection<GpsPoint>> data, String name, File associatedFile) { 95 98 super(name); 99 this.associatedFile = associatedFile; 96 100 this.data = data; 97 101 Main.pref.listener.add(this); 102 SwingUtilities.invokeLater(new Runnable(){ 103 public void run() { 104 Main.map.mapView.addLayerChangeListener(new LayerChangeListener(){ 105 public void activeLayerChange(Layer oldLayer, Layer newLayer) {} 106 public void layerAdded(Layer newLayer) {} 107 public void layerRemoved(Layer oldLayer) { 108 Main.pref.listener.remove(RawGpsLayer.this); 109 } 110 }); 111 } 112 }); 98 113 } 99 114 … … 142 157 for (Collection<GpsPoint> c : data) 143 158 points += c.size(); 144 returndata.size()+" "+trn("track", "tracks", data.size())159 String tool = data.size()+" "+trn("track", "tracks", data.size()) 145 160 +" "+points+" "+trn("point", "points", points); 161 if (associatedFile != null) 162 tool = "<html>"+tool+"<br>"+associatedFile.getPath()+"</html>"; 163 return tool; 146 164 } 147 165 … … 169 187 } 170 188 b.append("</html>"); 171 return "<html>"+tr("{0} consists of {1} track", "{0} consists of {1} tracks", data.size(), name, data.size())+" ("+trn("{0} point", "{0} points", points, points)+")<br>"+b.toString(); 189 return "<html>"+trn("{0} consists of {1} track", "{0} consists of {1} tracks", data.size(), name, data.size())+" ("+trn("{0} point", "{0} points", points, points)+")<br>"+b.toString(); 172 190 } 173 191 … … 257 275 } 258 276 }); 277 259 278 return new Component[]{ 260 279 new JMenuItem(new LayerList.ShowHideLayerAction(this)), … … 267 286 new JMenuItem(new ConvertToDataLayerAction()), 268 287 new JSeparator(), 288 new JMenuItem(new RenameLayerAction(associatedFile, this)), 289 new JSeparator(), 269 290 new JMenuItem(new LayerListPopup.InfoAction(this))}; 270 291 } … … 274 295 Main.map.repaint(); 275 296 } 276 277 @Override public void layerRemoved() {278 Main.pref.listener.remove(this);279 }280 297 }
Note:
See TracChangeset
for help on using the changeset viewer.
