- Timestamp:
- 2016-09-07T01:23:17+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r10962 r10972 69 69 import org.openstreetmap.josm.data.projection.ProjectionChangeListener; 70 70 import org.openstreetmap.josm.data.validation.OsmValidator; 71 import org.openstreetmap.josm.gui.GettingStarted;72 71 import org.openstreetmap.josm.gui.MainFrame; 73 72 import org.openstreetmap.josm.gui.MainMenu; … … 81 80 import org.openstreetmap.josm.gui.layer.Layer; 82 81 import org.openstreetmap.josm.gui.layer.MainLayerManager; 83 import org.openstreetmap.josm.gui.layer.OsmDataLayer;84 82 import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener; 85 83 import org.openstreetmap.josm.gui.preferences.ToolbarPreferences; … … 90 88 import org.openstreetmap.josm.gui.progress.ProgressMonitorExecutor; 91 89 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; 92 import org.openstreetmap.josm.gui.util.GuiHelper;93 90 import org.openstreetmap.josm.gui.util.RedirectInputMap; 94 91 import org.openstreetmap.josm.io.FileWatcher; … … 208 205 public static final FileWatcher fileWatcher = new FileWatcher(); 209 206 210 /**211 * The MOTD Layer.212 * @deprecated Do not access this. It will be removed soon. You should not need to access the GettingStarted panel.213 */214 @Deprecated215 public final GettingStarted gettingStarted = mainPanel.getGettingStarted();216 217 207 protected static final Map<String, Throwable> NETWORK_ERRORS = new HashMap<>(); 218 208 … … 467 457 */ 468 458 public static volatile PlatformHook platform; 469 470 /**471 * Set or clear (if passed <code>null</code>) the map.472 * <p>473 * To be removed any time474 * @param map The map to set {@link Main#map} to. Can be null.475 * @deprecated This is done automatically by {@link MainPanel}476 */477 @Deprecated478 public final void setMapFrame(final MapFrame map) {479 Main.warn("setMapFrame call was ignored.");480 }481 482 /**483 * Remove the specified layer from the map. If it is the last layer,484 * remove the map as well.485 * <p>486 * To be removed end of 2016487 * @param layer The layer to remove488 * @deprecated You can remove the layer using {@link #getLayerManager()}489 */490 @Deprecated491 public final synchronized void removeLayer(final Layer layer) {492 if (map != null) {493 getLayerManager().removeLayer(layer);494 }495 }496 459 497 460 private static volatile InitStatusListener initListener; … … 627 590 * 628 591 * If no map exists, create one. 629 * <p>630 * To be removed end of 2016631 *632 * @param layer the layer633 *634 * @see #addLayer(Layer, ProjectionBounds)635 * @see #addLayer(Layer, ViewportData)636 * @deprecated You can add the layer to the layer manager: {@link #getLayerManager()}637 */638 @Deprecated639 public final void addLayer(final Layer layer) {640 addLayer(layer, (ViewportData) null);641 }642 643 /**644 * Add a new layer to the map.645 *646 * If no map exists, create one.647 592 * 648 593 * @param layer the layer … … 668 613 Main.map.mapView.scheduleZoomTo(viewport); 669 614 } 670 }671 672 /**673 * Creates the map frame. Call only in EDT Thread.674 * <p>675 * To be removed any time676 * @param firstLayer The first layer that was added.677 * @param viewportData The initial viewport. Can be <code>null</code> to be automatically computed.678 * @deprecated Not supported. MainPanel does this automatically.679 */680 @Deprecated681 public synchronized void createMapFrame(Layer firstLayer, ViewportData viewportData) {682 GuiHelper.assertCallFromEdt();683 Main.error("createMapFrame() not supported any more.");684 }685 686 /**687 * Replies <code>true</code> if there is an edit layer688 * <p>689 * To be removed end of 2016690 *691 * @return <code>true</code> if there is an edit layer692 * @deprecated You can get the edit layer using the layer manager and then check if it is not null: {@link #getLayerManager()}693 */694 @Deprecated695 public boolean hasEditLayer() {696 if (getEditLayer() == null) return false;697 return true;698 }699 700 /**701 * Replies the current edit layer702 * <p>703 * To be removed end of 2016704 *705 * @return the current edit layer. <code>null</code>, if no current edit layer exists706 * @deprecated You can get the edit layer using the layer manager: {@link #getLayerManager()}707 */708 @Deprecated709 public OsmDataLayer getEditLayer() {710 return getLayerManager().getEditLayer();711 }712 713 /**714 * Replies the current data set.715 * <p>716 * To be removed end of 2016717 *718 * @return the current data set. <code>null</code>, if no current data set exists719 * @deprecated You can get the data set using the layer manager: {@link #getLayerManager()}720 */721 @Deprecated722 public DataSet getCurrentDataSet() {723 return getLayerManager().getEditDataSet();724 615 } 725 616 … … 741 632 return ds.getSelected(); 742 633 } 743 }744 745 /**746 * Returns the currently active layer747 * <p>748 * To be removed end of 2016749 *750 * @return the currently active layer. <code>null</code>, if currently no active layer exists751 * @deprecated You can get the layer using the layer manager: {@link #getLayerManager()}752 */753 @Deprecated754 public Layer getActiveLayer() {755 return getLayerManager().getActiveLayer();756 634 } 757 635 -
trunk/src/org/openstreetmap/josm/actions/JosmAction.java
r10601 r10972 23 23 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent; 24 24 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener; 25 import org.openstreetmap.josm.gui.layer.OsmDataLayer;26 25 import org.openstreetmap.josm.gui.progress.PleaseWaitProgressMonitor; 27 26 import org.openstreetmap.josm.tools.Destroyable; … … 38 37 * a layer change event or a selection change event it invokes {@link #updateEnabledState()}. 39 38 * Subclasses can override {@link #updateEnabledState()} in order to update the {@link #isEnabled()}-state 40 * of a JosmAction depending on the {@link #getCurrentDataSet()} and the current layers 41 * (see also {@link #getEditLayer()}). 39 * of a JosmAction depending on the {@link #getLayerManager()} state. 42 40 * 43 41 * destroy() from interface Destroyable is called e.g. for MapModes, when the last layer has … … 270 268 } 271 269 272 /**273 * Replies the current edit layer274 *275 * @return the current edit layer. null, if no edit layer exists276 * @deprecated Use {@link #getLayerManager()}.getEditLayer() instead. To be removed in end of 2016.277 */278 @Deprecated279 public static OsmDataLayer getEditLayer() {280 return Main.getLayerManager().getEditLayer();281 }282 283 /**284 * Replies the current dataset.285 *286 * @return the current dataset. null, if no current dataset exists287 * @deprecated Use {@link #getLayerManager()}.getEditDataSet() instead. To be removed in end of 2016.288 */289 @Deprecated290 public static DataSet getCurrentDataSet() {291 return Main.getLayerManager().getEditDataSet();292 }293 294 270 protected static void waitFuture(final Future<?> future, final PleaseWaitProgressMonitor monitor) { 295 271 Main.worker.submit(() -> { -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r10891 r10972 94 94 * @author imi 95 95 */ 96 public final class DataSet implements Data, Cloneable,ProjectionChangeListener {96 public final class DataSet implements Data, ProjectionChangeListener { 97 97 98 98 /** … … 919 919 fireSelectionChanged(); 920 920 } 921 }922 923 /**924 * Return a copy of this dataset925 * @deprecated Use the copy constructor instead. Remove in July 2016926 */927 @Deprecated928 @Override929 public DataSet clone() {930 return new DataSet(this);931 921 } 932 922 -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r10896 r10972 19 19 import java.util.Objects; 20 20 import java.util.Set; 21 import java.util.function.Predicate;22 21 23 22 import org.openstreetmap.josm.Main; … … 196 195 return ret; 197 196 } 198 199 /**200 * A predicate that filters primitives that are usable.201 * @see OsmPrimitive#isUsable()202 * @deprecated Use {@code OsmPrimitive::isUsable} instead203 */204 @Deprecated205 public static final Predicate<OsmPrimitive> isUsablePredicate = OsmPrimitive::isUsable;206 207 /**208 * A predicate filtering primitives that are selectable.209 * @deprecated Use {@code OsmPrimitive::isSelectable} instead210 */211 @Deprecated212 public static final Predicate<OsmPrimitive> isSelectablePredicate = OsmPrimitive::isSelectable;213 214 /**215 * A predicate filtering primitives that are not deleted.216 * @deprecated Use {@code p -> !p.isDeleted()} instead217 */218 @Deprecated219 public static final Predicate<OsmPrimitive> nonDeletedPredicate = p -> !p.isDeleted();220 221 /**222 * A predicate filtering primitives that are not deleted and not incomplete.223 * @deprecated use lambda instead224 */225 @Deprecated226 public static final Predicate<OsmPrimitive> nonDeletedCompletePredicate =227 primitive -> !primitive.isDeleted() && !primitive.isIncomplete();228 229 /**230 * A predicate filtering primitives that are not deleted and not incomplete and that are not a relation.231 * @deprecated use lambda instead232 */233 @Deprecated234 public static final Predicate<OsmPrimitive> nonDeletedPhysicalPredicate =235 primitive -> !primitive.isDeleted() && !primitive.isIncomplete() && !(primitive instanceof Relation);236 237 /**238 * A predicate filtering primitives that are modified239 * @deprecated Use {@code OsmPrimitive::isModified} instead240 */241 @Deprecated242 public static final Predicate<OsmPrimitive> modifiedPredicate = OsmPrimitive::isModified;243 244 /**245 * A predicate filtering nodes.246 * @deprecated Use {@code Node.class::isInstance} instead247 */248 @Deprecated249 public static final Predicate<OsmPrimitive> nodePredicate = Node.class::isInstance;250 251 /**252 * A predicate filtering ways.253 * @deprecated Use {@code Way.class::isInstance} instead254 */255 @Deprecated256 public static final Predicate<OsmPrimitive> wayPredicate = Way.class::isInstance;257 258 /**259 * A predicate filtering relations.260 * @deprecated Use {@code Relation.class::isInstance} instead261 */262 @Deprecated263 public static final Predicate<OsmPrimitive> relationPredicate = Relation.class::isInstance;264 265 /**266 * A predicate filtering multipolygon relations.267 * @deprecated Use {@code OsmPrimitive::isMultipolygon} instead268 */269 @Deprecated270 public static final Predicate<OsmPrimitive> multipolygonPredicate = OsmPrimitive::isMultipolygon;271 272 /**273 * This matches all ways that have a direction274 *275 * @see #FLAG_HAS_DIRECTIONS276 * @deprecated use {@code directionKeys::match}277 */278 @Deprecated279 public static final Predicate<Tag> directionalKeyPredicate = directionKeys::match;280 197 281 198 /** -
trunk/src/org/openstreetmap/josm/data/osm/TagCollection.java
r10736 r10972 324 324 325 325 /** 326 * Replies true if this tag collection contains at least one tag with key <code>key</code>.327 *328 * @param key the key to look up329 * @return true if this tag collection contains at least one tag with key <code>key</code>; false, otherwise330 * @deprecated Use {@link #hasTagsFor(String)} instead.331 */332 @Deprecated333 public boolean containsKey(String key) {334 return generateStreamForKey(key).findAny().isPresent();335 }336 337 /**338 326 * Replies true if this tag collection contains all tags in <code>tags</code>. Replies 339 327 * false, if tags is null. -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r10965 r10972 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui; 3 4 import static org.openstreetmap.josm.tools.I18n.tr;5 3 6 4 import java.awt.AlphaComposite; … … 23 21 import java.util.ArrayList; 24 22 import java.util.Arrays; 25 import java.util.Collection;26 23 import java.util.Collections; 27 24 import java.util.HashMap; … … 59 56 import org.openstreetmap.josm.gui.layer.LayerManager; 60 57 import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent; 58 import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener; 61 59 import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent; 62 60 import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent; 63 61 import org.openstreetmap.josm.gui.layer.MainLayerManager; 64 62 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent; 65 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;66 63 import org.openstreetmap.josm.gui.layer.MapViewGraphics; 67 64 import org.openstreetmap.josm.gui.layer.MapViewPaintable; … … 93 90 implements PropertyChangeListener, PreferenceChangedListener, 94 91 LayerManager.LayerChangeListener, MainLayerManager.ActiveLayerChangeListener { 95 /**96 * Interface to notify listeners of a layer change.97 * <p>98 * To be removed: end of 2016.99 * @deprecated Use {@link org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener} instead.100 * @author imi101 */102 @Deprecated103 public interface LayerChangeListener {104 105 /**106 * Notifies this listener that the active layer has changed.107 * @param oldLayer The previous active layer108 * @param newLayer The new activer layer109 */110 void activeLayerChange(Layer oldLayer, Layer newLayer);111 112 /**113 * Notifies this listener that a layer has been added.114 * @param newLayer The new added layer115 */116 void layerAdded(Layer newLayer);117 118 /**119 * Notifies this listener that a layer has been removed.120 * @param oldLayer The old removed layer121 */122 void layerRemoved(Layer oldLayer);123 }124 125 /**126 * An interface that needs to be implemented in order to listen for changes to the active edit layer.127 * <p>128 * To be removed: end of 2016.129 * @deprecated Use {@link ActiveLayerChangeListener} instead.130 */131 @Deprecated132 @FunctionalInterface133 public interface EditLayerChangeListener {134 135 /**136 * Called after the active edit layer was changed.137 * @param oldLayer The old edit layer138 * @param newLayer The current (new) edit layer139 */140 void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer);141 }142 92 143 93 /** … … 211 161 212 162 /** 213 * This class is an adapter for the old layer change interface.214 * @author Michael Zangl215 * @since 10271216 * @deprecated New implementations should use {@link org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener}217 */218 @Deprecated219 protected static class LayerChangeAdapter implements ActiveLayerChangeListener, LayerManager.LayerChangeListener {220 221 private final LayerChangeListener wrapped;222 private boolean receiveOneInitialFire;223 224 public LayerChangeAdapter(LayerChangeListener wrapped) {225 this.wrapped = wrapped;226 }227 228 public LayerChangeAdapter(LayerChangeListener wrapped, boolean initialFire) {229 this(wrapped);230 this.receiveOneInitialFire = initialFire;231 }232 233 @Override234 public void layerAdded(LayerAddEvent e) {235 wrapped.layerAdded(e.getAddedLayer());236 }237 238 @Override239 public void layerRemoving(LayerRemoveEvent e) {240 wrapped.layerRemoved(e.getRemovedLayer());241 }242 243 @Override244 public void layerOrderChanged(LayerOrderChangeEvent e) {245 // not in old API246 }247 248 @Override249 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) {250 Layer oldActive = receiveOneInitialFire ? null : e.getPreviousActiveLayer();251 Layer newActive = e.getSource().getActiveLayer();252 if (oldActive != newActive) {253 wrapped.activeLayerChange(oldActive, newActive);254 }255 receiveOneInitialFire = false;256 }257 258 @Override259 public int hashCode() {260 final int prime = 31;261 int result = 1;262 result = prime * result + ((wrapped == null) ? 0 : wrapped.hashCode());263 return result;264 }265 266 @Override267 public boolean equals(Object obj) {268 if (this == obj)269 return true;270 if (obj == null)271 return false;272 if (getClass() != obj.getClass())273 return false;274 LayerChangeAdapter other = (LayerChangeAdapter) obj;275 if (wrapped == null) {276 if (other.wrapped != null)277 return false;278 } else if (!wrapped.equals(other.wrapped))279 return false;280 return true;281 }282 283 @Override284 public String toString() {285 return "LayerChangeAdapter [wrapped=" + wrapped + ']';286 }287 }288 289 /**290 * This class is an adapter for the old layer change interface.291 * @author Michael Zangl292 * @since 10271293 * @deprecated New implementations should use {@link org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener}294 */295 @Deprecated296 protected static class EditLayerChangeAdapter implements ActiveLayerChangeListener {297 298 private final EditLayerChangeListener wrapped;299 300 public EditLayerChangeAdapter(EditLayerChangeListener wrapped) {301 this.wrapped = wrapped;302 }303 304 @Override305 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) {306 OsmDataLayer oldLayer = e.getPreviousEditLayer();307 OsmDataLayer newLayer = e.getSource().getEditLayer();308 if (oldLayer != newLayer) {309 wrapped.editLayerChanged(oldLayer, newLayer);310 }311 }312 313 @Override314 public int hashCode() {315 final int prime = 31;316 int result = 1;317 result = prime * result + ((wrapped == null) ? 0 : wrapped.hashCode());318 return result;319 }320 321 @Override322 public boolean equals(Object obj) {323 if (this == obj)324 return true;325 if (obj == null)326 return false;327 if (getClass() != obj.getClass())328 return false;329 EditLayerChangeAdapter other = (EditLayerChangeAdapter) obj;330 if (wrapped == null) {331 if (other.wrapped != null)332 return false;333 } else if (!wrapped.equals(other.wrapped))334 return false;335 return true;336 }337 338 @Override339 public String toString() {340 return "EditLayerChangeAdapter [wrapped=" + wrapped + ']';341 }342 }343 344 /**345 163 * A layer painter that issues a warning when being called. 346 164 * @author Michael Zangl … … 368 186 } 369 187 } 370 371 /**372 * Removes a layer change listener373 * <p>374 * To be removed: end of 2016.375 *376 * @param listener the listener. Ignored if null or not registered.377 * @deprecated You should register the listener on {@link Main#getLayerManager()} instead.378 */379 @Deprecated380 public static void removeLayerChangeListener(LayerChangeListener listener) {381 LayerChangeAdapter adapter = new LayerChangeAdapter(listener);382 try {383 Main.getLayerManager().removeLayerChangeListener(adapter);384 } catch (IllegalArgumentException e) {385 // Ignored in old implementation386 Main.debug(e);387 }388 try {389 Main.getLayerManager().removeActiveLayerChangeListener(adapter);390 } catch (IllegalArgumentException e) {391 // Ignored in old implementation392 Main.debug(e);393 }394 }395 396 /**397 * Removes an edit layer change listener398 * <p>399 * To be removed: end of 2016.400 *401 * @param listener the listener. Ignored if null or not registered.402 * @deprecated You should register the listener on {@link Main#getLayerManager()} instead.403 */404 @Deprecated405 public static void removeEditLayerChangeListener(EditLayerChangeListener listener) {406 try {407 Main.getLayerManager().removeActiveLayerChangeListener(new EditLayerChangeAdapter(listener));408 } catch (IllegalArgumentException e) {409 // Ignored in old implementation410 Main.debug(e);411 }412 }413 414 /**415 * Adds a layer change listener416 * <p>417 * To be removed: end of 2016.418 *419 * @param listener the listener. Ignored if null or already registered.420 * @deprecated You should register the listener on {@link Main#getLayerManager()} instead.421 */422 @Deprecated423 public static void addLayerChangeListener(LayerChangeListener listener) {424 if (fireDeprecatedListenerOnAdd) {425 Main.warn("Plugin seems to be adding listener during mapFrameInitialized(): " + BugReport.getCallingMethod(2)426 + ". Layer listeners should be set on plugin load.");427 }428 addLayerChangeListener(listener, fireDeprecatedListenerOnAdd);429 }430 431 /**432 * Adds a layer change listener433 * <p>434 * To be removed: end of 2016.435 *436 * @param listener the listener. Ignored if null or already registered.437 * @param initialFire fire an active-layer-changed-event right after adding438 * the listener in case there is a layer present (should be)439 * @deprecated You should register the listener on {@link Main#getLayerManager()} instead.440 */441 @Deprecated442 public static void addLayerChangeListener(LayerChangeListener listener, boolean initialFire) {443 if (listener != null) {444 boolean doInitialFire = initialFire && (Main.isDisplayingMapView() || fireDeprecatedListenerOnAdd);445 446 LayerChangeAdapter adapter = new LayerChangeAdapter(listener, doInitialFire);447 Main.getLayerManager().addLayerChangeListener(adapter, doInitialFire);448 if (doInitialFire) {449 Main.getLayerManager().addAndFireActiveLayerChangeListener(adapter);450 } else {451 Main.getLayerManager().addActiveLayerChangeListener(adapter);452 }453 adapter.receiveOneInitialFire = false;454 }455 }456 457 /**458 * Adds an edit layer change listener459 * <p>460 * To be removed: end of 2016.461 *462 * @param listener the listener. Ignored if null or already registered.463 * @param initialFire fire an edit-layer-changed-event right after adding464 * the listener in case there is an edit layer present465 * @deprecated You should register the listener on {@link Main#getLayerManager()} instead.466 */467 @Deprecated468 public static void addEditLayerChangeListener(EditLayerChangeListener listener, boolean initialFire) {469 if (listener != null) {470 boolean doFire = initialFire && Main.isDisplayingMapView() && Main.getLayerManager().getEditLayer() != null;471 if (doFire) {472 Main.getLayerManager().addAndFireActiveLayerChangeListener(new EditLayerChangeAdapter(listener));473 } else {474 Main.getLayerManager().addActiveLayerChangeListener(new EditLayerChangeAdapter(listener));475 }476 }477 }478 479 /**480 * Adds an edit layer change listener481 * <p>482 * To be removed: end of 2016.483 *484 * @param listener the listener. Ignored if null or already registered.485 * @deprecated You should register the listener on {@link Main#getLayerManager()} instead.486 */487 @Deprecated488 public static void addEditLayerChangeListener(EditLayerChangeListener listener) {489 addEditLayerChangeListener(listener, false);490 }491 492 188 493 189 /** … … 630 326 oldSize = getSize(); 631 327 oldLoc = getLocationOnScreen(); 632 }633 634 /**635 * Add a layer to the current MapView.636 * <p>637 * To be removed: end of 2016.638 * @param layer The layer to add639 * @deprecated Use {@link Main#getLayerManager()}.addLayer() instead.640 */641 @Deprecated642 public void addLayer(Layer layer) {643 layerManager.addLayer(layer);644 328 } 645 329 … … 675 359 676 360 /** 677 * Returns current data set. To be removed: end of 2016.678 * @deprecated Use {@link #getLayerManager()}.getEditDataSet() instead.679 */680 @Override681 @Deprecated682 protected DataSet getCurrentDataSet() {683 return layerManager.getEditDataSet();684 }685 686 /**687 361 * Replies true if the active data layer (edit layer) is drawable. 688 362 * … … 701 375 OsmDataLayer e = layerManager.getEditLayer(); 702 376 return e != null && e.isVisible(); 703 }704 705 /**706 * Determines the next active data layer according to the following rules:707 * <ul>708 * <li>if there is at least one {@link OsmDataLayer} the first one709 * becomes active</li>710 * <li>otherwise, the top most layer of any type becomes active</li>711 * </ul>712 * To be removed: end of 2016.713 * @param layersList lit of layers714 *715 * @return the next active data layer716 * @deprecated now handled by {@link MainLayerManager}717 */718 @Deprecated719 protected Layer determineNextActiveLayer(List<Layer> layersList) {720 // First look for data layer721 for (Layer layer:layersList) {722 if (layer instanceof OsmDataLayer)723 return layer;724 }725 726 // Then any layer727 if (!layersList.isEmpty())728 return layersList.get(0);729 730 // and then give up731 return null;732 }733 734 /**735 * Remove the layer from the mapview. If the layer was in the list before,736 * an LayerChange event is fired.737 * <p>738 * To be removed: end of 2016.739 * @param layer The layer to remove740 * @deprecated Use {@link Main#getLayerManager()}.removeLayer() instead.741 */742 @Deprecated743 public void removeLayer(Layer layer) {744 layerManager.removeLayer(layer);745 377 } 746 378 … … 797 429 AudioPlayer.reset(); 798 430 repaint(); 799 }800 801 /**802 * Gets the index of the layer in the layer list.803 * <p>804 * To be removed: end of 2016.805 * @param layer The layer to search for.806 * @return The index in the list.807 * @throws IllegalArgumentException if that layer does not belong to this view.808 * @deprecated Access the layer list using {@link Main#getLayerManager()} instead.809 */810 @Deprecated811 public int getLayerPos(Layer layer) {812 int curLayerPos = layerManager.getLayers().indexOf(layer);813 if (curLayerPos == -1)814 throw new IllegalArgumentException(tr("Layer not in list."));815 return curLayerPos;816 }817 818 /**819 * Creates a list of the visible layers in Z-Order, the layer with the lowest Z-Order820 * first, layer with the highest Z-Order last.821 * <p>822 * The active data layer is pulled above all adjacent data layers.823 * <p>824 * To be removed: end of 2016.825 *826 * @return a list of the visible in Z-Order, the layer with the lowest Z-Order827 * first, layer with the highest Z-Order last.828 * @deprecated Access the layer list using {@link Main#getLayerManager()} instead.829 */830 @Deprecated831 public List<Layer> getVisibleLayersInZOrder() {832 return layerManager.getVisibleLayersInZOrder();833 431 } 834 432 … … 1049 647 } 1050 648 1051 /**1052 * Returns all layers. To be removed: end of 2016.1053 *1054 * @return An unmodifiable collection of all layers1055 * @deprecated Use {@link LayerManager#getLayers()} instead.1056 */1057 @Deprecated1058 public Collection<Layer> getAllLayers() {1059 return layerManager.getLayers();1060 }1061 1062 /**1063 * Returns all layers as list. To be removed: end of 2016.1064 *1065 * @return An unmodifiable ordered list of all layers1066 * @deprecated Use {@link LayerManager#getLayers()} instead.1067 */1068 @Deprecated1069 public List<Layer> getAllLayersAsList() {1070 return layerManager.getLayers();1071 }1072 1073 /**1074 * Replies an unmodifiable list of layers of a certain type. To be removed: end of 2016.1075 *1076 * Example:1077 * <pre>1078 * List<WMSLayer> wmsLayers = getLayersOfType(WMSLayer.class);1079 * </pre>1080 *1081 * @param <T> layer type1082 *1083 * @param ofType The layer type.1084 * @return an unmodifiable list of layers of a certain type.1085 * @deprecated Use {@link LayerManager#getLayersOfType(Class)} instead.1086 */1087 @Deprecated1088 public <T extends Layer> List<T> getLayersOfType(Class<T> ofType) {1089 return layerManager.getLayersOfType(ofType);1090 }1091 1092 /**1093 * Replies the number of layers managed by this map view. To be removed: end of 2016.1094 * <p>1095 *1096 * @return the number of layers managed by this map view1097 * @deprecated Use {@link Main#getLayerManager()}.getLayers().size() instead.1098 */1099 @Deprecated1100 public int getNumLayers() {1101 return getAllLayers().size();1102 }1103 1104 /**1105 * Replies true if there is at least one layer in this map view1106 * <p>1107 *1108 * @return true if there is at least one layer in this map view1109 * @deprecated Use !{@link Main#getLayerManager()}.getLayers().isEmpty() instead.1110 */1111 @Deprecated1112 public boolean hasLayers() {1113 return getNumLayers() > 0;1114 }1115 1116 /**1117 * Sets the active layer to <code>layer</code>. If <code>layer</code> is an instance1118 * of {@link OsmDataLayer} also sets editLayer to <code>layer</code>.1119 * <p>1120 *1121 * @param layer the layer to be activate; must be one of the layers in the list of layers1122 * @throws IllegalArgumentException if layer is not in the list of layers1123 * @deprecated Use !{@link Main#getLayerManager()}.setActiveLayer() instead.1124 */1125 @Deprecated1126 public void setActiveLayer(Layer layer) {1127 layerManager.setActiveLayer(layer);1128 }1129 1130 /**1131 * Replies the currently active layer1132 * <p>1133 *1134 * @return the currently active layer (may be null)1135 * @deprecated Use !{@link Main#getLayerManager()}.getActiveLayer() instead.1136 */1137 @Deprecated1138 public Layer getActiveLayer() {1139 return layerManager.getActiveLayer();1140 }1141 1142 649 @Override 1143 650 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) { … … 1164 671 1165 672 /** 1166 * Replies the current edit layer, if any1167 * <p>1168 *1169 * @return the current edit layer. May be null.1170 * @deprecated Use !{@link Main#getLayerManager()}.getEditLayer() instead. To be made private: end of 2016.1171 */1172 @Deprecated1173 public OsmDataLayer getEditLayer() {1174 return layerManager.getEditLayer();1175 }1176 1177 /**1178 * replies true if the list of layers managed by this map view contain layer1179 * <p>1180 *1181 * @param layer the layer1182 * @return true if the list of layers managed by this map view contain layer1183 * @deprecated Use !{@link Main#getLayerManager()}.containsLayer() instead.1184 */1185 @Deprecated1186 public boolean hasLayer(Layer layer) {1187 return layerManager.containsLayer(layer);1188 }1189 1190 /**1191 673 * Adds a new temporary layer. 1192 674 * <p> … … 1241 723 invalidatedListener.invalidate(l); 1242 724 } 1243 }1244 }1245 1246 /**1247 * Sets the title of the JOSM main window, adding a star if there are dirty layers.1248 * @see Main#parent1249 * @deprecated Replaced by {@link MainFrame#refreshTitle()}. The {@link MainFrame} should handle this by itself.1250 */1251 @Deprecated1252 protected void refreshTitle() {1253 if (Main.parent != null) {1254 ((MainFrame) Main.parent).refreshTitle();1255 725 } 1256 726 } -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r10965 r10972 304 304 } 305 305 306 /**307 * Returns current data set. To be removed: end of 2016.308 * @return current data set309 * @deprecated Use {@link Main#getLayerManager()}.getEditDataSet() instead.310 */311 @Deprecated312 protected DataSet getCurrentDataSet() {313 return Main.getLayerManager().getEditDataSet();314 }315 316 306 protected void updateLocationState() { 317 307 if (isVisibleOnScreen()) { -
trunk/src/org/openstreetmap/josm/gui/layer/Layer.java
r10959 r10972 182 182 183 183 /** 184 * Return a Color for this layer. Return null when no color specified.185 * @param ignoreCustom Custom color should return null, as no default color186 * is used. When this is true, then even for custom coloring the base187 * color is returned - mainly for layer internal use.188 * @return layer color189 * @deprecated Use the new {@link #getColorProperty()}. To be removed end of 2016.190 */191 @Deprecated192 public Color getColor(boolean ignoreCustom) {193 return null;194 }195 196 /**197 184 * Gets the color property to use for this layer. 198 185 * @return The color property. … … 619 606 620 607 /** 621 * @return bytes that the tile will use. Needed for resource management622 * @deprecated Not used any more.623 */624 @Deprecated625 protected long estimateMemoryUsage() {626 return 0;627 }628 629 /**630 608 * Gets the strategy that specifies where this layer should be inserted in a layer list. 631 609 * @return That strategy. -
trunk/src/org/openstreetmap/josm/gui/layer/MainLayerManager.java
r10653 r10972 149 149 private final List<ActiveLayerChangeListener> activeLayerChangeListeners = new CopyOnWriteArrayList<>(); 150 150 private final List<LayerAvailabilityListener> layerAvailabilityListeners = new CopyOnWriteArrayList<>(); 151 152 /**153 * Adds a active/edit layer change listener154 *155 * @param listener the listener.156 * @param initialFire use {@link #addAndFireActiveLayerChangeListener(ActiveLayerChangeListener)} instead.157 * @deprecated Do not use the second parameter. To be removed in a few weeks.158 */159 @Deprecated160 public synchronized void addActiveLayerChangeListener(ActiveLayerChangeListener listener, boolean initialFire) {161 if (initialFire) {162 addAndFireActiveLayerChangeListener(listener);163 } else {164 addActiveLayerChangeListener(listener);165 }166 }167 151 168 152 /** -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r10959 r10972 280 280 * 281 281 * @param listener the listener. Ignored if null or already registered. 282 * @since 5519283 * @deprecated Method name contains a typo, use {@link #removeLayerStateChangeListener(LayerStateChangeListener)}.284 */285 @Deprecated286 public void removeLayerPropertyChangeListener(LayerStateChangeListener listener) {287 removeLayerStateChangeListener(listener);288 }289 290 /**291 * Removes a layer state change listener292 *293 * @param listener the listener. Ignored if null or already registered.294 282 * @since 10340 295 283 */ -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r10931 r10972 8 8 import java.awt.Color; 9 9 import java.awt.Font; 10 import java.awt.datatransfer.Clipboard;11 import java.awt.datatransfer.Transferable;12 10 import java.awt.font.FontRenderContext; 13 11 import java.awt.font.GlyphVector; … … 54 52 import java.util.regex.Matcher; 55 53 import java.util.regex.Pattern; 56 import java.util.stream.Stream;57 54 import java.util.zip.GZIPInputStream; 58 55 import java.util.zip.ZipEntry; … … 69 66 import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream; 70 67 import org.openstreetmap.josm.Main; 71 import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;72 68 import org.w3c.dom.Document; 73 69 import org.xml.sax.InputSource; … … 99 95 private Utils() { 100 96 // Hide default constructor for utils classes 101 }102 103 /**104 * Tests whether {@code predicate} applies to at least one element from {@code collection}.105 * <p>106 * @param <T> type of items107 * @param collection the collection108 * @param predicate the predicate109 * @return {@code true} if {@code predicate} applies to at least one element from {@code collection}110 * @deprecated use {@link Stream#anyMatch(Predicate)} instead.111 */112 @Deprecated113 public static <T> boolean exists(Iterable<? extends T> collection, Predicate<? super T> predicate) {114 for (T item : collection) {115 if (predicate.test(item)) {116 return true;117 }118 }119 return false;120 }121 122 /**123 * Tests whether {@code predicate} applies to all elements from {@code collection}.124 * <p>125 * @param <T> type of items126 * @param collection the collection127 * @param predicate the predicate128 * @return {@code true} if {@code predicate} applies to all elements from {@code collection}129 * @deprecated use {@link Stream#allMatch(Predicate)} instead.130 */131 @Deprecated132 public static <T> boolean forAll(Iterable<? extends T> collection, Predicate<? super T> predicate) {133 return !exists(collection, predicate.negate());134 97 } 135 98 … … 580 543 } 581 544 return true; 582 }583 584 /**585 * Copies the string {@code s} to system clipboard.586 * @param s string to be copied to clipboard.587 * @return true if succeeded, false otherwise.588 * @deprecated Use {@link ClipboardUtils#copyString(String)}. To be removed end of 2016.589 */590 @Deprecated591 public static boolean copyToClipboard(String s) {592 return ClipboardUtils.copyString(s);593 }594 595 /**596 * Extracts clipboard content as {@code Transferable} object.597 * @param clipboard clipboard from which contents are retrieved598 * @return clipboard contents if available, {@code null} otherwise.599 * @since 8429600 * @deprecated Use {@link ClipboardUtils#getClipboardContent(Clipboard)} instead. To be removed end of 2016.601 */602 @Deprecated603 public static Transferable getTransferableContent(Clipboard clipboard) {604 return ClipboardUtils.getClipboardContent(clipboard);605 }606 607 /**608 * Extracts clipboard content as string.609 * @return string clipboard contents if available, {@code null} otherwise.610 * @deprecated Use {@link ClipboardUtils#getClipboardStringContent()}. To be removed end of 2016611 */612 @Deprecated613 public static String getClipboardContent() {614 return ClipboardUtils.getClipboardStringContent();615 545 } 616 546
Note:
See TracChangeset
for help on using the changeset viewer.