source: josm/trunk/src/org/openstreetmap/josm/gui/layer/AbstractModifiableLayer.java@ 7937

Last change on this file since 7937 was 7937, checked in by bastiK, 9 years ago

add subversion property svn:eol=native

  • Property svn:eol-style set to native
File size: 2.8 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.layer;
3
4import org.openstreetmap.josm.gui.io.AbstractIOTask;
5import org.openstreetmap.josm.gui.io.AbstractUploadDialog;
6import org.openstreetmap.josm.gui.progress.ProgressMonitor;
7
8/**
9 * A modifiable layer.
10 * @since 7358
11 */
12public abstract class AbstractModifiableLayer extends Layer {
13
14 /**
15 * Constructs a new {@code ModifiableLayer}.
16 * @param name Layer name
17 */
18 public AbstractModifiableLayer(String name) {
19 super(name);
20 }
21
22 /**
23 * Determines if the data managed by this layer needs to be uploaded to
24 * the server because it contains modified data.
25 *
26 * @return true if the data managed by this layer needs to be uploaded to
27 * the server because it contains modified data; false, otherwise
28 */
29 public boolean requiresUploadToServer() {
30 // Override if needed
31 return false;
32 }
33
34 /**
35 * Determines if the data managed by this layer needs to be saved to
36 * a file. Only replies true if a file is assigned to this layer and
37 * if the data managed by this layer has been modified since the last
38 * save operation to the file.
39 *
40 * @return true if the data managed by this layer needs to be saved to a file
41 */
42 public boolean requiresSaveToFile() {
43 // Override if needed
44 return false;
45 }
46
47 /**
48 * Determines if upload of data managed by this layer is discouraged.
49 * This feature allows to use "private" data layers.
50 *
51 * @return true if upload is discouraged for this layer; false, otherwise
52 */
53 public boolean isUploadDiscouraged() {
54 // Override if needed
55 return false;
56 }
57
58 /**
59 * Determines if data managed by this layer has been modified.
60 * @return true if data has been modified; false, otherwise
61 */
62 public abstract boolean isModified();
63
64 /**
65 * Initializes the layer after a successful save of data to a file.
66 */
67 public void onPostSaveToFile() {
68 // Override if needed
69 }
70
71 /**
72 * Initializes the layer after a successful upload to the server.
73 */
74 public void onPostUploadToServer() {
75 // Override if needed
76 }
77
78 /**
79 * Creates a new {@code AbstractIOTask} for uploading data.
80 * @param monitor The progress monitor
81 * @return a new {@code AbstractIOTask} for uploading data, or {@code null} if not applicable
82 */
83 public AbstractIOTask createUploadTask(ProgressMonitor monitor) {
84 // Override if needed
85 return null;
86 }
87
88 /**
89 * Returns the upload dialog for this layer.
90 * @return the upload dialog for this layer, or {@code null} if not applicable
91 */
92 public AbstractUploadDialog getUploadDialog() {
93 // Override if needed
94 return null;
95 }
96}
Note: See TracBrowser for help on using the repository browser.