1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.layer;
|
---|
3 |
|
---|
4 | import org.openstreetmap.josm.gui.io.AbstractIOTask;
|
---|
5 | import org.openstreetmap.josm.gui.io.AbstractUploadDialog;
|
---|
6 | import org.openstreetmap.josm.gui.progress.ProgressMonitor;
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * Interface for layers that can upload data.
|
---|
10 | * @see DownloadFromServer
|
---|
11 | * @since 9751
|
---|
12 | */
|
---|
13 | public interface UploadToServer {
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * Determines if the layer is able to upload data and implements the
|
---|
17 | * {@code UploadToServer} interface. A layer that implements the
|
---|
18 | * {@code UploadToServer} interface must return {@code true}.
|
---|
19 | *
|
---|
20 | * @return {@code true} if the layer is able to upload data; {@code false}, otherwise
|
---|
21 | */
|
---|
22 | boolean isUploadable();
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * Determines if the data managed by this layer needs to be uploaded to
|
---|
26 | * the server because it contains modified data.
|
---|
27 | *
|
---|
28 | * @return {@code true} if the data managed by this layer needs to be
|
---|
29 | * uploaded to the server because it contains modified data;
|
---|
30 | * {@code false}, otherwise
|
---|
31 | */
|
---|
32 | boolean requiresUploadToServer();
|
---|
33 |
|
---|
34 | /**
|
---|
35 | * Determines if upload of data managed by this layer is discouraged.
|
---|
36 | * This feature allows to use "private" data layers.
|
---|
37 | *
|
---|
38 | * @return {@code true} if upload is discouraged for this layer; {@code false}, otherwise
|
---|
39 | */
|
---|
40 | boolean isUploadDiscouraged();
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * Determines if upload of data managed by this layer is currently in progress.
|
---|
44 | *
|
---|
45 | * @return {@code true} if upload is in progress
|
---|
46 | * @since 13434
|
---|
47 | */
|
---|
48 | boolean isUploadInProgress();
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Initializes the layer after a successful upload to the server.
|
---|
52 | */
|
---|
53 | void onPostUploadToServer();
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * Creates a new {@code AbstractIOTask} for uploading data.
|
---|
57 | * @param monitor The progress monitor
|
---|
58 | * @return a new {@code AbstractIOTask} for uploading data, or {@code null} if not applicable
|
---|
59 | */
|
---|
60 | AbstractIOTask createUploadTask(ProgressMonitor monitor);
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * Returns the upload dialog for this layer.
|
---|
64 | * @return the upload dialog for this layer, or {@code null} if not applicable
|
---|
65 | */
|
---|
66 | AbstractUploadDialog getUploadDialog();
|
---|
67 | }
|
---|