Class FieldDecorationRegistry
Clients may specify images for the decorations in several different ways.
Images may be described by their image id in a specified
ImageRegistry
. In this case, the life cycle of the image is managed
by the image registry, and the decoration registry will not attempt to obtain
an image from the image registry until the decoration is actually requested.
In cases where the client has access to an already-created image, the image
itself can be specified when registering the decoration. In this case, the
life cycle should be managed by the specifying client.
- Since:
- 3.2
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Decoration id for the decoration that should be used to cue the user that content proposals are available.static final String
Decoration id for the decoration that should be used to cue the user that a field has an error.static final String
Decoration id for the decoration that should be used to cue the user that a field has an error with quick fix available.static final String
Decoration id for the decoration that should be used to cue the user that a field has additional information.static final String
Decoration id for the decoration that should be used to cue the user that a field is required.static final String
Decoration id for the decoration that should be used to cue the user that a field has a warning. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic FieldDecorationRegistry
Get the default FieldDecorationRegistry.Returns the field decoration registered by the specified id .int
Get the maximum height (in pixels) of any decoration retrieved so far in the registry.int
Get the maximum width (in pixels) of any decoration retrieved so far in the registry.void
registerFieldDecoration
(String id, String description, String imageId) Registers a field decoration using the specified id.void
registerFieldDecoration
(String id, String description, String imageId, ImageRegistry imageRegistry) Registers a field decoration using the specified id.void
registerFieldDecoration
(String id, String description, Image image) Registers a field decoration using the specified id.static void
setDefault
(FieldDecorationRegistry defaultRegistry) Set the default FieldDecorationRegistry.void
Unregisters the field decoration with the specified id.
-
Field Details
-
DEC_CONTENT_PROPOSAL
Decoration id for the decoration that should be used to cue the user that content proposals are available.- See Also:
-
DEC_REQUIRED
Decoration id for the decoration that should be used to cue the user that a field is required.- See Also:
-
DEC_ERROR
Decoration id for the decoration that should be used to cue the user that a field has an error.- See Also:
-
DEC_WARNING
Decoration id for the decoration that should be used to cue the user that a field has a warning.- See Also:
-
DEC_INFORMATION
Decoration id for the decoration that should be used to cue the user that a field has additional information.- Since:
- 3.3
- See Also:
-
DEC_ERROR_QUICKFIX
Decoration id for the decoration that should be used to cue the user that a field has an error with quick fix available.- Since:
- 3.3
- See Also:
-
-
Constructor Details
-
FieldDecorationRegistry
public FieldDecorationRegistry()Construct a FieldDecorationRegistry.
-
-
Method Details
-
getDefault
Get the default FieldDecorationRegistry.- Returns:
- the singleton FieldDecorationRegistry that is used to manage shared field decorations.
-
setDefault
Set the default FieldDecorationRegistry.- Parameters:
defaultRegistry
- the singleton FieldDecorationRegistry that is used to manage shared field decorations.
-
getMaximumDecorationWidth
public int getMaximumDecorationWidth()Get the maximum width (in pixels) of any decoration retrieved so far in the registry. This value changes as decorations are added and retrieved. This value can be used by clients to reserve space or otherwise compute margins when aligning non-decorated fields with decorated fields.- Returns:
- the maximum width in pixels of any accessed decoration
-
getMaximumDecorationHeight
public int getMaximumDecorationHeight()Get the maximum height (in pixels) of any decoration retrieved so far in the registry. This value changes as decorations are added and retrieved. This value can be used by clients to reserve space or otherwise compute margins when aligning non-decorated fields with decorated fields.- Returns:
- the maximum height in pixels of any accessed decoration
-
registerFieldDecoration
Registers a field decoration using the specified id. The lifecyle of the supplied image should be managed by the client. That is, it will never be disposed by this registry and the decoration should be removed from the registry if the image is ever disposed elsewhere.- Parameters:
id
- the String id used to identify and access the decoration.description
- the String description to be used in the decoration, ornull
if the decoration has no description.image
- the image to be used in the decoration
-
registerFieldDecoration
Registers a field decoration using the specified id. An image id of an image located in the default JFaceResources image registry is supplied. The image will not be created until the decoration is requested.- Parameters:
id
- the String id used to identify and access the decoration.description
- the String description to be used in the decoration, ornull
if the decoration has no description. *imageId
- the id of the image in the JFaceResources image registry that is used for this decorator
-
registerFieldDecoration
public void registerFieldDecoration(String id, String description, String imageId, ImageRegistry imageRegistry) Registers a field decoration using the specified id. An image id and an image registry are supplied. The image will not be created until the decoration is requested.- Parameters:
id
- the String id used to identify and access the decoration.description
- the String description to be used in the decoration, ornull
if the decoration has no description. *imageId
- the id of the image in the supplied image registry that is used for this decoratorimageRegistry
- the registry used to obtain the image
-
unregisterFieldDecoration
Unregisters the field decoration with the specified id. No lifecycle management is performed on the decoration's image. This message has no effect if no field decoration with the specified id was previously registered.This method need not be called if the registered decoration's image is managed in an image registry. In that case, leaving the decoration in the registry will do no harm since the image will remain valid and will be properly disposed when the application is shut down. This method should be used in cases where the caller intends to dispose of the image referred to by the decoration, or otherwise determines that the decoration should no longer be used.
- Parameters:
id
- the String id of the decoration to be unregistered.
-
getFieldDecoration
Returns the field decoration registered by the specified id .- Parameters:
id
- the String id used to access the decoration.- Returns:
- the FieldDecoration with the specified id, or
null
if there is no decoration with the specified id.
-