Changeset 12369 in josm


Ignore:
Timestamp:
2017-06-09T20:33:26+02:00 (2 years ago)
Author:
michael2402
Message:

Javadoc for gui.progress package

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  
    77import java.util.Queue;
    88
     9/**
     10 * This class contains the progress logic required to implement a {@link ProgressMonitor}.
     11 */
    912public abstract class AbstractProgressMonitor implements ProgressMonitor {
    1013
     
    5861    protected abstract void doSetCustomText(String title);
    5962
     63    /**
     64     * Create a new {@link AbstractProgressMonitor}
     65     * @param cancelHandler The handler that gets notified when the process is canceled.
     66     */
    6067    protected AbstractProgressMonitor(CancelHandler cancelHandler) {
    6168        this.cancelHandler = cancelHandler;
  • trunk/src/org/openstreetmap/josm/gui/progress/CancelHandler.java

    r9078 r12369  
    77import org.openstreetmap.josm.gui.progress.ProgressMonitor.CancelListener;
    88
     9/**
     10 * A handler that notifies all listeners that a given operation was canceled.
     11 */
    912public class CancelHandler {
    1013
     
    1215    private final List<CancelListener> listeners = new ArrayList<>();
    1316
     17    /**
     18     * Cancels the operation. This call is ignored if the operation was already canceled.
     19     */
    1420    public synchronized void cancel() {
    1521        if (!isCanceled) {
     
    2127    }
    2228
     29    /**
     30     * Checks if the operation was canceled
     31     * @return <code>true</code> if {@link #cancel()} was called.
     32     */
    2333    public synchronized boolean isCanceled() {
    2434        return isCanceled;
    2535    }
    2636
     37    /**
     38     * Adds a new cancel listener
     39     * @param listener The listener to add
     40     */
    2741    public synchronized void addCancelListener(CancelListener listener) {
    2842        listeners.add(listener);
    2943    }
    3044
     45    /**
     46     * Removes a cancel listener
     47     * @param listener The listener to remove
     48     */
    3149    public synchronized void removeCancelListener(CancelListener listener) {
    3250        listeners.remove(listener);
  • trunk/src/org/openstreetmap/josm/gui/progress/ChildProgress.java

    r10173 r12369  
    44import java.awt.Component;
    55
     6/**
     7 * The progress of a sub task
     8 */
    69public class ChildProgress extends AbstractProgressMonitor {
    710
     
    912    private final boolean internal;
    1013
     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     */
    1120    public ChildProgress(AbstractProgressMonitor parent, CancelHandler cancelHandler, boolean internal) {
    1221        super(cancelHandler);
     
    1524    }
    1625
     26    /**
     27     * Gets the parent task
     28     * @return The parent task
     29     */
    1730    public final AbstractProgressMonitor getParent() {
    1831        return parent;
    1932    }
    2033
     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     */
    2138    public final boolean isInternal() {
    2239        return internal;
  • trunk/src/org/openstreetmap/josm/gui/progress/PleaseWaitProgressMonitor.java

    r12259 r12369  
    2929     */
    3030    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         */
    3135        void setVisible(boolean visible);
    3236
     
    3741        void updateProgress(int progress);
    3842
     43        /**
     44         * Sets the description of what is done
     45         * @param text The description of the task
     46         */
    3947        void setCustomText(String text);
    4048
     49        /**
     50         * Sets the current action that is done
     51         * @param text The current action
     52         */
    4153        void setCurrentAction(String text);
    4254
     55        /**
     56         * Display that the current progress cannot be determined
     57         * @param newValue wether the progress cannot be determined
     58         */
    4359        void setIndeterminate(boolean newValue);
    4460
    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         */
    4667        void appendLogMessage(String message);
    4768    }
     
    174195    };
    175196
     197    /**
     198     * See if this task is canceleable
     199     * @return <code>true</code> if it can be canceled
     200     */
    176201    public final boolean isCancelable() {
    177202        return cancelable;
    178203    }
    179204
     205    /**
     206     * Sets this task to be cancelable
     207     * @param cancelable Whether it can be canceled
     208     */
    180209    public final void setCancelable(boolean cancelable) {
    181210        this.cancelable = cancelable;
     
    274303    }
    275304
     305    /**
     306     * Update the dialog values
     307     */
    276308    public void reset() {
    277309        if (dialog != null) {
     
    294326    }
    295327
     328    /**
     329     * Close the progress dialog window.
     330     */
    296331    public void close() {
    297332        doInEDT(() -> {
     
    312347    }
    313348
     349    /**
     350     * Show the progress dialog in foreground
     351     */
    314352    public void showForegroundDialog() {
    315353        isInBackground = false;
  • trunk/src/org/openstreetmap/josm/gui/progress/ProgressException.java

    r5170 r12369  
    22package org.openstreetmap.josm.gui.progress;
    33
     4/**
     5 * An exception that is thrown by the progress monitor if something went wrong
     6 */
    47public class ProgressException extends RuntimeException {
    58
     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     */
    615    public ProgressException(String message, Object... args) {
    716        super(String.format(message, args));
  • trunk/src/org/openstreetmap/josm/gui/progress/ProgressMonitor.java

    r12259 r12369  
    3434public interface ProgressMonitor {
    3535
     36    /**
     37     * A listener that listens to cancel events on the progress monitor
     38     */
    3639    @FunctionalInterface
    3740    interface CancelListener {
     41        /**
     42         * Called when the operation was canceled
     43         */
    3844        void operationCanceled();
    3945    }
  • trunk/src/org/openstreetmap/josm/gui/progress/ProgressRenderer.java

    r8510 r12369  
    55 * Swing components can implement this interface and use a {@link SwingRenderingProgressMonitor}
    66 * to render progress information.
    7  *
    87 */
    98public interface ProgressRenderer {
     9    /**
     10     * Sets the title to display
     11     * @param taskTitle The title text
     12     */
    1013    void setTaskTitle(String taskTitle);
    1114
     15    /**
     16     * Sets the custom text below the title
     17     * @param message The message
     18     */
    1219    void setCustomText(String message);
    1320
     21    /**
     22     * Display the value as indeterminate value (unknown progress)
     23     * @param indeterminate <code>true</code> if the progress is unknown
     24     */
    1425    void setIndeterminate(boolean indeterminate);
    1526
     27    /**
     28     * Sets the maximum possible progress
     29     * @param maximum The minimum value
     30     */
    1631    void setMaximum(int maximum);
    1732
     33    /**
     34     * Sets the current progress
     35     * @param value The progress, in range 0...maximum
     36     * @see #setMaximum(int)
     37     */
    1838    void setValue(int value);
    1939}
  • trunk/src/org/openstreetmap/josm/gui/progress/ProgressTaskId.java

    r9371 r12369  
    44import java.util.Objects;
    55
     6/**
     7 * The ID of a progress task. It is required to run tasks in background
     8 */
    69public class ProgressTaskId {
    710
    811    private final String id;
    912
     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     */
    1018    public ProgressTaskId(String component, String task) {
    1119        this.id = component + '.' + task;
    1220    }
    1321
     22    /**
     23     * Gets the id
     24     * @return The task id
     25     */
    1426    public String getId() {
    1527        return id;
  • trunk/src/org/openstreetmap/josm/gui/progress/ProgressTaskIds.java

    r7937 r12369  
    22package org.openstreetmap.josm.gui.progress;
    33
     4/**
     5 * The default {@link ProgressTaskId}s used in JOSM
     6 */
    47public interface ProgressTaskIds {
    58
     9    /**
     10     * Download GPS data
     11     */
    612    ProgressTaskId DOWNLOAD_GPS = new ProgressTaskId("core", "downloadGps");
     13
     14    /**
     15     * Download WMS data along a gps line
     16     */
    717    ProgressTaskId PRECACHE_WMS = new ProgressTaskId("core", "precacheWms");
    818
Note: See TracChangeset for help on using the changeset viewer.