source: josm/trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java@ 3965

Last change on this file since 3965 was 3965, checked in by mjulius, 13 years ago

fix #6074 - Update failure
It is not an error if a primitive on the server is invisible while the local copy is not if the latter one is modified.
Catch DataIntegrityProblemException when merging.

  • Property svn:eol-style set to native
File size: 24.3 KB
Line 
1// License: GPL. See LICENSE file for details.
2
3package org.openstreetmap.josm.gui.layer;
4
5import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
6import static org.openstreetmap.josm.tools.I18n.marktr;
7import static org.openstreetmap.josm.tools.I18n.tr;
8import static org.openstreetmap.josm.tools.I18n.trn;
9
10import java.awt.AlphaComposite;
11import java.awt.Color;
12import java.awt.Composite;
13import java.awt.Graphics2D;
14import java.awt.GridBagLayout;
15import java.awt.Point;
16import java.awt.Rectangle;
17import java.awt.TexturePaint;
18import java.awt.event.ActionEvent;
19import java.awt.geom.Area;
20import java.awt.image.BufferedImage;
21import java.io.File;
22import java.util.ArrayList;
23import java.util.Collection;
24import java.util.HashMap;
25import java.util.HashSet;
26import java.util.List;
27import java.util.Map;
28
29import javax.swing.AbstractAction;
30import javax.swing.Action;
31import javax.swing.Icon;
32import javax.swing.JLabel;
33import javax.swing.JOptionPane;
34import javax.swing.JPanel;
35import javax.swing.JScrollPane;
36import javax.swing.JTextArea;
37
38import org.openstreetmap.josm.Main;
39import org.openstreetmap.josm.actions.RenameLayerAction;
40import org.openstreetmap.josm.data.Bounds;
41import org.openstreetmap.josm.data.SelectionChangedListener;
42import org.openstreetmap.josm.data.conflict.Conflict;
43import org.openstreetmap.josm.data.conflict.ConflictCollection;
44import org.openstreetmap.josm.data.coor.EastNorth;
45import org.openstreetmap.josm.data.coor.LatLon;
46import org.openstreetmap.josm.data.gpx.GpxData;
47import org.openstreetmap.josm.data.gpx.ImmutableGpxTrack;
48import org.openstreetmap.josm.data.gpx.WayPoint;
49import org.openstreetmap.josm.data.osm.DataIntegrityProblemException;
50import org.openstreetmap.josm.data.osm.DataSet;
51import org.openstreetmap.josm.data.osm.DataSetMerger;
52import org.openstreetmap.josm.data.osm.DataSource;
53import org.openstreetmap.josm.data.osm.DatasetConsistencyTest;
54import org.openstreetmap.josm.data.osm.Node;
55import org.openstreetmap.josm.data.osm.OsmPrimitive;
56import org.openstreetmap.josm.data.osm.Relation;
57import org.openstreetmap.josm.data.osm.Way;
58import org.openstreetmap.josm.data.osm.event.AbstractDatasetChangedEvent;
59import org.openstreetmap.josm.data.osm.event.DataSetListenerAdapter;
60import org.openstreetmap.josm.data.osm.event.DataSetListenerAdapter.Listener;
61import org.openstreetmap.josm.data.osm.visitor.AbstractVisitor;
62import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
63import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintVisitor;
64import org.openstreetmap.josm.data.osm.visitor.paint.PaintVisitor;
65import org.openstreetmap.josm.data.osm.visitor.paint.SimplePaintVisitor;
66import org.openstreetmap.josm.data.validation.TestError;
67import org.openstreetmap.josm.gui.HelpAwareOptionPane;
68import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;
69import org.openstreetmap.josm.gui.MapView;
70import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
71import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
72import org.openstreetmap.josm.tools.DateUtils;
73import org.openstreetmap.josm.tools.FilteredCollection;
74import org.openstreetmap.josm.tools.GBC;
75import org.openstreetmap.josm.tools.ImageProvider;
76
77/**
78 * A layer holding data from a specific dataset.
79 * The data can be fully edited.
80 *
81 * @author imi
82 */
83public class OsmDataLayer extends Layer implements Listener, SelectionChangedListener {
84 static public final String REQUIRES_SAVE_TO_DISK_PROP = OsmDataLayer.class.getName() + ".requiresSaveToDisk";
85 static public final String REQUIRES_UPLOAD_TO_SERVER_PROP = OsmDataLayer.class.getName() + ".requiresUploadToServer";
86
87 private boolean requiresSaveToFile = false;
88 private boolean requiresUploadToServer = false;
89 private boolean isChanged = true;
90 private int highlightUpdateCount;
91
92 public List<TestError> validationErrors = new ArrayList<TestError>();
93
94 protected void setRequiresSaveToFile(boolean newValue) {
95 boolean oldValue = requiresSaveToFile;
96 requiresSaveToFile = newValue;
97 if (oldValue != newValue) {
98 propertyChangeSupport.firePropertyChange(REQUIRES_SAVE_TO_DISK_PROP, oldValue, newValue);
99 }
100 }
101
102 protected void setRequiresUploadToServer(boolean newValue) {
103 boolean oldValue = requiresUploadToServer;
104 requiresUploadToServer = newValue;
105 if (oldValue != newValue) {
106 propertyChangeSupport.firePropertyChange(REQUIRES_UPLOAD_TO_SERVER_PROP, oldValue, newValue);
107 }
108 }
109
110 /** the global counter for created data layers */
111 static private int dataLayerCounter = 0;
112
113 /**
114 * Replies a new unique name for a data layer
115 *
116 * @return a new unique name for a data layer
117 */
118 static public String createNewName() {
119 dataLayerCounter++;
120 return tr("Data Layer {0}", dataLayerCounter);
121 }
122
123 public final static class DataCountVisitor extends AbstractVisitor {
124 public int nodes;
125 public int ways;
126 public int relations;
127 public int deletedNodes;
128 public int deletedWays;
129 public int deletedRelations;
130
131 public void visit(final Node n) {
132 nodes++;
133 if (n.isDeleted()) {
134 deletedNodes++;
135 }
136 }
137
138 public void visit(final Way w) {
139 ways++;
140 if (w.isDeleted()) {
141 deletedWays++;
142 }
143 }
144
145 public void visit(final Relation r) {
146 relations++;
147 if (r.isDeleted()) {
148 deletedRelations++;
149 }
150 }
151 }
152
153 public interface CommandQueueListener {
154 void commandChanged(int queueSize, int redoSize);
155 }
156
157 /**
158 * The data behind this layer.
159 */
160 public final DataSet data;
161
162 /**
163 * the collection of conflicts detected in this layer
164 */
165 private ConflictCollection conflicts;
166
167 /**
168 * a paint texture for non-downloaded area
169 */
170 private static TexturePaint hatched;
171
172 static {
173 createHatchTexture();
174 }
175
176 public static Color getBackgroundColor() {
177 return Main.pref.getColor(marktr("background"), Color.BLACK);
178 }
179
180 public static Color getOutsideColor() {
181 return Main.pref.getColor(marktr("outside downloaded area"), Color.YELLOW);
182 }
183
184 /**
185 * Initialize the hatch pattern used to paint the non-downloaded area
186 */
187 public static void createHatchTexture() {
188 BufferedImage bi = new BufferedImage(15, 15, BufferedImage.TYPE_INT_ARGB);
189 Graphics2D big = bi.createGraphics();
190 big.setColor(getBackgroundColor());
191 Composite comp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f);
192 big.setComposite(comp);
193 big.fillRect(0,0,15,15);
194 big.setColor(getOutsideColor());
195 big.drawLine(0,15,15,0);
196 Rectangle r = new Rectangle(0, 0, 15,15);
197 hatched = new TexturePaint(bi, r);
198 }
199
200 /**
201 * Construct a OsmDataLayer.
202 */
203 public OsmDataLayer(final DataSet data, final String name, final File associatedFile) {
204 super(name);
205 this.data = data;
206 this.setAssociatedFile(associatedFile);
207 conflicts = new ConflictCollection();
208 data.addDataSetListener(new DataSetListenerAdapter(this));
209 DataSet.addSelectionListener(this);
210 }
211
212 /**
213 * TODO: @return Return a dynamic drawn icon of the map data. The icon is
214 * updated by a background thread to not disturb the running programm.
215 */
216 @Override public Icon getIcon() {
217 return ImageProvider.get("layer", "osmdata_small");
218 }
219
220 /**
221 * Draw all primitives in this layer but do not draw modified ones (they
222 * are drawn by the edit layer).
223 * Draw nodes last to overlap the ways they belong to.
224 */
225 @Override public void paint(final Graphics2D g, final MapView mv, Bounds box) {
226 isChanged = false;
227 highlightUpdateCount = data.getHighlightUpdateCount();
228
229 boolean active = mv.getActiveLayer() == this;
230 boolean inactive = !active && Main.pref.getBoolean("draw.data.inactive_color", true);
231 boolean virtual = !inactive && mv.isVirtualNodesEnabled();
232
233 // draw the hatched area for non-downloaded region. only draw if we're the active
234 // and bounds are defined; don't draw for inactive layers or loaded GPX files etc
235 if (active && Main.pref.getBoolean("draw.data.downloaded_area", true) && !data.dataSources.isEmpty()) {
236 // initialize area with current viewport
237 Rectangle b = mv.getBounds();
238 // on some platforms viewport bounds seem to be offset from the left,
239 // over-grow it just to be sure
240 b.grow(100, 100);
241 Area a = new Area(b);
242
243 // now succesively subtract downloaded areas
244 for (DataSource src : data.dataSources) {
245 if (src.bounds != null && !src.bounds.getMin().equals(src.bounds.getMax())) {
246 EastNorth en1 = mv.getProjection().latlon2eastNorth(src.bounds.getMin());
247 EastNorth en2 = mv.getProjection().latlon2eastNorth(src.bounds.getMax());
248 Point p1 = mv.getPoint(en1);
249 Point p2 = mv.getPoint(en2);
250 Rectangle r = new Rectangle(Math.min(p1.x, p2.x),Math.min(p1.y, p2.y),Math.abs(p2.x-p1.x),Math.abs(p2.y-p1.y));
251 a.subtract(new Area(r));
252 }
253 }
254
255 // paint remainder
256 g.setPaint(hatched);
257 g.fill(a);
258 }
259
260 PaintVisitor painter;
261 if (Main.pref.getBoolean("draw.wireframe")) {
262 painter = new SimplePaintVisitor();
263 } else {
264 painter = new MapPaintVisitor();
265 }
266 painter.setGraphics(g);
267 painter.setNavigatableComponent(mv);
268 painter.setInactive(inactive);
269 painter.visitAll(data, virtual, box);
270 Main.map.conflictDialog.paintConflicts(g, mv);
271 }
272
273 @Override public String getToolTipText() {
274 int nodes = new FilteredCollection<Node>(data.getNodes(), OsmPrimitive.nonDeletedPredicate).size();
275 int ways = new FilteredCollection<Way>(data.getWays(), OsmPrimitive.nonDeletedPredicate).size();
276
277 String tool = trn("{0} node", "{0} nodes", nodes, nodes)+", ";
278 tool += trn("{0} way", "{0} ways", ways, ways);
279
280 if (data.getVersion() != null) {
281 tool += ", " + tr("version {0}", data.getVersion());
282 }
283 File f = getAssociatedFile();
284 if (f != null) {
285 tool = "<html>"+tool+"<br>"+f.getPath()+"</html>";
286 }
287 return tool;
288 }
289
290 @Override public void mergeFrom(final Layer from) {
291 mergeFrom(((OsmDataLayer)from).data);
292 }
293
294 /**
295 * merges the primitives in dataset <code>from</code> into the dataset of
296 * this layer
297 *
298 * @param from the source data set
299 */
300 public void mergeFrom(final DataSet from) {
301 final DataSetMerger visitor = new DataSetMerger(data,from);
302 try {
303 visitor.merge();
304 } catch (DataIntegrityProblemException e) {
305 JOptionPane.showMessageDialog(
306 Main.parent,
307 e.getMessage(),
308 tr("Error"),
309 JOptionPane.ERROR_MESSAGE
310 );
311 return;
312
313 }
314
315 Area a = data.getDataSourceArea();
316
317 // copy the merged layer's data source info;
318 // only add source rectangles if they are not contained in the
319 // layer already.
320 for (DataSource src : from.dataSources) {
321 if (a == null || !a.contains(src.bounds.asRect())) {
322 data.dataSources.add(src);
323 }
324 }
325
326 // copy the merged layer's API version, downgrade if required
327 if (data.getVersion() == null) {
328 data.setVersion(from.getVersion());
329 } else if ("0.5".equals(data.getVersion()) ^ "0.5".equals(from.getVersion())) {
330 System.err.println(tr("Warning: mixing 0.6 and 0.5 data results in version 0.5"));
331 data.setVersion("0.5");
332 }
333
334 int numNewConflicts = 0;
335 for (Conflict<?> c : visitor.getConflicts()) {
336 if (!conflicts.hasConflict(c)) {
337 numNewConflicts++;
338 conflicts.add(c);
339 }
340 }
341 // repaint to make sure new data is displayed properly.
342 Main.map.mapView.repaint();
343 warnNumNewConflicts(numNewConflicts);
344 }
345
346 /**
347 * Warns the user about the number of detected conflicts
348 *
349 * @param numNewConflicts the number of detected conflicts
350 */
351 protected void warnNumNewConflicts(int numNewConflicts) {
352 if (numNewConflicts == 0) return;
353
354 String msg1 = trn(
355 "There was {0} conflict detected.",
356 "There were {0} conflicts detected.",
357 numNewConflicts,
358 numNewConflicts
359 );
360
361 StringBuffer sb = new StringBuffer();
362 sb.append("<html>").append(msg1).append("</html>");
363 if (numNewConflicts > 0) {
364 ButtonSpec[] options = new ButtonSpec[] {
365 new ButtonSpec(
366 tr("OK"),
367 ImageProvider.get("ok"),
368 tr("Click to close this dialog and continue editing"),
369 null /* no specific help */
370 )
371 };
372 HelpAwareOptionPane.showOptionDialog(
373 Main.parent,
374 sb.toString(),
375 tr("Conflicts detected"),
376 JOptionPane.WARNING_MESSAGE,
377 null, /* no icon */
378 options,
379 options[0],
380 ht("/Concepts/Conflict#WarningAboutDetectedConflicts")
381 );
382 Main.map.conflictDialog.unfurlDialog();
383 Main.map.repaint();
384 }
385 }
386
387
388 @Override public boolean isMergable(final Layer other) {
389 return other instanceof OsmDataLayer;
390 }
391
392 @Override public void visitBoundingBox(final BoundingXYVisitor v) {
393 for (final Node n: data.getNodes()) {
394 if (n.isUsable()) {
395 v.visit(n);
396 }
397 }
398 }
399
400 /**
401 * Clean out the data behind the layer. This means clearing the redo/undo lists,
402 * really deleting all deleted objects and reset the modified flags. This should
403 * be done after an upload, even after a partial upload.
404 *
405 * @param processed A list of all objects that were actually uploaded.
406 * May be <code>null</code>, which means nothing has been uploaded
407 */
408 public void cleanupAfterUpload(final Collection<OsmPrimitive> processed) {
409 // return immediately if an upload attempt failed
410 if (processed == null || processed.isEmpty())
411 return;
412
413 Main.main.undoRedo.clean(this);
414
415 // if uploaded, clean the modified flags as well
416 data.cleanupDeletedPrimitives();
417 for (OsmPrimitive p: data.allPrimitives()) {
418 if (processed.contains(p)) {
419 p.setModified(false);
420 }
421 }
422 }
423
424
425 @Override public Object getInfoComponent() {
426 final DataCountVisitor counter = new DataCountVisitor();
427 for (final OsmPrimitive osm : data.allPrimitives()) {
428 osm.visit(counter);
429 }
430 final JPanel p = new JPanel(new GridBagLayout());
431
432 String nodeText = trn("{0} node", "{0} nodes", counter.nodes, counter.nodes);
433 if (counter.deletedNodes > 0) {
434 nodeText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedNodes, counter.deletedNodes)+")";
435 }
436
437 String wayText = trn("{0} way", "{0} ways", counter.ways, counter.ways);
438 if (counter.deletedWays > 0) {
439 wayText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedWays, counter.deletedWays)+")";
440 }
441
442 String relationText = trn("{0} relation", "{0} relations", counter.relations, counter.relations);
443 if (counter.deletedRelations > 0) {
444 relationText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedRelations, counter.deletedRelations)+")";
445 }
446
447 p.add(new JLabel(tr("{0} consists of:", getName())), GBC.eol());
448 p.add(new JLabel(nodeText, ImageProvider.get("data", "node"), JLabel.HORIZONTAL), GBC.eop().insets(15,0,0,0));
449 p.add(new JLabel(wayText, ImageProvider.get("data", "way"), JLabel.HORIZONTAL), GBC.eop().insets(15,0,0,0));
450 p.add(new JLabel(relationText, ImageProvider.get("data", "relation"), JLabel.HORIZONTAL), GBC.eop().insets(15,0,0,0));
451 p.add(new JLabel(tr("API version: {0}", (data.getVersion() != null) ? data.getVersion() : tr("unset"))));
452
453 return p;
454 }
455
456 @Override public Action[] getMenuEntries() {
457 if (Main.applet)
458 return new Action[]{
459 LayerListDialog.getInstance().createActivateLayerAction(this),
460 LayerListDialog.getInstance().createShowHideLayerAction(),
461 LayerListDialog.getInstance().createDeleteLayerAction(),
462 SeparatorLayerAction.INSTANCE,
463 LayerListDialog.getInstance().createMergeLayerAction(this),
464 SeparatorLayerAction.INSTANCE,
465 new RenameLayerAction(getAssociatedFile(), this),
466 new ConsistencyTestAction(),
467 SeparatorLayerAction.INSTANCE,
468 new LayerListPopup.InfoAction(this)};
469 return new Action[]{
470 LayerListDialog.getInstance().createActivateLayerAction(this),
471 LayerListDialog.getInstance().createShowHideLayerAction(),
472 LayerListDialog.getInstance().createDeleteLayerAction(),
473 SeparatorLayerAction.INSTANCE,
474 LayerListDialog.getInstance().createMergeLayerAction(this),
475 new LayerSaveAction(this),
476 new LayerSaveAsAction(this),
477 new LayerGpxExportAction(this),
478 new ConvertToGpxLayerAction(),
479 SeparatorLayerAction.INSTANCE,
480 new RenameLayerAction(getAssociatedFile(), this),
481 new ConsistencyTestAction(),
482 SeparatorLayerAction.INSTANCE,
483 new LayerListPopup.InfoAction(this)};
484 }
485
486 public static GpxData toGpxData(DataSet data, File file) {
487 GpxData gpxData = new GpxData();
488 gpxData.storageFile = file;
489 HashSet<Node> doneNodes = new HashSet<Node>();
490 for (Way w : data.getWays()) {
491 if (!w.isUsable()) {
492 continue;
493 }
494 Collection<Collection<WayPoint>> trk = new ArrayList<Collection<WayPoint>>();
495 Map<String, Object> trkAttr = new HashMap<String, Object>();
496
497 if (w.get("name") != null) {
498 trkAttr.put("name", w.get("name"));
499 }
500
501 List<WayPoint> trkseg = null;
502 for (Node n : w.getNodes()) {
503 if (!n.isUsable()) {
504 trkseg = null;
505 continue;
506 }
507 if (trkseg == null) {
508 trkseg = new ArrayList<WayPoint>();
509 trk.add(trkseg);
510 }
511 if (!n.isTagged()) {
512 doneNodes.add(n);
513 }
514 WayPoint wpt = new WayPoint(n.getCoor());
515 if (!n.isTimestampEmpty()) {
516 wpt.attr.put("time", DateUtils.fromDate(n.getTimestamp()));
517 wpt.setTime();
518 }
519 trkseg.add(wpt);
520 }
521
522 gpxData.tracks.add(new ImmutableGpxTrack(trk, trkAttr));
523 }
524
525 // what is this loop meant to do? it creates waypoints but never
526 // records them?
527 for (Node n : data.getNodes()) {
528 if (n.isIncomplete() || n.isDeleted() || doneNodes.contains(n)) {
529 continue;
530 }
531 WayPoint wpt = new WayPoint(n.getCoor());
532 if (!n.isTimestampEmpty()) {
533 wpt.attr.put("time", DateUtils.fromDate(n.getTimestamp()));
534 wpt.setTime();
535 }
536 String name = n.get("name");
537 if (name != null) {
538 wpt.attr.put("name", name);
539 }
540 }
541 return gpxData;
542 }
543
544 public GpxData toGpxData() {
545 return toGpxData(data, getAssociatedFile());
546 }
547
548 public class ConvertToGpxLayerAction extends AbstractAction {
549 public ConvertToGpxLayerAction() {
550 super(tr("Convert to GPX layer"), ImageProvider.get("converttogpx"));
551 }
552 public void actionPerformed(ActionEvent e) {
553 Main.main.addLayer(new GpxLayer(toGpxData(), tr("Converted from: {0}", getName())));
554 Main.main.removeLayer(OsmDataLayer.this);
555 }
556 }
557
558 public boolean containsPoint(LatLon coor) {
559 // we'll assume that if this has no data sources
560 // that it also has no borders
561 if (this.data.dataSources.isEmpty())
562 return true;
563
564 boolean layer_bounds_point = false;
565 for (DataSource src : this.data.dataSources) {
566 if (src.bounds.contains(coor)) {
567 layer_bounds_point = true;
568 break;
569 }
570 }
571 return layer_bounds_point;
572 }
573
574 /**
575 * replies the set of conflicts currently managed in this layer
576 *
577 * @return the set of conflicts currently managed in this layer
578 */
579 public ConflictCollection getConflicts() {
580 return conflicts;
581 }
582
583 /**
584 * Replies true if the data managed by this layer needs to be uploaded to
585 * the server because it contains at least one modified primitive.
586 *
587 * @return true if the data managed by this layer needs to be uploaded to
588 * the server because it contains at least one modified primitive; false,
589 * otherwise
590 */
591 public boolean requiresUploadToServer() {
592 return requiresUploadToServer;
593 }
594
595 /**
596 * Replies true if the data managed by this layer needs to be saved to
597 * a file. Only replies true if a file is assigned to this layer and
598 * if the data managed by this layer has been modified since the last
599 * save operation to the file.
600 *
601 * @return true if the data managed by this layer needs to be saved to
602 * a file
603 */
604 public boolean requiresSaveToFile() {
605 return getAssociatedFile() != null && requiresSaveToFile;
606 }
607
608 /**
609 * Initializes the layer after a successful load of OSM data from a file
610 *
611 */
612 public void onPostLoadFromFile() {
613 setRequiresSaveToFile(false);
614 setRequiresUploadToServer(data.isModified());
615 }
616
617 public void onPostDownloadFromServer() {
618 setRequiresSaveToFile(true);
619 setRequiresUploadToServer(data.isModified());
620 }
621
622 @Override
623 public boolean isChanged() {
624 return isChanged || highlightUpdateCount != data.getHighlightUpdateCount();
625 }
626
627 /**
628 * Initializes the layer after a successful save of OSM data to a file
629 *
630 */
631 public void onPostSaveToFile() {
632 setRequiresSaveToFile(false);
633 setRequiresUploadToServer(data.isModified());
634 }
635
636 /**
637 * Initializes the layer after a successful upload to the server
638 *
639 */
640 public void onPostUploadToServer() {
641 setRequiresUploadToServer(data.isModified());
642 // keep requiresSaveToDisk unchanged
643 }
644
645 private class ConsistencyTestAction extends AbstractAction {
646
647 public ConsistencyTestAction() {
648 super(tr("Dataset consistency test"));
649 }
650
651 public void actionPerformed(ActionEvent e) {
652 String result = DatasetConsistencyTest.runTests(data);
653 if (result.length() == 0) {
654 JOptionPane.showMessageDialog(Main.parent, tr("No problems found"));
655 } else {
656 JPanel p = new JPanel(new GridBagLayout());
657 p.add(new JLabel(tr("Following problems found:")), GBC.eol());
658 JTextArea info = new JTextArea(result, 20, 60);
659 info.setCaretPosition(0);
660 info.setEditable(false);
661 p.add(new JScrollPane(info), GBC.eop());
662
663 JOptionPane.showMessageDialog(Main.parent, p, tr("Warning"), JOptionPane.WARNING_MESSAGE);
664 }
665 }
666
667 }
668
669 @Override
670 public void destroy() {
671 DataSet.removeSelectionListener(this);
672 }
673
674 public void processDatasetEvent(AbstractDatasetChangedEvent event) {
675 isChanged = true;
676 setRequiresSaveToFile(true);
677 setRequiresUploadToServer(true);
678 }
679
680 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
681 isChanged = true;
682 }
683}
Note: See TracBrowser for help on using the repository browser.