## install4j API documentation

## com.install4j.api
Interface InstallerWizardContext

All Superinterfaces:
  Context, InstallerContext

    public interface InstallerWizardContext

extends InstallerContext

The installer environment context that can be used to retrieve information about the installation process and to perform screen change and file installation operations. Instances of this class are available from `CustomScreen.getInstallerContext()` and are passed as parameters to `InstallAction.performAction()` and `InstallAction.rollback()`.

Author:
  ej-technologies GmbH

Field Summary
`static java.lang.String` | `SCREEN_ADDITIONAL_TASKS` Screen ID for the additional tasks screen for use in `gotoStandardScreen()`.
`static java.lang.String` | `SCREEN_COMPONENTS` Screen ID for the installation components screen for use in `gotoStandardScreen()`.
`static java.lang.String` | `SCREEN_FINISHED` Screen ID for the finished screen for use in `gotoStandardScreen()`.
`static java.lang.String` | `SCREEN_INSTALL` Screen ID for the installation screen for use in `gotoStandardScreen()`.
`static java.lang.String` | `SCREEN_LICENSE` Screen ID for the license screen for use in `gotoStandardScreen()`.
`static java.lang.String` | `SCREEN_LOCATION` Screen ID for the installation location screen for use in `gotoStandardScreen()`.
`static java.lang.String` | `SCREEN_POST_INFO` Screen ID for the post-installation information screen for use in `gotoStandardScreen()`.
`static java.lang.String` | `SCREEN_PRE_INFO` Screen ID for the pre-installation information screen for use in `gotoStandardScreen()`.
`static java.lang.String` | `SCREEN_PROGRAM_GROUP` Screen ID for the program group screen for use in `gotoStandardScreen()`.
`static java.lang.String` | `SCREEN_SERVICES` Screen ID for the services screen for use in `gotoStandardScreen()`.
`static java.lang.String` | `SCREEN_WELCOME` Screen ID for the welcome screen for use in `gotoStandardScreen()`.

Method Summary
`void` | `addInstallerEventListener(InstallerEventListener listener)` Add a listener to receive application events.
`CustomScreen` | `getCustomScreenOfClass(java.lang.Class screenClass)` Get the registered custom screen of a given class.
`java.util.List` | `getCustomScreens()` Get a list of all registered custom screens.
`boolean` | `gotoCustomScreen(CustomScreen screen)` Programmatically switch to a custom screen in the installer.
`boolean` | `gotoStandardScreen(java.lang.String id)` Programmatically switch to a standard screen in the installer.
`void` | `removeInstallerEventListener(InstallerEventListener listener)` Remove a listener to receive application events.
`void` | `setBackButtonEnabled(boolean enabled)` Switch the enabled status of the "Back" button at the bottom of the current screen.
`void` | `setCancelButtonEnabled(boolean enabled)` Switch the enabled status of the "Cancel" button at the bottom of the current screen.
`void` | `setNextButtonEnabled(boolean enabled)` Switch the enabled status of the "Next" button at the bottom of the current screen.

Methods inherited from interface com.install4j.api.InstallerContext
`abort, getCustomTasks, getInstallationComponents, getInstallerFile, getMediaName, getProgramGroup, getServiceSetups, installFile, installFile, installFile, isCreateDesktopIcon, isCreateMenu, isCreateMenuAllUsers, isCreateQuickLaunchIcon, registerUninstallFile`

Methods inherited from interface com.install4j.api.Context
`getAddOnApplicationId, getApplicationId, getInstallationDirectory, getUserVariableValue, isAdminUser, isUnattended, rebootAfterFinish`

Field Detail

### SCREEN_WELCOME

    static final java.lang.String SCREEN_WELCOME

  Screen ID for the welcome screen for use in `gotoStandardScreen()`.

  See Also:
    Constant Field Values

### SCREEN_LICENSE

    static final java.lang.String SCREEN_LICENSE

  Screen ID for the license screen for use in `gotoStandardScreen()`.

  See Also:
    Constant Field Values

### SCREEN_LOCATION

    static final java.lang.String SCREEN_LOCATION

  Screen ID for the installation location screen for use in `gotoStandardScreen()`.

  See Also:
    Constant Field Values

### SCREEN_PROGRAM_GROUP

    static final java.lang.String SCREEN_PROGRAM_GROUP

  Screen ID for the program group screen for use in `gotoStandardScreen()`.

  See Also:
    Constant Field Values

