Changeset 11672 in josm


Ignore:
Timestamp:
2017-03-04T23:06:30+01:00 (4 weeks ago)
Author:
michael2402
Message:

PleaseWaitDialog: Javadoc and make direct progress model access deprecated.

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/PleaseWaitDialog.java

    r10179 r11672  
    2828import org.openstreetmap.josm.tools.ImageProvider;
    2929
     30/**
     31 * This is a dialog that displays the progress of an action to the user.
     32 */
    3033public class PleaseWaitDialog extends JDialog implements ProgressMonitorDialog {
    3134
     
    3437    private final JLabel currentAction = new JLabel("");
    3538    private final JLabel customText = new JLabel("");
     39    /**
     40     * The direct progress access.
     41     * @deprecated To be removed in mid-2017. Use {@link #updateProgress(int)}
     42     */
     43    @Deprecated
    3644    public final transient BoundedRangeModel progress = progressBar.getModel();
    3745    private JButton btnCancel;
     
    4048    private final JosmTextArea taLog = new JosmTextArea(5, 50);
    4149    private final JScrollPane spLog = new JScrollPane(taLog);
     50
     51
     52    /**
     53     * Constructs a new {@code PleaseWaitDialog}.
     54     * @param parent the {@code Component} from which the dialog is displayed. Can be {@code null}.
     55     */
     56    public PleaseWaitDialog(Component parent) {
     57        super(GuiHelper.getFrameForComponent(parent), ModalityType.DOCUMENT_MODAL);
     58        initDialog();
     59    }
    4260
    4361    private void initDialog() {
     
    7694    }
    7795
    78     /**
    79      * Constructs a new {@code PleaseWaitDialog}.
    80      * @param parent the {@code Component} from which the dialog is displayed. Can be {@code null}.
    81      */
    82     public PleaseWaitDialog(Component parent) {
    83         super(GuiHelper.getFrameForComponent(parent), ModalityType.DOCUMENT_MODAL);
    84         initDialog();
    85     }
    86 
    8796    @Override
    8897    public void setIndeterminate(boolean newValue) {
     
    99108
    100109    /**
    101      * Sets a custom text line below currentAction. Can be used to display additional information
     110     * Sets a custom text line below currentAction. Can be used to display additional information.
    102111     * @param text custom text
    103112     */
     
    142151
    143152    /**
    144      * Sets whether the cancel button is enabled or not
     153     * Sets whether the cancel button is enabled or not.
    145154     *
    146155     * @param enabled true, if the cancel button is enabled; false otherwise
     156     * @see #setCancelCallback(ActionListener)
    147157     */
    148158    public void setCancelEnabled(boolean enabled) {
     
    150160    }
    151161
     162    /**
     163     * Enables / disables a button that can be pressed to run the task in background.
     164     *
     165     * @param value <code>true</code> iff that button should be displayed.
     166     * @see #setInBackgroundCallback(ActionListener)
     167     */
    152168    public void setInBackgroundPossible(boolean value) {
    153169        btnInBackground.setVisible(value);
     
    190206    @Override
    191207    public void updateProgress(int progress) {
    192         this.progress.setValue(progress);
     208        this.progressBar.setValue(progress);
    193209        this.progressBar.repaint();
    194210    }
     211
     212    /**
     213     * Sets the maximum progress value.
     214     * @param progressBarMax The value that represents the rightmost point of the progress bar (100%).
     215     */
     216    public void setMaximumProgress(int progressBarMax) {
     217        this.progressBar.setMaximum(progressBarMax);
     218    }
    195219}
  • trunk/src/org/openstreetmap/josm/gui/progress/PleaseWaitProgressMonitor.java

    r11283 r11672  
    191191            dialog.setCustomText("");
    192192            dialog.addWindowListener(windowListener);
    193             dialog.progress.setMaximum(PROGRESS_BAR_MAX);
     193            dialog.setMaximumProgress(PROGRESS_BAR_MAX);
    194194            dialog.setVisible(true);
    195195        });
Note: See TracChangeset for help on using the changeset viewer.