## install4j API documentation

## com.install4j.api.screens
Class AbstractInstallerOrUninstallerScreen

    java.lang.Object
      com.install4j.api.beans.AbstractBean
          com.install4j.api.screens.AbstractInstallerOrUninstallerScreen

All Implemented Interfaces:
  Bean, InstallerEventListener, InstallerScreen, Screen, UninstallerScreen

    public abstract class AbstractInstallerOrUninstallerScreen

extends AbstractBean
implements InstallerScreen, UninstallerScreen, InstallerEventListener

Abstract base class for screens that can be used in the installer or uninstaller. All methods that have a reasonable default answer are overridden in the class. This class saves the context that is set by the framework and provides getters for it.

Author:
  ej-technologies GmbH

Constructor Summary
`AbstractInstallerOrUninstallerScreen()`

Method Summary
`void` | `activated()` Called by the framework just after the screen has been activated.
`boolean` | `cancel()` Called when the user clicks the "Cancel" button for this screen.
`void` | `deactivated()` Called by the framework just after the screen has been deactivated.
`Context` | `getContext()` Returns the `Context` that the framework has associated with this custom screen in either `setInstallerContext` or `setUninstallerContext`.
`InstallerContext` | `getInstallerContext()` Returns the `InstallerContext` that the framework has associated with this custom screen in `setInstallerContext`.
`ProgressInterface` | `getProgressInterface(ProgressInterface defaultProgressInterface)` Replace the default prorgess interface for actions with a custom progress interface.
`UninstallerContext` | `getUninstallerContext()` Returns the `UninstallerContext` that the framework has associated with this custom screen in `setUninstallerContext`.
`boolean` | `handleConsole(Console console)` Handle the console mode.
`boolean` | `handleUnattended()` Handle the unattended mode.
`boolean` | `hasTitlePanel()` This method is called by the framework to determine if this screen wants a title area or not.
`void` | `installerEvent(InstallerEvent event)` Called when an installer event is fired.
`boolean` | `isCancelVisible()` Returns whether the "Cancel" button is visible or not for this screen.
`boolean` | `isHidden()` Returns whether this screen should be hidden.
`boolean` | `isHiddenForNext()` Returns whether this screen should be hidden when the user traverses screens in the forward direction.
`boolean` | `isHiddenForPrevious()` Returns whether this screen should be hidden when the user traverses screens in the backward direction.
`boolean` | `isNextVisible()` Returns whether the "Next" button is visible or not for this screen.
`boolean` | `isPreviousVisible()` Returns whether the "Back" button is visible or not for this screen.
`boolean` | `next()` Called when the user clicks the "Next" button for this screen.
`boolean` | `previous()` Called when the user clicks the "Back" button for this screen.
`void` | `setInstallerContext(InstallerContext context)` This method is called by the framework to set the `InstallerContext` just after the screen has been constructed.
`void` | `setUninstallerContext(UninstallerContext context)` This method is called by the framework to set the `UninstallerContext`.
`void` | `willActivate()` Called by the framework just before the screen is activated.

Methods inherited from class com.install4j.api.beans.AbstractBean
`replaceVariables, replaceVariables, replaceVariables, replaceVariables`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.install4j.api.screens.Screen
`createComponent, getSubTitle, getTitle, isFillHorizontal, isFillVertical`

Constructor Detail

### AbstractInstallerOrUninstallerScreen

    public AbstractInstallerOrUninstallerScreen()

Method Detail

### setInstallerContext

    public void setInstallerContext(InstallerContext context)

  Description copied from interface: `InstallerScreen`
  This method is called by the framework to set the `InstallerContext` just after the screen has been constructed.

  Specified by:
    `setInstallerContext` in interface `InstallerScreen`
  Parameters:
    `context` - the installer context.

