org.eclipse.eef.ide.ui.api.widgets

## Class AbstractEEFWidgetLifecycleManager

- java.lang.Object
- - org.eclipse.eef.ide.ui.api.widgets.AbstractEEFLifecycleManager
  - - org.eclipse.eef.ide.ui.api.widgets.AbstractEEFWidgetLifecycleManager

All Implemented Interfaces:
  IEEFLifecycleManager

Direct Known Subclasses:
  EEFButtonLifecycleManager, EEFCheckboxLifecycleManager, EEFHyperlinkLifecycleManager, EEFLabelLifecycleManager, EEFListLifecycleManager, EEFRadioLifecycleManager, EEFSelectLifecycleManager, EEFTextLifecycleManager

    public abstract class AbstractEEFWidgetLifecycleManager
    extends AbstractEEFLifecycleManager

Parent of all the lifecycle managers.

### Field Summary

Fields
`protected EditingContextAdapter` `contextAdapter` The editing context adapter.
`protected org.eclipse.swt.custom.CLabel` `help` The help label.
`protected org.eclipse.sirius.common.interpreter.api.IInterpreter` `interpreter` The interpreter.
`protected org.eclipse.swt.custom.StyledText` `label` The label.
`protected static int` `VALIDATION_MARKER_OFFSET` The number of pixel of the additional gap necessary to draw the validation marker.
`protected org.eclipse.sirius.common.interpreter.api.IVariableManager` `variableManager` The variable manager.

### Fields inherited from class org.eclipse.eef.ide.ui.api.widgets.AbstractEEFLifecycleManager

`container`

### Constructor Summary

Constructors
Constructor and Description
`AbstractEEFWidgetLifecycleManager(org.eclipse.sirius.common.interpreter.api.IVariableManager variableManager, org.eclipse.sirius.common.interpreter.api.IInterpreter interpreter, EditingContextAdapter contextAdapter)` The constructor.

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`void` `aboutToBeHidden()` Prepares for the widgets to be hidden.
`void` `aboutToBeShown()` Prepares for the widgets to be shown.
`void` `createControl(org.eclipse.swt.widgets.Composite parent, IEEFFormContainer formContainer)` Creates the controls for the description.
`protected abstract void` `createMainControl(org.eclipse.swt.widgets.Composite parent, IEEFFormContainer formContainer)` Create the main control.
`void` `dispose()` Disposes the content created.
`protected abstract IEEFWidgetController` `getController()` Returns the controller.
`protected EEFStyleHelper` `getEEFStyleHelper()` Returns the style helper used to compute the style of the widget.
`protected int` `getLabelVerticalAlignment()` Returns the vertical alignment of the label of the widget.
`protected org.eclipse.jface.viewers.IStructuredSelection` `getStructuredSelection(org.eclipse.jface.viewers.StructuredViewer viewer)` Returns the `IStructuredSelection` of the specified viewer.
`protected abstract EEFWidgetDescription` `getWidgetDescription()` Returns the description of the widget.
`protected boolean` `isEnabled()` Check if a widget is enabled.
`protected boolean` `needSeparatedLabel()` Indicates if the widget should create a label widget for its label.
`protected void` `setLabelFontStyle()` Set label font style.

### Methods inherited from class org.eclipse.eef.ide.ui.api.widgets.AbstractEEFLifecycleManager

`getValidationControl, refresh`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### VALIDATION_MARKER_OFFSET

    protected static final int VALIDATION_MARKER_OFFSET

The number of pixel of the additional gap necessary to draw the validation marker.

See Also:
  Constant Field Values

#### variableManager

    protected org.eclipse.sirius.common.interpreter.api.IVariableManager variableManager

The variable manager.

#### interpreter

    protected org.eclipse.sirius.common.interpreter.api.IInterpreter interpreter

The interpreter.

#### contextAdapter

    protected EditingContextAdapter contextAdapter

The editing context adapter.

#### label

    protected org.eclipse.swt.custom.StyledText label

The label.

#### help

    protected org.eclipse.swt.custom.CLabel help

The help label.

### Constructor Detail

