Changeset 12711 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2017-09-01T23:55:45+02:00 (7 years ago)
Author:
Don-vip
Message:

see #15141, see #15167 - use correct message ("Downloading data" instead of "Uploading data") when downloading data from Overpass API / POST

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/OsmServerReader.java

    r12620 r12711  
    174174                    .setFinishOnCloseOutput(false)
    175175                    .setReasonForRequest(reason)
     176                    .setOutputMessage(tr("Downloading data..."))
    176177                    .setRequestBody(requestBody);
    177178            activeConnection = client;
  • trunk/src/org/openstreetmap/josm/io/ProgressOutputStream.java

    r10302 r12711  
    3131     */
    3232    public ProgressOutputStream(OutputStream out, long size, ProgressMonitor progressMonitor, boolean finishOnClose) {
     33        this(out, size, progressMonitor, tr("Uploading data ..."), finishOnClose);
     34    }
     35
     36    /**
     37     * Constructs a new {@code ProgressOutputStream}.
     38     *
     39     * @param out the stream to monitor
     40     * @param size the total size which will be sent
     41     * @param progressMonitor the monitor to report to
     42     * @param message the message that will be displayed by the inner {@link StreamProgressUpdater}
     43     * @param finishOnClose whether to call {@link ProgressMonitor#finishTask} when this stream is closed
     44     * @since 12711
     45     */
     46    public ProgressOutputStream(OutputStream out, long size, ProgressMonitor progressMonitor, String message, boolean finishOnClose) {
    3347        this.updater = new StreamProgressUpdater(size,
    34                 progressMonitor != null ? progressMonitor : NullProgressMonitor.INSTANCE, tr("Uploading data ..."));
     48                progressMonitor != null ? progressMonitor : NullProgressMonitor.INSTANCE, message);
    3549        this.out = out;
    3650        this.finishOnClose = finishOnClose;
  • trunk/src/org/openstreetmap/josm/tools/HttpClient.java

    r12620 r12711  
    5353    private boolean useCache;
    5454    private String reasonForRequest;
     55    private String outputMessage = tr("Uploading data ...");
    5556    private HttpURLConnection connection; // to allow disconnecting before `response` is set
    5657    private Response response;
     
    115116            connection.setDoOutput(true);
    116117            try (OutputStream out = new BufferedOutputStream(
    117                     new ProgressOutputStream(connection.getOutputStream(), requestBody.length, progressMonitor, finishOnCloseOutput))) {
     118                    new ProgressOutputStream(connection.getOutputStream(), requestBody.length,
     119                            progressMonitor, outputMessage, finishOnCloseOutput))) {
    118120                out.write(requestBody);
    119121            }
     
    622624
    623625    /**
     626     * Sets the output message to be displayed in progress monitor for {@code PUT}, {@code POST} and {@code DELETE} methods.
     627     * Defaults to "Uploading data ..." (translated). Has no effect for {@code GET} or any other method.
     628     * @param outputMessage message to be displayed in progress monitor
     629     * @return {@code this}
     630     * @since 12711
     631     */
     632    public HttpClient setOutputMessage(String outputMessage) {
     633        this.outputMessage = outputMessage;
     634        return this;
     635    }
     636
     637    /**
    624638     * Sets whether the progress monitor task will be finished when the output stream is closed. This is {@code true} by default.
    625639     * @param finishOnCloseOutput whether the progress monitor task will be finished when the output stream is closed
Note: See TracChangeset for help on using the changeset viewer.