source: josm/trunk/src/org/openstreetmap/josm/gui/download/TileSelection.java@ 13724

Last change on this file since 13724 was 9606, checked in by Don-vip, 8 years ago

add more unit tests

  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.download;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.beans.PropertyChangeEvent;
7import java.beans.PropertyChangeListener;
8
9import org.openstreetmap.josm.data.Bounds;
10import org.openstreetmap.josm.gui.bbox.BBoxChooser;
11import org.openstreetmap.josm.gui.bbox.TileSelectionBBoxChooser;
12
13/**
14 * Tile selector.
15 *
16 * Provides a tile coordinate input field.
17 *
18 * @author Frederik Ramm
19 *
20 */
21public class TileSelection implements DownloadSelection, PropertyChangeListener {
22 private TileSelectionBBoxChooser chooser;
23 private DownloadDialog parent;
24
25 protected final void build() {
26 chooser = new TileSelectionBBoxChooser();
27 chooser.addPropertyChangeListener(this);
28 }
29
30 /**
31 * Constructs a new {@code TileSelection}.
32 */
33 public TileSelection() {
34 build();
35 }
36
37 @Override
38 public void addGui(final DownloadDialog gui) {
39 if (gui != null)
40 gui.addDownloadAreaSelector(chooser, tr("Tile Numbers"));
41 parent = gui;
42 }
43
44 @Override
45 public void setDownloadArea(Bounds area) {
46 chooser.setBoundingBox(area);
47 }
48
49 @Override
50 public void propertyChange(PropertyChangeEvent evt) {
51 if (evt.getPropertyName().equals(BBoxChooser.BBOX_PROP)) {
52 Bounds bbox = (Bounds) evt.getNewValue();
53 parent.boundingBoxChanged(bbox, this);
54 }
55 }
56}
Note: See TracBrowser for help on using the repository browser.