### SCREEN_COMPONENTS

    static final java.lang.String SCREEN_COMPONENTS

  Screen ID for the installation components screen for use in `gotoStandardScreen()`.

  See Also:
    Constant Field Values

### SCREEN_SERVICES

    static final java.lang.String SCREEN_SERVICES

  Screen ID for the services screen for use in `gotoStandardScreen()`.

  See Also:
    Constant Field Values

### SCREEN_PRE_INFO

    static final java.lang.String SCREEN_PRE_INFO

  Screen ID for the pre-installation information screen for use in `gotoStandardScreen()`.

  See Also:
    Constant Field Values

### SCREEN_INSTALL

    static final java.lang.String SCREEN_INSTALL

  Screen ID for the installation screen for use in `gotoStandardScreen()`. If you invoke this screen, the installation will be started immediately.

  See Also:
    Constant Field Values

### SCREEN_ADDITIONAL_TASKS

    static final java.lang.String SCREEN_ADDITIONAL_TASKS

  Screen ID for the additional tasks screen for use in `gotoStandardScreen()`.

  See Also:
    Constant Field Values

### SCREEN_POST_INFO

    static final java.lang.String SCREEN_POST_INFO

  Screen ID for the post-installation information screen for use in `gotoStandardScreen()`. This screen is available on the Windows platform only.

  See Also:
    Constant Field Values

### SCREEN_FINISHED

    static final java.lang.String SCREEN_FINISHED

  Screen ID for the finished screen for use in `gotoStandardScreen()`. If you invoke this screen, the user will not have the possibility to go back to previous screens.

  See Also:
    Constant Field Values

Method Detail

### addInstallerEventListener

    void addInstallerEventListener(InstallerEventListener listener)

  Add a listener to receive application events.

  Parameters:
    `listener` - the listener to add.

### removeInstallerEventListener

    void removeInstallerEventListener(InstallerEventListener listener)

  Remove a listener to receive application events.

  Parameters:
    `listener` - the listener to remove.

### gotoStandardScreen

    boolean gotoStandardScreen(java.lang.String id)

  Programmatically switch to a standard screen in the installer. If the screen with the given ID is not enabled for the installer, the operation will fail.

  Note: This method is only functional in custom screens. In custom actions this method will always return `false`.

  Parameters:
    `id` - the ID of the screen to be activated. Must be one of the `SCREEN_` constants.
  Returns:
    whether the operation has succeeded or not.

### gotoCustomScreen

    boolean gotoCustomScreen(CustomScreen screen)

  Programmatically switch to a custom screen in the installer. If the given custom screen has not been registered, the operation will fail. Registered custom screens can be obtained from `getCustomScreens()` and `getCustomScreenOfClass()`.

  Note: This method is only functional in custom screens. In custom actions this method will always return `false`.

  Parameters:
    `screen` - the custom screen to be activated.
  Returns:
    whether the operation has succeeded or not.

### setNextButtonEnabled

    void setNextButtonEnabled(boolean enabled)

  Switch the enabled status of the "Next" button at the bottom of the current screen. This setting applies only to the currently displayed screen.

  Parameters:
    `enabled` - the value.

### setBackButtonEnabled

    void setBackButtonEnabled(boolean enabled)

  Switch the enabled status of the "Back" button at the bottom of the current screen. This setting applies only to the currently displayed screen.

  Parameters:
    `enabled` - the value.

### setCancelButtonEnabled

    void setCancelButtonEnabled(boolean enabled)

  Switch the enabled status of the "Cancel" button at the bottom of the current screen. This setting applies only to the currently displayed screen.

  Parameters:
    `enabled` - the value.

### getCustomScreens

    java.util.List getCustomScreens()

  Get a list of all registered custom screens.

  Returns:
    the list of custom screens. This includes only classes that are derived from `CustomScreen`.

### getCustomScreenOfClass

    CustomScreen getCustomScreenOfClass(java.lang.Class screenClass)

  Get the registered custom screen of a given class. If multiple screens of the same class are registered, the first occurrence is returned. In that case, `getCustomScreens()` should be used.

  Parameters:
    `screenClass` - the class of the custom screen.
  Returns:
    the custom screen or null if no custom screen of this class could be found.