### setUninstallerContext

    public void setUninstallerContext(UninstallerContext context)

  Description copied from interface: `UninstallerScreen`
  This method is called by the framework to set the `UninstallerContext`.

  Specified by:
    `setUninstallerContext` in interface `UninstallerScreen`
  Parameters:
    `context` - the uninstaller context.

### isNextVisible

    public boolean isNextVisible()

  Description copied from interface: `Screen`
  Returns whether the "Next" button is visible or not for this screen. If you just want to disable the button initially, please override `activate` and invoke `setNextButtonEnabled` in the `WizardContext` that is available from the `Context` in GUI mode.

  In console or unattended mode, this method is never called.

  Specified by:
    `isNextVisible` in interface `Screen`
  Returns:
    `true` or `false`. Default is `true`.
  See Also:
    `WizardContext`

### isPreviousVisible

    public boolean isPreviousVisible()

  Description copied from interface: `Screen`
  Returns whether the "Back" button is visible or not for this screen. If you just want to disable the button initially, please override `activate` and invoke `setPreviousButtonEnabled` in the `WizardContext` that is available from the `Context` in GUI mode.

  In console or unattended mode, this method is never called.

  Specified by:
    `isPreviousVisible` in interface `Screen`
  Returns:
    `true` or `false`. Default is `true`.
  See Also:
    `WizardContext`

### isCancelVisible

    public boolean isCancelVisible()

  Description copied from interface: `Screen`
  Returns whether the "Cancel" button is visible or not for this screen. If you just want to disable the button initially, please override `activate` and invoke `setCancelButtonEnabled` in the `WizardContext` that is available from the `Context` in GUI mode.

  In console or unattended mode, this method is never called.

  Specified by:
    `isCancelVisible` in interface `Screen`
  Returns:
    `true` or `false`. Default is `true`.
  See Also:
    `WizardContext`

### isHiddenForNext

    public boolean isHiddenForNext()

  Description copied from interface: `Screen`
  Returns whether this screen should be hidden when the user traverses screens in the forward direction.

  This method is also called in console or unattended mode.

  Specified by:
    `isHiddenForNext` in interface `Screen`
  Returns:
    `true` or `false`.

### isHiddenForPrevious

    public boolean isHiddenForPrevious()

  Description copied from interface: `Screen`
  Returns whether this screen should be hidden when the user traverses screens in the backward direction.

  This method is also called in console or unattended mode.

  Specified by:
    `isHiddenForPrevious` in interface `Screen`
  Returns:
    `true` or `false`.

### activated

    public void activated()

  Description copied from interface: `Screen`
  Called by the framework just after the screen has been activated. Override this method to perform any special initialization.

  In console or unattended mode, this method is never called.

  Specified by:
    `activated` in interface `Screen`

### deactivated

    public void deactivated()

  Description copied from interface: `Screen`
  Called by the framework just after the screen has been deactivated. Override this method to perform any special cleanup.

  In console or unattended mode, this method is never called.

  Specified by:
    `deactivated` in interface `Screen`

### installerEvent

    public void installerEvent(InstallerEvent event)

  Description copied from interface: `InstallerEventListener`
  Called when an installer event is fired.

  Specified by:
    `installerEvent` in interface `InstallerEventListener`
  Parameters:
    `event` - the event

### next

    public boolean next()

  Description copied from interface: `Screen`
  Called when the user clicks the "Next" button for this screen. You can veto the change to the next screen if you return `false`.

  In console or unattended mode, this method is never called.

  Specified by:
    `next` in interface `Screen`
  Returns:
    whether the screen change is accepted or not.

### previous

    public boolean previous()

  Description copied from interface: `Screen`
  Called when the user clicks the "Back" button for this screen. You can veto the change to the previous screen if you return `false`.

  In console or unattended mode, this method is never called.

  Specified by:
    `previous` in interface `Screen`
  Returns:
    whether the screen change is accepted or not.