#### AbstractEEFWidgetLifecycleManager

    public AbstractEEFWidgetLifecycleManager(org.eclipse.sirius.common.interpreter.api.IVariableManager variableManager,
                                             org.eclipse.sirius.common.interpreter.api.IInterpreter interpreter,
                                             EditingContextAdapter contextAdapter)

The constructor.

Parameters:
  `variableManager` - The variable manager
  `interpreter` - The interpreter
  `contextAdapter` - The editing context adapter

### Method Detail

#### createControl

    public void createControl(org.eclipse.swt.widgets.Composite parent,
                              IEEFFormContainer formContainer)

Creates the controls for the description.

Specified by:
  `createControl` in interface `IEEFLifecycleManager`
Overrides:
  `createControl` in class `AbstractEEFLifecycleManager`
Parameters:
  `parent` - The composite parent
  `formContainer` - The form container
See Also:
  `AbstractEEFLifecycleManager.createControl(org.eclipse.swt.widgets.Composite, org.eclipse.eef.common.ui.api.IEEFFormContainer)`

#### needSeparatedLabel

    protected boolean needSeparatedLabel()

Indicates if the widget should create a label widget for its label.

Returns:
  `true` if a label should be created, `false` otherwise.

#### getLabelVerticalAlignment

    protected int getLabelVerticalAlignment()

Returns the vertical alignment of the label of the widget. Use one of the following values:

- GridData.VERTICAL_ALIGN_BEGINNING
- GridData.VERTICAL_ALIGN_CENTER
- GridData.VERTICAL_ALIGN_END

Returns:
  The vertical alignment of the label of the widget

#### getController

    protected abstract IEEFWidgetController getController()

Returns the controller.

Specified by:
  `getController` in class `AbstractEEFLifecycleManager`
Returns:
  The controller
See Also:
  `AbstractEEFLifecycleManager.getController()`

#### getWidgetDescription

    protected abstract EEFWidgetDescription getWidgetDescription()

Returns the description of the widget.

Returns:
  The description of the widget

#### createMainControl

    protected abstract void createMainControl(org.eclipse.swt.widgets.Composite parent,
                                              IEEFFormContainer formContainer)

Create the main control.

Parameters:
  `parent` - The composite parent
  `formContainer` - The form container

#### aboutToBeShown

    public void aboutToBeShown()

Prepares for the widgets to be shown.

Specified by:
  `aboutToBeShown` in interface `IEEFLifecycleManager`
Overrides:
  `aboutToBeShown` in class `AbstractEEFLifecycleManager`
See Also:
  `AbstractEEFLifecycleManager.aboutToBeShown()`

#### setLabelFontStyle

    protected void setLabelFontStyle()

Set label font style.

#### getEEFStyleHelper

    protected EEFStyleHelper getEEFStyleHelper()

Returns the style helper used to compute the style of the widget.

Returns:
  The style helper

#### aboutToBeHidden

    public void aboutToBeHidden()

Prepares for the widgets to be hidden.

Specified by:
  `aboutToBeHidden` in interface `IEEFLifecycleManager`
Overrides:
  `aboutToBeHidden` in class `AbstractEEFLifecycleManager`
See Also:
  `AbstractEEFLifecycleManager.aboutToBeHidden()`

#### dispose

    public void dispose()

Disposes the content created. The widgets created under the composite will be disposed by SWT already.

See Also:
  `IEEFLifecycleManager.dispose()`

#### getStructuredSelection

    protected org.eclipse.jface.viewers.IStructuredSelection getStructuredSelection(org.eclipse.jface.viewers.StructuredViewer viewer)
                                                                             throws java.lang.ClassCastException

Returns the `IStructuredSelection` of the specified viewer.

Backport of `StructuredViewer.getStructuredSelection()` which was introduced in JFace 3.11 (Mars) to work with JFace 3.10 (Luna).

Parameters:
  `viewer` - the viewer.
Returns:
  IStructuredSelection
Throws:
  `java.lang.ClassCastException` - if the selection of the viewer is not an instance of IStructuredSelection

#### isEnabled

    protected boolean isEnabled()

Check if a widget is enabled.

Returns:
  True if the widget should be enabled otherwise false.