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 java.lang.Object` `getWidgetSemanticElement()` Returns the semantic element of the current widget.
`protected boolean` `isEnabled()` Check if a widget is enabled.
`protected void` `lockedByMe()` Sets the appearance and behavior of the widget in order to indicate that the semantic element used by the widget is currently locked by the current user.
`protected void` `lockedByOther()` Sets the appearance and behavior of the widget in order to indicate that the semantic element used by the widget is currently locked by another user.
`protected boolean` `needSeparatedLabel()` Indicates if the widget should create a label widget for its label.
`void` `refresh()` Refresh the widgets.
`protected abstract void` `setEnabled(boolean isEnabled)` Sets the enablement of the widget.
`protected void` `setLabelFontStyle()` Set label font style.
`protected void` `unlocked()` Sets the appearance and behavior of the widget in order to indicate that the semantic element used by the widget is currently unlocked.

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

`getValidationControl`

### 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()`

#### getWidgetSemanticElement

    protected java.lang.Object getWidgetSemanticElement()

Returns the semantic element of the current widget.

Returns:
  The semantic element of the current widget

#### lockedByMe

    protected void lockedByMe()

Sets the appearance and behavior of the widget in order to indicate that the semantic element used by the widget is currently locked by the current user. By default, it will only display a small green lock next to the validation control.

#### lockedByOther

    protected void lockedByOther()

Sets the appearance and behavior of the widget in order to indicate that the semantic element used by the widget is currently locked by another user. As a result, it will set the user interface in a disabled mode along with a red lock next to the widget.

#### unlocked

    protected void unlocked()

Sets the appearance and behavior of the widget in order to indicate that the semantic element used by the widget is currently unlocked. As a result, it will set back the widget to its default state.

#### setEnabled

    protected abstract void setEnabled(boolean isEnabled)

Sets the enablement of the widget.

Parameters:
  `isEnabled` - `true` when the widget should have its default behavior, `false` when the widget should be in a read only mode.

#### isEnabled

    protected boolean isEnabled()

Check if a widget is enabled.

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

#### 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

#### refresh

    public void refresh()

Refresh the widgets.

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

#### 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