Ignore:
Timestamp:
2016-04-09T16:08:55+02:00 (8 years ago)
Author:
Don-vip
Message:

refactor and move changeset download tasks to actions.downloadtasks package

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/AbstractDownloadTask.java

    r9067 r10124  
    88
    99/**
    10  * Common abstract implementation of other download tasks
     10 * Common abstract implementation of other download tasks.
    1111 * @param <T> The downloaded data type
    1212 * @since 2322
     
    1818    protected T downloadedData;
    1919
     20    /**
     21     * Constructs a new {@code AbstractDownloadTask}.
     22     */
    2023    public AbstractDownloadTask() {
    2124        errorMessages = new ArrayList<>();
    2225    }
    2326
     27    /**
     28     * Determines if the download task has been canceled.
     29     * @return {@code true} if the download task has been canceled
     30     */
    2431    public boolean isCanceled() {
    2532        return canceled;
    2633    }
    2734
     35    /**
     36     * Marks this download task as canceled.
     37     * @param canceled {@code true} to mark this download task as canceled
     38     */
    2839    public void setCanceled(boolean canceled) {
    2940        this.canceled = canceled;
    3041    }
    3142
     43    /**
     44     * Determines if the download task has failed.
     45     * @return {@code true} if the download task has failed
     46     */
    3247    public boolean isFailed() {
    3348        return failed;
    3449    }
    3550
     51    /**
     52     * Marks this download task as failed.
     53     * @param failed {@code true} to mark this download task as failed
     54     */
    3655    public void setFailed(boolean failed) {
    3756        this.failed = failed;
     
    82101    }
    83102
    84     // Can be overridden for more complex checking logic
     103    /**
     104     * Determines if the given URL is accepted by {@link #getPatterns}.
     105     * Can be overridden for more complex checking logic.
     106     * @param url URL to donwload
     107     * @return {@code true} if this URL is accepted
     108     */
    85109    public boolean acceptsUrl(String url) {
    86         if (url == null) return false;
     110        if (url == null)
     111            return false;
    87112        for (String p: getPatterns()) {
    88113            if (url.matches(p)) {
     
    113138    @Override
    114139    public boolean acceptsUrl(String url, boolean isRemotecontrol) {
    115         if (isRemotecontrol && !isSafeForRemotecontrolRequests()) return false;
     140        if (isRemotecontrol && !isSafeForRemotecontrolRequests())
     141            return false;
    116142        return acceptsUrl(url);
    117143    }
     
    133159        return new String[]{};
    134160    }
    135 
    136161}
Note: See TracChangeset for help on using the changeset viewer.