ProgressInterface (install4j API)
Description: declaration: package: com.install4j.api.context, interface: ProgressInterface

# Interface ProgressInterface

All Known Subinterfaces:
  `Console, UnattendedProgressInterface`

All Known Implementing Classes:
  `DefaultUnattendedProgressInterface`

public interface ProgressInterface
The user notification interface during installation. It displays progress and messages and can ask questions relevant for installation purposes in custom actions.

Status messages and progress are only displayed if the progress interface is used by an action and the containing screen offers its own progress interface, like the "Installation" screen or the customizable "Display progress" screen.

See Also:
  - `Screen.getProgressInterface(ProgressInterface)`
  - `Context.getProgressInterface()`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `OVERWRITE_ALL`
  Returned by `askOverwrite` if the user hits "All".
  `static final int`
  `OVERWRITE_NEVER`
  Returned by `askOverwrite` if the user hits "Never".
  `static final int`
  `OVERWRITE_NO`
  Returned by `askOverwrite` if the user hits "No".
  `static final int`
  `OVERWRITE_YES`
  Returned by `askOverwrite` if the user hits "Yes".
  `static final int`
  `RETRY_CANCEL`
  Returned by `askRetry` if the user hits "Cancel".
  `static final int`
  `RETRY_NO`
  Returned by `askRetry` if the user hits "No".
  `static final int`
  `RETRY_YES`
  Returned by `askRetry` if the user hits "Yes".

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `askContinue(File file)`
  Asks the user whether to continue after the specified file could not be installed.
  `int`
  `askOverwrite(File file)`
  Asks the user whether the specified file should be overwritten.
  `int`
  `askRetry(File file)`
  Asks the user whether the installer should retry to overwrite the specified file.
  `default void`
  `clearProgress()`
  Clear any progress bar, spinner or detail line that the implementation may currently be displaying.
  `int`
  `getPercentCompleted()`
  Retrieves the current progress value
  `default boolean`
  `isAlertsShown()`
  Returns if alerts are shown.
  `default boolean`
  `isUnattendedProgressDialog()`
  Returns if the installer application has been started in the "Unattended mode with progress dialog" execution mode, either because the "Default execution mode" property of the installer application was set accordingly or because `-splash &lt;title&gt;"` were passed as command line arguments.
  `void`
  `setDetailMessage(String message)`
  Sets the detail message on the progress screen.
  `void`
  `setIndeterminateProgress(boolean indeterminateProgress)`
  Indicate that an action is performed whose duration is not known.
  `void`
  `setPercentCompleted(int value)`
  Sets the completion percentage of the current action.
  `void`
  `setSecondaryPercentCompleted(int value)`
  Sets the completion percentage of a secondary task, like the unpacking of a JAR file that was packed with Pack200.
  `void`
  `setStatusMessage(String message)`
  Sets the status message on the progress screen.
  `void`
  `showFailure(String message)`
  Shows an error dialog with the specified message.

- ## Field Details

  - ### OVERWRITE_NO

    static final int OVERWRITE_NO
    Returned by `askOverwrite` if the user hits "No".
    See Also:
      - Constant Field Values

  - ### OVERWRITE_YES

    static final int OVERWRITE_YES
    Returned by `askOverwrite` if the user hits "Yes".
    See Also:
      - Constant Field Values

  - ### OVERWRITE_ALL

    static final int OVERWRITE_ALL
    Returned by `askOverwrite` if the user hits "All".
    See Also:
      - Constant Field Values

  - ### OVERWRITE_NEVER

    static final int OVERWRITE_NEVER
    Returned by `askOverwrite` if the user hits "Never".
    See Also:
      - Constant Field Values

  - ### RETRY_NO

    static final int RETRY_NO
    Returned by `askRetry` if the user hits "No".
    See Also:
      - Constant Field Values

  - ### RETRY_YES

    static final int RETRY_YES
    Returned by `askRetry` if the user hits "Yes".
    See Also:
      - Constant Field Values

  - ### RETRY_CANCEL

    static final int RETRY_CANCEL
    Returned by `askRetry` if the user hits "Cancel".
    See Also:
      - Constant Field Values

- ## Method Details

  - ### setStatusMessage

    void setStatusMessage(@Nls String message)
    Sets the status message on the progress screen.

    Note: Has no effect if not called from an action or if the containing screen doesn't display progress.

    Parameters:
      `message` - the new message.

  - ### setDetailMessage

    void setDetailMessage(@Nls String message)
    Sets the detail message on the progress screen. This message is shown below the status message.

    Note: Has no effect if not called from an action or if the containing screen doesn't display progress.

    Parameters:
      `message` - the new message.

  - ### setPercentCompleted

    void setPercentCompleted(int value)
    Sets the completion percentage of the current action.

    Note: Has no effect if not called from an action or if the containing screen doesn't display progress.

    Parameters:
      `value` - a value between 0 and 100.

  - ### getPercentCompleted

    int getPercentCompleted()
    Retrieves the current progress value
    Returns:
      the current progress value between 0 and 100. Always returns 0 if not called from an action or if the containing screen doesn't display progress.

  - ### setSecondaryPercentCompleted

    void setSecondaryPercentCompleted(int value)
    Sets the completion percentage of a secondary task, like the unpacking of a JAR file that was packed with Pack200.

    Note: Has no effect if not called from an action or if the containing screen doesn't display progress.

    Parameters:
      `value` - a value between 0 and 100.

  - ### setIndeterminateProgress

    void setIndeterminateProgress(boolean indeterminateProgress)
    Indicate that an action is performed whose duration is not known.

    Note: Has no effect if not called from an action or if the containing screen doesn't display progress.

    Parameters:
      `indeterminateProgress` - pass `true` to switch on indeterminate progress feedback and `false` to switch it off again. When you switch it off, the previously set percentage will be shown in the progress bar.

  - ### showFailure

    void showFailure(String message)
    Shows an error dialog with the specified message.
    Parameters:
      `message` - the error message

  - ### clearProgress

    default void clearProgress()
    Clear any progress bar, spinner or detail line that the implementation may currently be displaying.

  - ### askOverwrite

    int askOverwrite(File file) throws UserCanceledException
    Asks the user whether the specified file should be overwritten.
    Parameters:
      `file` - the file in question.
    Returns:
      one of the `OVERWRITE_*` constants.
    Throws:
      `UserCanceledException` - if the user cancels the question

  - ### askRetry

    int askRetry(File file) throws UserCanceledException
    Asks the user whether the installer should retry to overwrite the specified file.
    Parameters:
      `file` - the file in question.
    Returns:
      one of the `RETRY_*` constants
    Throws:
      `UserCanceledException` - if the user cancels the question

  - ### askContinue

    boolean askContinue(File file) throws UserCanceledException
    Asks the user whether to continue after the specified file could not be installed.
    Parameters:
      `file` - the file in question.
    Returns:
      `true` if the user wants to continue the installation.
    Throws:
      `UserCanceledException` - if the user cancels the question

  - ### isUnattendedProgressDialog

    default boolean isUnattendedProgressDialog()
    Returns if the installer application has been started in the "Unattended mode with progress dialog" execution mode, either because the "Default execution mode" property of the installer application was set accordingly or because `-splash &lt;title&gt;"` were passed as command line arguments.

  - ### isAlertsShown

    default boolean isAlertsShown()
    Returns if alerts are shown. This will return false if the installer application was started in the "Unattended mode with progress dialog" execution mode as explained for `isUnattendedProgressDialog()` unless the "Show alerts" property was also set or `-alerts` was also passed as a command line argument.