Style (install4j API)
Description: declaration: package: com.install4j.api.styles, interface: Style

Package com.install4j.api.styles

# Interface Style

All Superinterfaces:
  `Bean`, `ControlButtonContainer`, `StyleContextReceiver`, `VisualContainerBean`

All Known Implementing Classes:
  `AbstractStyle`, `WrapperStyle`

public interface Style extends VisualContainerBean, StyleContextReceiver, ControlButtonContainer
All styles must implement this interface. You have to override all methods and provide a public constructor with no arguments. It is recommended that you choose `AbstractStyle` as as a superclass.

Styles are configurable in the install4j GUI on the "Installer->Styles" step. The life-cycle of screen style instances is controlled by the framework. Styles are only instantiated once and their `createComponent()` method is called for each screen that the screen style is used for.

If you nest styles, implement `NestedStyleContainer` as well.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `activated()`
  This method is called by the framework just after a screen with this screen style has been activated.
  `JComponent`
  `createComponent()`
  Create the UI component for the style.
  `void`
  `deactivated()`
  This method is called by the framework just after a screen with this screen style has been deactivated.
  `boolean`
  `isStandalone()`
  Returns if the screen style is intended to by applied to installer applications, screens and screen groups.
  `void`
  `setContext(Context context)`
  This method is called by the framework to set the `Context` just after the screen style has been constructed.
  `void`
  `willActivate()`
  This method is called by the framework just before a screen with this screen style is activated.

  ### Methods inherited from interface com.install4j.api.styles.ControlButtonContainer

  `focusControlButton, setControlButtonEnabled, setControlButtonText, setControlButtonVisible`

  ### Methods inherited from interface com.install4j.api.styles.StyleContextReceiver

  `setStyleContext`

  ### Methods inherited from interface com.install4j.api.beans.VisualContainerBean

  `getAnchor, isFillHorizontal, isFillVertical`

- ## Method Details

  - ### setContext

    void setContext(Context context)
    This method is called by the framework to set the `Context` just after the screen style has been constructed. This is either an `InstallerContext` or an `UninstallerContext`, depending on whether the screen style is used in an installer or an uninstaller.

    When nesting other styles, this is the earliest occasion that the screen style manager can be obtained by calling `context.getWizardContext().getStyleManager()`.

    Parameters:
      `context` - the context.

  - ### createComponent

    JComponent createComponent()
    Create the UI component for the style. Depending on the return value of the `VisualContainerBean.isFillHorizontal()` and the `VisualContainerBean.isFillVertical()` methods, the component grows to fill all available horizontal or vertical space. The method must not return `null`.

    Never call this method yourself. For nested styles, call `StyleManager.createStyleComponent(Style)` instead.

    Each screen style is only instantiated once, and this method is called multiple times for each screen that uses the style. In console or unattended mode, this method is never called.

    Returns:
      the UI component
    See Also:
      - `VisualContainerBean.isFillHorizontal()`
      - `VisualContainerBean.isFillVertical()`
      - `NestedStyleContainer`

  - ### isStandalone

    boolean isStandalone()
    Returns if the screen style is intended to by applied to installer applications, screens and screen groups. Only standalone styles are available in the corresponding screen style selectors and can be set as the default style. If this method returns `false`, the screen style can only be nested into other styles.
    Returns:
      `true` or `false`

  - ### willActivate

    void willActivate()
    This method is called by the framework just before a screen with this screen style is activated. This call has to be delegated to nested styles by using `StyleManager.willActivate(Style)`.
    See Also:
      - `Screen.willActivate()`

  - ### activated

    void activated()
    This method is called by the framework just after a screen with this screen style has been activated. This call has to be delegated to nested styles by using `StyleManager.activated(Style)`
    See Also:
      - `Screen.activated()`

  - ### deactivated

    void deactivated()
    This method is called by the framework just after a screen with this screen style has been deactivated. This call has to be delegated to nested styles by using `StyleManager.deactivated(Style)`