# StyleManager

Import: `import com.install4j.api.styles.StyleManager;`

```java
interface StyleManager
```

Helper for working with nested styles.
See [`NestedStyleContainer`](NestedStyleContainer.md) for more information.

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`getStyleById(String)`](#getstylebyid-string) | `Style` | Get the screen style for a specified ID. |
| [`cloneStyleById(String)`](#clonestylebyid-string) | `Style` | Clones a screen style for a specified ID. |
| [`createStyleComponent(Style)`](#createstylecomponent-style) | `JComponent` | Create a screen style component. |
| [`willActivate(Style)`](#willactivate-style) | `void` | Notify a nested screen style that it will be activated. |
| [`activated(Style)`](#activated-style) | `void` | Notify a nested screen style that it has been activated. |
| [`deactivated(Style)`](#deactivated-style) | `void` | Notify a nested screen style that it has been deactivated. |

### getStyleById(String)

```java
Style getStyleById(String styleId)
```

Get the screen style for a specified ID.
If the screen style is a [`FormPanelContainer`](../screens/FormPanelContainer.md), its form panel is not initialized.
Instead of calling [`Style.createComponent`](Style.md#createcomponent), you have to call [`StyleManager.createStyleComponent`](StyleManager.md#createstylecomponent-style) in order
to handle the creation of a form panel.


**Parameters:**

- `styleId` — the ID of the screen style

**Returns:** the screen style

### cloneStyleById(String)

```java
Style cloneStyleById(String styleId)
```

Clones a screen style for a specified ID. This is useful if you want to include multiple
instances of the same screen style within a single style.


**Parameters:**

- `styleId` — the ID of the screen style

**Returns:** the cloned screen style

### createStyleComponent(Style)

```java
JComponent createStyleComponent(Style style)
```

Create a screen style component.
If the screen style is a [`FormPanelContainer`](../screens/FormPanelContainer.md), a new form panel will be set on the screen style
before [`Style.createComponent`](Style.md#createcomponent) is called.


**Parameters:**

- `style` — the screen style

**Returns:** the component

### willActivate(Style)

```java
void willActivate(Style style)
```

Notify a nested screen style that it will be activated. You should call this method in the implementation of
[`Style.willActivate`](Style.md#willactivate). This will call [`FormComponent.formWillActivate`](../formcomponents/FormComponent.md#formwillactivate) on all form components
if the nested screen style is a [`FormPanelContainer`](../screens/FormPanelContainer.md).


**Parameters:**

- `style` — the nested screen style

### activated(Style)

```java
void activated(Style style)
```

Notify a nested screen style that it has been activated. You should call this method in the implementation of
[`Style.activated`](Style.md#activated). This will call [`FormComponent.formActivated`](../formcomponents/FormComponent.md#formactivated) on all form components
if the nested screen style is a [`FormPanelContainer`](../screens/FormPanelContainer.md).


**Parameters:**

- `style` — the nested screen style

### deactivated(Style)

```java
void deactivated(Style style)
```

Notify a nested screen style that it has been deactivated. You should call this method in the implementation of
[`Style.deactivated`](Style.md#deactivated). This will call [`FormComponent.formDeactivated`](../formcomponents/FormComponent.md#formdeactivated) on all form components
if the nested screen style is a [`FormPanelContainer`](../screens/FormPanelContainer.md).


**Parameters:**

- `style` — the nested screen style

