Changeset 12369 in josm for trunk/src/org
- Timestamp:
- 2017-06-09T20:33:26+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/progress
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/progress/AbstractProgressMonitor.java
r9529 r12369 7 7 import java.util.Queue; 8 8 9 /** 10 * This class contains the progress logic required to implement a {@link ProgressMonitor}. 11 */ 9 12 public abstract class AbstractProgressMonitor implements ProgressMonitor { 10 13 … … 58 61 protected abstract void doSetCustomText(String title); 59 62 63 /** 64 * Create a new {@link AbstractProgressMonitor} 65 * @param cancelHandler The handler that gets notified when the process is canceled. 66 */ 60 67 protected AbstractProgressMonitor(CancelHandler cancelHandler) { 61 68 this.cancelHandler = cancelHandler; -
trunk/src/org/openstreetmap/josm/gui/progress/CancelHandler.java
r9078 r12369 7 7 import org.openstreetmap.josm.gui.progress.ProgressMonitor.CancelListener; 8 8 9 /** 10 * A handler that notifies all listeners that a given operation was canceled. 11 */ 9 12 public class CancelHandler { 10 13 … … 12 15 private final List<CancelListener> listeners = new ArrayList<>(); 13 16 17 /** 18 * Cancels the operation. This call is ignored if the operation was already canceled. 19 */ 14 20 public synchronized void cancel() { 15 21 if (!isCanceled) { … … 21 27 } 22 28 29 /** 30 * Checks if the operation was canceled 31 * @return <code>true</code> if {@link #cancel()} was called. 32 */ 23 33 public synchronized boolean isCanceled() { 24 34 return isCanceled; 25 35 } 26 36 37 /** 38 * Adds a new cancel listener 39 * @param listener The listener to add 40 */ 27 41 public synchronized void addCancelListener(CancelListener listener) { 28 42 listeners.add(listener); 29 43 } 30 44 45 /** 46 * Removes a cancel listener 47 * @param listener The listener to remove 48 */ 31 49 public synchronized void removeCancelListener(CancelListener listener) { 32 50 listeners.remove(listener); -
trunk/src/org/openstreetmap/josm/gui/progress/ChildProgress.java
r10173 r12369 4 4 import java.awt.Component; 5 5 6 /** 7 * The progress of a sub task 8 */ 6 9 public class ChildProgress extends AbstractProgressMonitor { 7 10 … … 9 12 private final boolean internal; 10 13 14 /** 15 * Creates a new {@link ChildProgress} 16 * @param parent The parent task that creates this progress 17 * @param cancelHandler The cancel handler to notify when this task is canceled 18 * @param internal this is an internal task that will not modify the text that is displayed to the user 19 */ 11 20 public ChildProgress(AbstractProgressMonitor parent, CancelHandler cancelHandler, boolean internal) { 12 21 super(cancelHandler); … … 15 24 } 16 25 26 /** 27 * Gets the parent task 28 * @return The parent task 29 */ 17 30 public final AbstractProgressMonitor getParent() { 18 31 return parent; 19 32 } 20 33 34 /** 35 * See if this is an internal task 36 * @return True if this task should not modify the text that is displayed to the user 37 */ 21 38 public final boolean isInternal() { 22 39 return internal; -
trunk/src/org/openstreetmap/josm/gui/progress/PleaseWaitProgressMonitor.java
r12259 r12369 29 29 */ 30 30 public interface ProgressMonitorDialog { 31 /** 32 * Sets the visibility of this dialog 33 * @param visible The visibility, <code>true</code> to show it, <code>false</code> to hide it 34 */ 31 35 void setVisible(boolean visible); 32 36 … … 37 41 void updateProgress(int progress); 38 42 43 /** 44 * Sets the description of what is done 45 * @param text The description of the task 46 */ 39 47 void setCustomText(String text); 40 48 49 /** 50 * Sets the current action that is done 51 * @param text The current action 52 */ 41 53 void setCurrentAction(String text); 42 54 55 /** 56 * Display that the current progress cannot be determined 57 * @param newValue wether the progress cannot be determined 58 */ 43 59 void setIndeterminate(boolean newValue); 44 60 45 // TODO Not implemented properly in background monitor, log message will get lost if progress runs in background 61 /** 62 * Append a message to the progress log 63 * <p> 64 * TODO Not implemented properly in background monitor, log message will get lost if progress runs in background 65 * @param message The message 66 */ 46 67 void appendLogMessage(String message); 47 68 } … … 174 195 }; 175 196 197 /** 198 * See if this task is canceleable 199 * @return <code>true</code> if it can be canceled 200 */ 176 201 public final boolean isCancelable() { 177 202 return cancelable; 178 203 } 179 204 205 /** 206 * Sets this task to be cancelable 207 * @param cancelable Whether it can be canceled 208 */ 180 209 public final void setCancelable(boolean cancelable) { 181 210 this.cancelable = cancelable; … … 274 303 } 275 304 305 /** 306 * Update the dialog values 307 */ 276 308 public void reset() { 277 309 if (dialog != null) { … … 294 326 } 295 327 328 /** 329 * Close the progress dialog window. 330 */ 296 331 public void close() { 297 332 doInEDT(() -> { … … 312 347 } 313 348 349 /** 350 * Show the progress dialog in foreground 351 */ 314 352 public void showForegroundDialog() { 315 353 isInBackground = false; -
trunk/src/org/openstreetmap/josm/gui/progress/ProgressException.java
r5170 r12369 2 2 package org.openstreetmap.josm.gui.progress; 3 3 4 /** 5 * An exception that is thrown by the progress monitor if something went wrong 6 */ 4 7 public class ProgressException extends RuntimeException { 5 8 9 /** 10 * Create a new {@link ProgressException} 11 * @param message The message 12 * @param args The arguments for the message string 13 * @see String#format 14 */ 6 15 public ProgressException(String message, Object... args) { 7 16 super(String.format(message, args)); -
trunk/src/org/openstreetmap/josm/gui/progress/ProgressMonitor.java
r12259 r12369 34 34 public interface ProgressMonitor { 35 35 36 /** 37 * A listener that listens to cancel events on the progress monitor 38 */ 36 39 @FunctionalInterface 37 40 interface CancelListener { 41 /** 42 * Called when the operation was canceled 43 */ 38 44 void operationCanceled(); 39 45 } -
trunk/src/org/openstreetmap/josm/gui/progress/ProgressRenderer.java
r8510 r12369 5 5 * Swing components can implement this interface and use a {@link SwingRenderingProgressMonitor} 6 6 * to render progress information. 7 *8 7 */ 9 8 public interface ProgressRenderer { 9 /** 10 * Sets the title to display 11 * @param taskTitle The title text 12 */ 10 13 void setTaskTitle(String taskTitle); 11 14 15 /** 16 * Sets the custom text below the title 17 * @param message The message 18 */ 12 19 void setCustomText(String message); 13 20 21 /** 22 * Display the value as indeterminate value (unknown progress) 23 * @param indeterminate <code>true</code> if the progress is unknown 24 */ 14 25 void setIndeterminate(boolean indeterminate); 15 26 27 /** 28 * Sets the maximum possible progress 29 * @param maximum The minimum value 30 */ 16 31 void setMaximum(int maximum); 17 32 33 /** 34 * Sets the current progress 35 * @param value The progress, in range 0...maximum 36 * @see #setMaximum(int) 37 */ 18 38 void setValue(int value); 19 39 } -
trunk/src/org/openstreetmap/josm/gui/progress/ProgressTaskId.java
r9371 r12369 4 4 import java.util.Objects; 5 5 6 /** 7 * The ID of a progress task. It is required to run tasks in background 8 */ 6 9 public class ProgressTaskId { 7 10 8 11 private final String id; 9 12 13 /** 14 * Create a new {@link ProgressTaskId} 15 * @param component The JOSM component name that creates this id 16 * @param task The task name 17 */ 10 18 public ProgressTaskId(String component, String task) { 11 19 this.id = component + '.' + task; 12 20 } 13 21 22 /** 23 * Gets the id 24 * @return The task id 25 */ 14 26 public String getId() { 15 27 return id; -
trunk/src/org/openstreetmap/josm/gui/progress/ProgressTaskIds.java
r7937 r12369 2 2 package org.openstreetmap.josm.gui.progress; 3 3 4 /** 5 * The default {@link ProgressTaskId}s used in JOSM 6 */ 4 7 public interface ProgressTaskIds { 5 8 9 /** 10 * Download GPS data 11 */ 6 12 ProgressTaskId DOWNLOAD_GPS = new ProgressTaskId("core", "downloadGps"); 13 14 /** 15 * Download WMS data along a gps line 16 */ 7 17 ProgressTaskId PRECACHE_WMS = new ProgressTaskId("core", "precacheWms"); 8 18
Note:
See TracChangeset
for help on using the changeset viewer.