From 07ef277140afc0e52e0051482ac1e5d2b4c8e36b Mon Sep 17 00:00:00 2001
From: Robert Scott <code@humanleg.org.uk>
Date: Sun, 8 Oct 2017 10:17:07 +0100
Subject: [PATCH 3/3] SlippyMapBBoxChooser: maintain state of
showDownloadAreaButtonModel in property
---
src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java b/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java
index 93d4358..0bdc219 100644
a
|
b
|
import org.openstreetmap.josm.data.imagery.ImageryLayerInfo;
|
47 | 47 | import org.openstreetmap.josm.data.imagery.TMSCachedTileLoader; |
48 | 48 | import org.openstreetmap.josm.data.imagery.TileLoaderFactory; |
49 | 49 | import org.openstreetmap.josm.data.osm.BBox; |
| 50 | import org.openstreetmap.josm.data.preferences.BooleanProperty; |
50 | 51 | import org.openstreetmap.josm.data.preferences.StringProperty; |
51 | 52 | import org.openstreetmap.josm.gui.MainApplication; |
52 | 53 | import org.openstreetmap.josm.gui.layer.AbstractCachedTileSourceLayer; |
… |
… |
public class SlippyMapBBoxChooser extends JMapViewer implements BBoxChooser, Cha
|
124 | 125 | } |
125 | 126 | |
126 | 127 | private static final StringProperty PROP_MAPSTYLE = new StringProperty("slippy_map_chooser.mapstyle", "Mapnik"); |
| 128 | private static final BooleanProperty PROP_SHOWDLAREA = new BooleanProperty("slippy_map_chooser.show_downloaded_area", true); |
127 | 129 | /** |
128 | 130 | * The property name used for the resize button. |
129 | 131 | * @see #addPropertyChangeListener(java.beans.PropertyChangeListener) |
… |
… |
public class SlippyMapBBoxChooser extends JMapViewer implements BBoxChooser, Cha
|
134 | 136 | private final transient OsmTileLoader uncachedLoader; |
135 | 137 | |
136 | 138 | private final SizeButton iSizeButton; |
137 | | private final ButtonModel showDownloadAreaButtonModel = new JToggleButton.ToggleButtonModel(); |
| 139 | private final ButtonModel showDownloadAreaButtonModel; |
138 | 140 | private final SourceButton iSourceButton; |
139 | 141 | private transient Bounds bbox; |
140 | 142 | |
… |
… |
public class SlippyMapBBoxChooser extends JMapViewer implements BBoxChooser, Cha
|
177 | 179 | |
178 | 180 | List<TileSource> tileSources = getAllTileSources(); |
179 | 181 | |
| 182 | this.showDownloadAreaButtonModel = new JToggleButton.ToggleButtonModel(); |
| 183 | this.showDownloadAreaButtonModel.setSelected(PROP_SHOWDLAREA.get()); |
180 | 184 | this.showDownloadAreaButtonModel.addChangeListener(this); |
181 | 185 | iSourceButton = new SourceButton(this, tileSources, this.showDownloadAreaButtonModel); |
182 | 186 | add(iSourceButton); |
… |
… |
public class SlippyMapBBoxChooser extends JMapViewer implements BBoxChooser, Cha
|
281 | 285 | |
282 | 286 | @Override |
283 | 287 | public void stateChanged(ChangeEvent e) { |
| 288 | // fired for the stateChanged event of this.showDownloadAreaButtonModel |
| 289 | PROP_SHOWDLAREA.put(this.showDownloadAreaButtonModel.isSelected()); |
284 | 290 | this.repaint(); |
285 | 291 | } |
286 | 292 | |