### cancel

    public boolean cancel()

  Description copied from interface: `Screen`
  Called when the user clicks the "Cancel" button for this screen. You can veto the cancel action if you return `false`.

  Specified by:
    `cancel` in interface `Screen`
  Returns:
    whether the cancellation is accepted or not.

    In console or unattended mode, this method is never called.

### willActivate

    public void willActivate()

  Description copied from interface: `Screen`
  Called by the framework just before the screen is activated. Override this method to perform any special initialization.

  In console or unattended mode, this method is never called.

  Specified by:
    `willActivate` in interface `Screen`

### isHidden

    public boolean isHidden()

  Description copied from interface: `Screen`
  Returns whether this screen should be hidden. If this method returns `true`, it overrides the results of `isHiddenForNext` and `isHiddenForPrevious`.

  This method is also called in console or unattended mode.

  Specified by:
    `isHidden` in interface `Screen`
  Returns:
    `true` or `false`.
  See Also:
    `Screen.isHiddenForNext()`, `Screen.isHiddenForPrevious()`

### handleUnattended

    public boolean handleUnattended()

  Description copied from interface: `Screen`
  Handle the unattended mode. This method is called when the screen is traversed in unattended mode. There is no way to interact with the user. This method might be necessary to mirror some behavior from the GUI mode, such as setting installer variables or configuring actions.

  Specified by:
    `handleUnattended` in interface `Screen`
  Returns:
    whether the installer or uninstaller can proceed with the next screen or whether the process should be cancelled.

### handleConsole

    public boolean handleConsole(Console console)
                          throws UserCanceledException

  Description copied from interface: `Screen`
  Handle the console mode. This method is called when the screen is entered in console mode. You can use the `Console` object to interact with the user and replicate the GUI functionality on the terminal.

  If this screen has a form panel (i.e. `hasFormPanel()` returns `true`), you should call `FormEnvironment.handleConsole` in this method to handle console mode for the contained form components.

  Specified by:
    `handleConsole` in interface `Screen`
  Parameters:
    `console` - the `Console` object
  Returns:
    whether the installer or uninstaller can proceed with the next screen or whether the process should be cancelled.
  Throws:
    `UserCanceledException` - if the user cancels a question or notice. These exceptions are thrown by methods in the `Console` object.
  See Also:
    `FormEnvironment.handleConsole(Console)`

### getProgressInterface

    public ProgressInterface getProgressInterface(ProgressInterface defaultProgressInterface)

  Description copied from interface: `Screen`
  Replace the default prorgess interface for actions with a custom progress interface. When associated actions are run for a screen, a default progress interface is passed to them. If your screen has the possibility to show progress information, you can return a different progress interface here. Typically you would only implement methods regarding status and detail messages as well as methods that apply to a progress bar, other methods can be delegated to the default progress interface. This is the strategy emplyed by the "Installation screen" and the customizable "Progress screens".

  Specified by:
    `getProgressInterface` in interface `Screen`
  Parameters:
    `defaultProgressInterface` - the default progress interface
  Returns:
    the replaced progress interface

### hasTitlePanel

    public boolean hasTitlePanel()

  Description copied from interface: `Screen`
  This method is called by the framework to determine if this screen wants a title area or not.

  Specified by:
    `hasTitlePanel` in interface `Screen`
  Returns:
    `true` or `false`.

### getInstallerContext

    public InstallerContext getInstallerContext()

  Returns the `InstallerContext` that the framework has associated with this custom screen in `setInstallerContext`.

  Returns:
    the installer context or `null` if this screen is running in an uninstaller.

### getUninstallerContext

    public UninstallerContext getUninstallerContext()

  Returns the `UninstallerContext` that the framework has associated with this custom screen in `setUninstallerContext`.

  Returns:
    the uninstaller context or `null` if this screen is running in an installer.

### getContext

    public Context getContext()

  Returns the `Context` that the framework has associated with this custom screen in either `setInstallerContext` or `setUninstallerContext`.

  Returns:
    the context.