- Timestamp:
- 2009-09-26T12:56:35+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapView.java
r2181 r2192 63 63 */ 64 64 public class MapView extends NavigatableComponent implements PropertyChangeListener { 65 66 65 67 66 /** … … 156 155 playHeadMarker = PlayHeadMarker.create(); 157 156 } 158 int pos = layers.size(); 159 while(pos > 0 && layers.get(pos-1).background) { 160 --pos; 161 } 162 layers.add(pos, layer); 157 158 if (layer.isBackgroundLayer() || layers.isEmpty()) { 159 layers.add(layer); 160 } else { 161 layers.add(0, layer); 162 } 163 163 164 164 for (Layer.LayerChangeListener l : Layer.listeners) { -
trunk/src/org/openstreetmap/josm/gui/layer/Layer.java
r2025 r2192 71 71 /** 72 72 * The layer should be handled as a background layer in automatic handling 73 */ 74 public boolean background = false; 73 * 74 */ 75 private boolean background = false; 75 76 76 77 /** … … 170 171 } 171 172 172 173 /** 174 * Replies true if this layer is a background layer 175 * 176 * @return true if this layer is a background layer 177 */ 178 public boolean isBackgroundLayer() { 179 return background; 180 } 181 182 /** 183 * Sets whether this layer is a background layer 184 * 185 * @param background true, if this layer is a background layer 186 */ 187 public void setBackgroundLayer(boolean background) { 188 this.background = background; 189 } 190 191 /** 192 * Sets the visibility of this layer. Emits property change event for 193 * property {@see #VISIBLE_PROP}. 194 * 195 * @param visible true, if the layer is visible; false, otherwise. 196 */ 197 public void setVisible(boolean visible) { 198 boolean oldValue = this.visible; 199 this.visible = visible; 200 if (oldValue != this.visible) { 201 fireVisibleChanged(oldValue, this.visible); 202 } 203 } 204 205 /** 206 * Replies true if this layer is visible. False, otherwise. 207 * @return true if this layer is visible. False, otherwise. 208 */ 209 public boolean isVisible() { 210 return visible; 211 } 212 213 /** 214 * Toggles the visibility state of this layer. 215 */ 216 public void toggleVisible() { 217 setVisible(!isVisible()); 218 } 219 220 /** 221 * Adds a {@see PropertyChangeListener} 222 * 223 * @param listener the listener 224 */ 225 public void addPropertyChangeListener(PropertyChangeListener listener) { 226 propertyChangeSupport.addPropertyChangeListener(listener); 227 } 228 229 /** 230 * Removes a {@see PropertyChangeListener} 231 * 232 * @param listener the listener 233 */ 234 public void removePropertyChangeListener(PropertyChangeListener listener) { 235 propertyChangeSupport.removePropertyChangeListener(listener); 236 } 237 238 /** 239 * fires a property change for the property {@see #VISIBLE_PROP} 240 * 241 * @param oldValue the old value 242 * @param newValue the new value 243 */ 244 protected void fireVisibleChanged(boolean oldValue, boolean newValue) { 245 propertyChangeSupport.firePropertyChange(VISIBLE_PROP, oldValue, newValue); 246 } 247 248 /** 249 * The action to save a layer 250 * 251 */ 173 252 public static class LayerSaveAction extends AbstractAction { 174 253 private Layer layer; … … 183 262 public void actionPerformed(ActionEvent e) { 184 263 new SaveAction().doSave(layer); 185 186 264 } 187 265 } … … 216 294 } 217 295 } 218 219 /**220 * Sets the visibility of this layer. Emits property change event for221 * property {@see #VISIBLE_PROP}.222 *223 * @param visible true, if the layer is visible; false, otherwise.224 */225 public void setVisible(boolean visible) {226 boolean oldValue = this.visible;227 this.visible = visible;228 if (oldValue != this.visible) {229 fireVisibleChanged(oldValue, this.visible);230 }231 }232 233 /**234 * Replies true if this layer is visible. False, otherwise.235 * @return true if this layer is visible. False, otherwise.236 */237 public boolean isVisible() {238 return visible;239 }240 241 /**242 * Toggles the visibility state of this layer.243 */244 public void toggleVisible() {245 setVisible(!isVisible());246 }247 248 /**249 * Adds a {@see PropertyChangeListener}250 *251 * @param listener the listener252 */253 public void addPropertyChangeListener(PropertyChangeListener listener) {254 propertyChangeSupport.addPropertyChangeListener(listener);255 }256 257 /**258 * Removes a {@see PropertyChangeListener}259 *260 * @param listener the listener261 */262 public void removePropertyChangeListener(PropertyChangeListener listener) {263 propertyChangeSupport.removePropertyChangeListener(listener);264 }265 266 /**267 * fires a property change for the property {@see #VISIBLE_PROP}268 *269 * @param oldValue the old value270 * @param newValue the new value271 */272 protected void fireVisibleChanged(boolean oldValue, boolean newValue) {273 propertyChangeSupport.firePropertyChange(VISIBLE_PROP, oldValue, newValue);274 }275 296 }
Note:
See TracChangeset
for help on using the changeset viewer.