Package org.eclipse.jface.fieldassist

# Class DecoratedField

java.lang.Object
org.eclipse.jface.fieldassist.DecoratedField

Direct Known Subclasses:
  `ContentAssistField`

@Deprecated public class DecoratedField extends Object
Deprecated.
As of 3.3, clients should use `ControlDecoration` instead.
DecoratedField manages image decorations around a control. It allows clients to specify an image decoration and a position for the decoration relative to the field. Decorations may be assigned descriptions, which are shown when the user hovers over the decoration. Clients can decorate any kind of control by supplying a `IControlCreator` to create the control that is decorated.

Decorations always appear on either horizontal side of the field, never above or below it. Decorations can be positioned at the top or bottom of either side. Future implementations may provide additional positioning options for decorations.

By default, DecoratedField will consult the `FieldDecorationRegistry` to determine how much space should be reserved for each decoration. This allows fields with decorations from different sources to align properly on the same dialog, since the registry tracks the size of all decorations registered. Therefore, it is recommended, but not required, that clients of DecoratedField register the decorations used. In cases where alignment between different fields is not a concern, clients can use `setUseMaximumDecorationWidth(false)` and need not register their decorations.

This class is not intended to be subclassed.

Since:
  3.2

## Constructor Summary

Constructors
Constructor
Description
`DecoratedField(Composite parent, int style, IControlCreator controlCreator)`
Deprecated.
Construct a decorated field which is parented by the specified composite and has the given style bits.

## Method Summary

Modifier and Type
Method
Description
`void`
`addFieldDecoration(FieldDecoration decoration, int position, boolean showOnFocus)`
Deprecated.
Adds an image decoration to the field.
`Control`
`getControl()`
Deprecated.
Get the control that is decorated by the receiver.
`Control`
`getLayoutControl()`
Deprecated.
Get the control that represents the decorated field.
`void`
`hideDecoration(FieldDecoration decoration)`
Deprecated.
Hide the specified decoration.
`void`
`hideHover()`
Deprecated.
Hide any hover popups that are currently showing on the control.
`void`
`setUseMaximumDecorationWidth(boolean useMaximumWidth)`
Deprecated.
Set a boolean that indicates whether the receiver should use the decoration registry's maximum decoration width when allocating space for decorations.
`void`
`showDecoration(FieldDecoration decoration)`
Deprecated.
Show the specified decoration.
`void`
`showHoverText(String text)`
Deprecated.
Show the specified text using the same hover dialog as is used to show decorator descriptions.
`void`
`updateDecoration(FieldDecoration decoration)`
Deprecated.
Update the specified decoration.

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

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

## Constructor Details

### DecoratedField

public DecoratedField(Composite parent, int style, IControlCreator controlCreator)
Deprecated.
Construct a decorated field which is parented by the specified composite and has the given style bits. Use the controlCreator to create the specific kind of control that is decorated inside the field.

Parameters:
  `parent` - the parent of the decorated field.
  `style` - the desired style bits for the field.
  `controlCreator` - the IControlCreator used to specify the specific kind of control that is to be decorated.
See Also:
  - `IControlCreator`

## Method Details

### addFieldDecoration

public void addFieldDecoration(FieldDecoration decoration, int position, boolean showOnFocus)
Deprecated.
Adds an image decoration to the field.

Parameters:
  `decoration` - A FieldDecoration describing the image and description for the decoration
  `position` - The SWT constant indicating the position of the decoration relative to the field's control. The position should include style bits describing both the vertical and horizontal orientation. `SWT.LEFT` and `SWT.RIGHT` describe the horizontal placement of the decoration relative to the field, and the constants `SWT.TOP` and `SWT.BOTTOM` describe the vertical alignment of the decoration relative to the field. Decorations always appear on either horizontal side of the field, never above or below it. For example, a decoration appearing on the left side of the field, at the top, is specified as SWT.LEFT | SWT.TOP. If an image decoration already exists in the specified position, it will be replaced by the one specified.
  `showOnFocus` - `true` if the decoration should only be shown when the associated control has focus, `false` if it should always be shown.

### getControl

public Control getControl()
Deprecated.
Get the control that is decorated by the receiver.

Returns:
  the Control decorated by the receiver, or `null` if none has been created yet.

### getLayoutControl

public Control getLayoutControl()
Deprecated.
Get the control that represents the decorated field. This composite should be used to lay out the field within its parent.

Returns:
  the Control that should be layed out in the field's parent's layout. This is typically not the control itself, since additional controls are used to represent the decorations.

### showHoverText

public void showHoverText(String text)
Deprecated.
Show the specified text using the same hover dialog as is used to show decorator descriptions. Normally, a decoration's description text will be shown in an info hover over the field's control whenever the mouse hovers over the decoration. This method can be used to show a decoration's description text at other times (such as when the control receives focus), or to show other text associated with the field.

If there is currently a hover visible, the hover's text will be replaced with the specified text.

Parameters:
  `text` - the text to be shown in the info hover, or `null` if no text should be shown.

### hideHover

public void hideHover()
Deprecated.
Hide any hover popups that are currently showing on the control. Normally, a decoration's description text will be shown in an info hover over the field's control as long as the mouse hovers over the decoration, and will be hidden when the mouse exits the control. This method can be used to hide a hover that was shown using `showHoverText`, or to programatically hide the current decoration hover.

This message has no effect if there is no current hover.

### showDecoration

public void showDecoration(FieldDecoration decoration)
Deprecated.
Show the specified decoration. This message has no effect if the decoration is already showing, or was not already added to the field using `addFieldDecoration`.

Parameters:
  `decoration` - the decoration to be shown.

### hideDecoration

public void hideDecoration(FieldDecoration decoration)
Deprecated.
Hide the specified decoration. This message has no effect if the decoration is already hidden, or was not already added to the field using `addFieldDecoration`.

Parameters:
  `decoration` - the decoration to be hidden.

### updateDecoration

public void updateDecoration(FieldDecoration decoration)
Deprecated.
Update the specified decoration. This message should be used if the image or description in the decoration have changed. This message has no immediate effect if the decoration is not visible, and no effect at all if the decoration was not previously added to the field.

Parameters:
  `decoration` - the decoration to be hidden.

### setUseMaximumDecorationWidth

public void setUseMaximumDecorationWidth(boolean useMaximumWidth)
Deprecated.
Set a boolean that indicates whether the receiver should use the decoration registry's maximum decoration width when allocating space for decorations. The default value is `true`. Using the maximum decoration width is useful so that decorated fields on the same dialog that have different decoration widths will all align. This also allows client dialogs to align non-decorated fields with decorated fields by consulting the maximum decoration width.

Clients may wish to set this value to `false` in cases where space usage is more important than alignment of fields. This value must be set before the decorations are added in order to ensure proper alignment.

Parameters:
  `useMaximumWidth` - `true` if the maximum decoration width should be used as the size for all decorations, `false` if only the decoration size should be used.
See Also:
  - `FieldDecorationRegistry.getMaximumDecorationWidth()`