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 | * @since 9751
|
---|
11 | */
|
---|
12 | public interface UploadToServer {
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Determines if the layer is able to upload data and implements the
|
---|
16 | * {@code UploadToServer} interface. A layer that implements the
|
---|
17 | * {@code UploadToServer} interface must return {@code true}.
|
---|
18 | *
|
---|
19 | * @return {@code true} if the layer is able to upload data; {@code false}, otherwise
|
---|
20 | */
|
---|
21 | boolean isUploadable();
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Determines if the data managed by this layer needs to be uploaded to
|
---|
25 | * the server because it contains modified data.
|
---|
26 | *
|
---|
27 | * @return {@code true} if the data managed by this layer needs to be
|
---|
28 | * uploaded to the server because it contains modified data;
|
---|
29 | * {@code false}, otherwise
|
---|
30 | */
|
---|
31 | boolean requiresUploadToServer();
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * Determines if upload of data managed by this layer is discouraged.
|
---|
35 | * This feature allows to use "private" data layers.
|
---|
36 | *
|
---|
37 | * @return {@code true} if upload is discouraged for this layer; {@code false}, otherwise
|
---|
38 | */
|
---|
39 | boolean isUploadDiscouraged();
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Initializes the layer after a successful upload to the server.
|
---|
43 | */
|
---|
44 | void onPostUploadToServer();
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * Creates a new {@code AbstractIOTask} for uploading data.
|
---|
48 | * @param monitor The progress monitor
|
---|
49 | * @return a new {@code AbstractIOTask} for uploading data, or {@code null} if not applicable
|
---|
50 | */
|
---|
51 | AbstractIOTask createUploadTask(ProgressMonitor monitor);
|
---|
52 |
|
---|
53 | /**
|
---|
54 | * Returns the upload dialog for this layer.
|
---|
55 | * @return the upload dialog for this layer, or {@code null} if not applicable
|
---|
56 | */
|
---|
57 | AbstractUploadDialog getUploadDialog();
|
---|
58 | }
|
---|