001// License: GPL. For details, see LICENSE file. 002package org.openstreetmap.josm.gui.layer; 003 004import org.openstreetmap.josm.gui.io.AbstractIOTask; 005import org.openstreetmap.josm.gui.io.AbstractUploadDialog; 006import org.openstreetmap.josm.gui.progress.ProgressMonitor; 007 008/** 009 * Interface for layers that can upload data. 010 * @since 9751 011 */ 012public interface UploadToServer { 013 014 /** 015 * Determines if the layer is able to upload data and implements the 016 * {@code UploadToServer} interface. A layer that implements the 017 * {@code UploadToServer} interface must return {@code true}. 018 * 019 * @return {@code true} if the layer is able to upload data; {@code false}, otherwise 020 */ 021 boolean isUploadable(); 022 023 /** 024 * Determines if the data managed by this layer needs to be uploaded to 025 * the server because it contains modified data. 026 * 027 * @return {@code true} if the data managed by this layer needs to be 028 * uploaded to the server because it contains modified data; 029 * {@code false}, otherwise 030 */ 031 boolean requiresUploadToServer(); 032 033 /** 034 * Determines if upload of data managed by this layer is discouraged. 035 * This feature allows to use "private" data layers. 036 * 037 * @return {@code true} if upload is discouraged for this layer; {@code false}, otherwise 038 */ 039 boolean isUploadDiscouraged(); 040 041 /** 042 * Initializes the layer after a successful upload to the server. 043 */ 044 void onPostUploadToServer(); 045 046 /** 047 * Creates a new {@code AbstractIOTask} for uploading data. 048 * @param monitor The progress monitor 049 * @return a new {@code AbstractIOTask} for uploading data, or {@code null} if not applicable 050 */ 051 AbstractIOTask createUploadTask(ProgressMonitor monitor); 052 053 /** 054 * Returns the upload dialog for this layer. 055 * @return the upload dialog for this layer, or {@code null} if not applicable 056 */ 057 AbstractUploadDialog getUploadDialog(); 058}