1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.download;
|
---|
3 |
|
---|
4 | import javax.swing.JCheckBox;
|
---|
5 | import javax.swing.event.ChangeListener;
|
---|
6 |
|
---|
7 | import org.openstreetmap.josm.actions.downloadtasks.AbstractDownloadTask;
|
---|
8 | import org.openstreetmap.josm.actions.downloadtasks.DownloadTask;
|
---|
9 | import org.openstreetmap.josm.data.Bounds;
|
---|
10 | import org.openstreetmap.josm.data.preferences.BooleanProperty;
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * An interface to allow arbitrary download sources and types in the primary
|
---|
14 | * download window of JOSM
|
---|
15 | *
|
---|
16 | * @since 16503
|
---|
17 | */
|
---|
18 | public interface IDownloadSourceType {
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Returns the checkbox to be added to the UI.
|
---|
22 | * @return The checkbox to be added to the UI
|
---|
23 | */
|
---|
24 | default JCheckBox getCheckBox() {
|
---|
25 | return getCheckBox(null);
|
---|
26 | }
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Returns the checkbox to be added to the UI.
|
---|
30 | * @param checkboxChangeListener The listener for checkboxes (may be {@code null})
|
---|
31 | * @return The checkbox to be added to the UI
|
---|
32 | */
|
---|
33 | JCheckBox getCheckBox(ChangeListener checkboxChangeListener);
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * Returns the download task class which will be getting the data.
|
---|
37 | * @return The {@link DownloadTask} class which will be getting the data
|
---|
38 | */
|
---|
39 | Class<? extends AbstractDownloadTask<?>> getDownloadClass();
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Determines the last state of the download type.
|
---|
43 | * @return The boolean indicating the last state of the download type
|
---|
44 | */
|
---|
45 | default boolean isEnabled() {
|
---|
46 | return getBooleanProperty().get();
|
---|
47 | }
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * Returns the boolean property for this particular download type.
|
---|
51 | * @return The boolean property for this particular download type
|
---|
52 | */
|
---|
53 | BooleanProperty getBooleanProperty();
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * Check if the area is too large for the current IDownloadSourceType
|
---|
57 | *
|
---|
58 | * @param bound The bound that will be downloaded
|
---|
59 | * @return {@code true} if we definitely cannot download the area;
|
---|
60 | */
|
---|
61 | boolean isDownloadAreaTooLarge(Bounds bound);
|
---|
62 | }
|
---|