# ProgressInterface

Import: `import com.install4j.api.context.ProgressInterface;`

```java
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](../screens/Screen.md#getprogressinterface-progressinterface)
- [Context.getProgressInterface](Context.md#getprogressinterface)

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`setStatusMessage(String)`](#setstatusmessage-string) | `void` | Sets the status message on the progress screen. |
| [`setDetailMessage(String)`](#setdetailmessage-string) | `void` | Sets the detail message on the progress screen. |
| [`setPercentCompleted(int)`](#setpercentcompleted-int) | `void` | Sets the completion percentage of the current action. |
| [`getPercentCompleted()`](#getpercentcompleted) | `int` | Retrieves the current progress value |
| [`setSecondaryPercentCompleted(int)`](#setsecondarypercentcompleted-int) | `void` | Sets the completion percentage of a secondary task, like the unpacking of a JAR file that was packed with Pack200. |
| [`setIndeterminateProgress(boolean)`](#setindeterminateprogress-boolean) | `void` | Indicate that an action is performed whose duration is not known. |
| [`showFailure(String)`](#showfailure-string) | `void` | Shows an error dialog with the specified message. |
| [`clearProgress()`](#clearprogress) | `void` | Clear any progress bar, spinner or detail line that the implementation may currently be displaying. |
| [`askOverwrite(File)`](#askoverwrite-file) | `int` | Asks the user whether the specified file should be overwritten. |
| [`askRetry(File)`](#askretry-file) | `int` | Asks the user whether the installer should retry to overwrite the specified file. |
| [`askContinue(File)`](#askcontinue-file) | `boolean` | Asks the user whether to continue after the specified file could not be installed. |
| [`isUnattendedProgressDialog()`](#isunattendedprogressdialog) | `boolean` | 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()`](#isalertsshown) | `boolean` | Returns if alerts are shown. |

### setStatusMessage(String)

```java
void setStatusMessage(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(String)

```java
void setDetailMessage(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(int)

```java
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()

```java
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(int)

```java
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(boolean)

```java
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(String)

```java
void showFailure(String message)
```

Shows an error dialog with the specified message.


**Parameters:**

- `message` — the error message

### clearProgress()

```java
default void clearProgress()
```

Clear any progress bar, spinner or detail line that the implementation may currently
be displaying.

### askOverwrite(File)

```java
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(File)

```java
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(File)

```java
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()

```java
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()

```java
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 [`ProgressInterface.isUnattendedProgressDialog`](ProgressInterface.md#isunattendedprogressdialog)
unless the "Show alerts" property was also set or `-alerts` was also passed as a command line argument.

## Fields

| Field | Type | Description |
|---|---|---|
| [OVERWRITE_NO](#overwrite-no) | `int` | Returned by `askOverwrite` if the user hits "No". |
| [OVERWRITE_YES](#overwrite-yes) | `int` | Returned by `askOverwrite` if the user hits "Yes". |
| [OVERWRITE_ALL](#overwrite-all) | `int` | Returned by `askOverwrite` if the user hits "All". |
| [OVERWRITE_NEVER](#overwrite-never) | `int` | Returned by `askOverwrite` if the user hits "Never". |
| [RETRY_NO](#retry-no) | `int` | Returned by `askRetry` if the user hits "No". |
| [RETRY_YES](#retry-yes) | `int` | Returned by `askRetry` if the user hits "Yes". |
| [RETRY_CANCEL](#retry-cancel) | `int` | Returned by `askRetry` if the user hits "Cancel". |

### OVERWRITE_NO

```java
static final int OVERWRITE_NO = 1
```

Returned by `askOverwrite` if the user hits "No".

### OVERWRITE_YES

```java
static final int OVERWRITE_YES = 2
```

Returned by `askOverwrite` if the user hits "Yes".

### OVERWRITE_ALL

```java
static final int OVERWRITE_ALL = 3
```

Returned by `askOverwrite` if the user hits "All".

### OVERWRITE_NEVER

```java
static final int OVERWRITE_NEVER = 4
```

Returned by `askOverwrite` if the user hits "Never".

### RETRY_NO

```java
static final int RETRY_NO = 1
```

Returned by `askRetry` if the user hits "No".

### RETRY_YES

```java
static final int RETRY_YES = 2
```

Returned by `askRetry` if the user hits "Yes".

### RETRY_CANCEL

```java
static final int RETRY_CANCEL = 3
```

Returned by `askRetry` if the user hits "Cancel".

