Changeset 10124 in josm for trunk/src/org/openstreetmap/josm/actions/downloadtasks/AbstractDownloadTask.java
- Timestamp:
- 2016-04-09T16:08:55+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/AbstractDownloadTask.java
r9067 r10124 8 8 9 9 /** 10 * Common abstract implementation of other download tasks 10 * Common abstract implementation of other download tasks. 11 11 * @param <T> The downloaded data type 12 12 * @since 2322 … … 18 18 protected T downloadedData; 19 19 20 /** 21 * Constructs a new {@code AbstractDownloadTask}. 22 */ 20 23 public AbstractDownloadTask() { 21 24 errorMessages = new ArrayList<>(); 22 25 } 23 26 27 /** 28 * Determines if the download task has been canceled. 29 * @return {@code true} if the download task has been canceled 30 */ 24 31 public boolean isCanceled() { 25 32 return canceled; 26 33 } 27 34 35 /** 36 * Marks this download task as canceled. 37 * @param canceled {@code true} to mark this download task as canceled 38 */ 28 39 public void setCanceled(boolean canceled) { 29 40 this.canceled = canceled; 30 41 } 31 42 43 /** 44 * Determines if the download task has failed. 45 * @return {@code true} if the download task has failed 46 */ 32 47 public boolean isFailed() { 33 48 return failed; 34 49 } 35 50 51 /** 52 * Marks this download task as failed. 53 * @param failed {@code true} to mark this download task as failed 54 */ 36 55 public void setFailed(boolean failed) { 37 56 this.failed = failed; … … 82 101 } 83 102 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 */ 85 109 public boolean acceptsUrl(String url) { 86 if (url == null) return false; 110 if (url == null) 111 return false; 87 112 for (String p: getPatterns()) { 88 113 if (url.matches(p)) { … … 113 138 @Override 114 139 public boolean acceptsUrl(String url, boolean isRemotecontrol) { 115 if (isRemotecontrol && !isSafeForRemotecontrolRequests()) return false; 140 if (isRemotecontrol && !isSafeForRemotecontrolRequests()) 141 return false; 116 142 return acceptsUrl(url); 117 143 } … … 133 159 return new String[]{}; 134 160 } 135 136 161 }
Note:
See TracChangeset
for help on using the changeset viewer.