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

## Class EEFStyleHelper

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

    public class EEFStyleHelper
    extends java.lang.Object

This utility class contains various helper method to manipulate styles.

### Nested Class Summary

Nested Classes
`static interface` `EEFStyleHelper.IEEFTextStyleCallback` This class will be called to update the style of the text.

### Constructor Summary

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

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `applyTextStyle(java.lang.String fontNameExpression, java.lang.String fontSizeExpression, java.lang.String fontStyleExpression, org.eclipse.swt.graphics.Font defaultFont, java.lang.String backgroundColorExpression, java.lang.String foregroundColorExpression, EEFStyleHelper.IEEFTextStyleCallback callback)` Uses the given expressions to update the style using the given callback.
`protected org.eclipse.emf.ecore.util.Switch<EEFWidgetStyle>` `getConditionalStyleToWidgetStyleSwitch()` Returns the switch to use to find the style of a conditional style.
`protected org.eclipse.emf.ecore.util.Switch<java.util.List<EEFConditionalStyle>>` `getDescriptionToConditionalStylesSwitch()` Returns the switch to use to find the conditional styles of a widget description.
`protected org.eclipse.emf.ecore.util.Switch<EEFWidgetStyle>` `getDescriptionToWidgetStyleSwitch()` Returns the switch to use to find the style of a description.
`EEFWidgetStyle` `getWidgetStyle(EEFWidgetDescription widgetDescription)` Returns the widget style to use from the given widget description.

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

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

### Constructor Detail

#### EEFStyleHelper

    public EEFStyleHelper(org.eclipse.sirius.common.interpreter.api.IInterpreter interpreter,
                          org.eclipse.sirius.common.interpreter.api.IVariableManager variableManager)

The constructor.

Parameters:
  `interpreter` - The interpreter
  `variableManager` - The variable manager

### Method Detail

#### getWidgetStyle

    public EEFWidgetStyle getWidgetStyle(EEFWidgetDescription widgetDescription)

Returns the widget style to use from the given widget description.

Parameters:
  `widgetDescription` - The widget description
Returns:
  The widget style to use

#### getDescriptionToConditionalStylesSwitch

    protected org.eclipse.emf.ecore.util.Switch<java.util.List<EEFConditionalStyle>> getDescriptionToConditionalStylesSwitch()

Returns the switch to use to find the conditional styles of a widget description. The switch returned should be able to handle the default use case, as a result it is highly recommended to return a composed switch with the default one and new switches. Example:
`return new ComposedSwitch<>(Arrays.asList(new EEFDescriptionToConditionalStylesSwitch(), new CustomDescriptionToConditionalStylesSwitch()));`

Returns:
  The switch to use to find the conditional styles of a widget description

#### getConditionalStyleToWidgetStyleSwitch

    protected org.eclipse.emf.ecore.util.Switch<EEFWidgetStyle> getConditionalStyleToWidgetStyleSwitch()

Returns the switch to use to find the style of a conditional style. The switch returned should be able to handle the default use case, as a result it is highly recommended to return a composed switch with the default one and new switches. Example:
`return new ComposedSwitch<>(Arrays.asList(new EEFConditionalStyleToWidgetStyleSwitch(), new CustomConditionalStyleToWidgetStyleSwitch()));`

Returns:
  The switch to use to find the style of a conditional style

#### getDescriptionToWidgetStyleSwitch

    protected org.eclipse.emf.ecore.util.Switch<EEFWidgetStyle> getDescriptionToWidgetStyleSwitch()

Returns the switch to use to find the style of a description. The switch returned should be able to handle the default use case, as a result it is highly recommended to return a composed switch with the default one and new switches. Example:
`return new ComposedSwitch<>(Arrays.asList(new EEFDescriptionToWidgetStyleSwitch(), new EEFDescriptionToWidgetStyleSwitch()));`

Returns:
  The switch to use to find the style of a description.

#### applyTextStyle

    public void applyTextStyle(java.lang.String fontNameExpression,
                               java.lang.String fontSizeExpression,
                               java.lang.String fontStyleExpression,
                               org.eclipse.swt.graphics.Font defaultFont,
                               java.lang.String backgroundColorExpression,
                               java.lang.String foregroundColorExpression,
                               EEFStyleHelper.IEEFTextStyleCallback callback)

Uses the given expressions to update the style using the given callback.

Parameters:
  `fontNameExpression` - The expression used to compute the name of the font
  `fontSizeExpression` - The expression used to compute the size of the font
  `fontStyleExpression` - The expression used to compute the style of the font
  `defaultFont` - The default font
  `backgroundColorExpression` - The expression used to compute the background color of the font
  `foregroundColorExpression` - The expression used to compute the foreground color of the font
  `callback` - The callback which will be called when a property of the style has been computed