Changeset 5406 in josm
- Timestamp:
- 2012-08-08T01:25:25+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapView.java
r5384 r5406 29 29 30 30 import javax.swing.AbstractButton; 31 import javax.swing.ActionMap; 32 import javax.swing.InputMap; 31 33 import javax.swing.JOptionPane; 32 34 import javax.swing.JPanel; … … 56 58 57 59 /** 58 * This is a component used in the MapFramefor browsing the map. It use is to59 * provide the MapMode's enough capabilities to operate. 60 * This is a component used in the {@link MapFrame} for browsing the map. It use is to 61 * provide the MapMode's enough capabilities to operate.<br/><br/> 60 62 * 61 * MapView holdmeta-data about the data set currently displayed, as scale level,63 * {@code MapView} holds meta-data about the data set currently displayed, as scale level, 62 64 * center point viewed, what scrolling mode or editing mode is selected or with 63 * what projection the map is viewed etc.. 65 * what projection the map is viewed etc..<br/><br/> 64 66 * 65 * MapViewis able to administrate several layers.67 * {@code MapView} is able to administrate several layers. 66 68 * 67 69 * @author imi … … 70 72 71 73 /** 72 * Interface to notify listeners of the change of the active layer.74 * Interface to notify listeners of a layer change. 73 75 * @author imi 74 76 */ 75 77 public interface LayerChangeListener { 78 79 /** 80 * Notifies this listener that the active layer has changed. 81 * @param oldLayer The previous active layer 82 * @param newLayer The new activer layer 83 */ 76 84 void activeLayerChange(Layer oldLayer, Layer newLayer); 85 86 /** 87 * Notifies this listener that a layer has been added. 88 * @param newLayer The new added layer 89 */ 77 90 void layerAdded(Layer newLayer); 91 92 /** 93 * Notifies this listener that a layer has been removed. 94 * @param oldLayer The old removed layer 95 */ 78 96 void layerRemoved(Layer oldLayer); 79 97 } … … 131 149 } 132 150 151 /** 152 * Adds an edit layer change listener 153 * 154 * @param listener the listener. Ignored if null or already registered. 155 */ 133 156 public static void addEditLayerChangeListener(EditLayerChangeListener listener) { 134 157 if (listener != null) { … … 193 216 private Rectangle lastClipBounds = new Rectangle(); 194 217 218 /** 219 * Constructs a new {@code MapView}. 220 * @param contentPane The content pane used to register shortcuts in its {@link InputMap} and {@link ActionMap} 221 */ 195 222 public MapView(final JPanel contentPane) { 196 223 Main.pref.addPreferenceChangeListener(this); … … 269 296 * Add a layer to the current MapView. The layer will be added at topmost 270 297 * position. 298 * @param layer The layer to add 271 299 */ 272 300 public void addLayer(Layer layer) { … … 357 385 * Remove the layer from the mapview. If the layer was in the list before, 358 386 * an LayerChange event is fired. 387 * @param layer The layer to remove 359 388 */ 360 389 public void removeLayer(Layer layer) { … … 468 497 * Draw the component. 469 498 */ 470 @Override public synchronizedvoid paint(Graphics g) {499 @Override public void paint(Graphics g) { 471 500 if (BugReportExceptionHandler.exceptionHandlingInProgress()) 472 501 return; … … 486 515 } 487 516 488 boolean canUseBuffer = !paintPreferencesChanged && nonChangedLayers.size() <= nonChangedLayersCount && 517 boolean canUseBuffer; 518 519 synchronized (this) { 520 canUseBuffer = !paintPreferencesChanged; 521 } 522 canUseBuffer = canUseBuffer && nonChangedLayers.size() <= nonChangedLayersCount && 489 523 lastViewID == getViewID() && lastClipBounds.contains(g.getClipBounds()); 490 524 if (canUseBuffer) { … … 841 875 } 842 876 843 public synchronized void preferenceChanged(PreferenceChangeEvent e) { 844 paintPreferencesChanged = true; 877 @Override 878 public void preferenceChanged(PreferenceChangeEvent e) { 879 synchronized (this) { 880 paintPreferencesChanged = true; 881 } 845 882 } 846 883
Note:
See TracChangeset
for help on using the changeset viewer.