Eclipse Platform
Release 3.3

org.eclipse.jface.fieldassist
Class FieldDecorationRegistry

java.lang.Object
  extended byorg.eclipse.jface.fieldassist.FieldDecorationRegistry

public class FieldDecorationRegistry
extends Object

FieldDecorationRegistry is a common registry used to define shared field decorations within an application. Unlike resource registries, the FieldDecorationRegistry does not perform any lifecycle management of the decorations.

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:
FieldDecoration, ImageRegistry

Field Summary
static String DEC_CONTENT_PROPOSAL
          Decoration id for the decoration that should be used to cue the user that content proposals are available.
static String DEC_ERROR
          Decoration id for the decoration that should be used to cue the user that a field has an error.
static String 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.
static String DEC_INFORMATION
          Decoration id for the decoration that should be used to cue the user that a field has additional information.
static String DEC_REQUIRED
          Decoration id for the decoration that should be used to cue the user that a field is required.
static String DEC_WARNING
          Decoration id for the decoration that should be used to cue the user that a field has a warning.
 
Constructor Summary
FieldDecorationRegistry()
          Construct a FieldDecorationRegistry.
 
Method Summary
static FieldDecorationRegistry getDefault()
          Get the default FieldDecorationRegistry.
 FieldDecoration getFieldDecoration(String id)
          Returns the field decoration registered by the specified id .
 int getMaximumDecorationHeight()
          Get the maximum height (in pixels) of any decoration retrieved so far in the registry.
 int getMaximumDecorationWidth()
          Get the maximum width (in pixels) of any decoration retrieved so far in the registry.
 void registerFieldDecoration(String id, String description, Image image)
          Registers a field decoration using the specified id.
 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.
static void setDefault(FieldDecorationRegistry defaultRegistry)
          Set the default FieldDecorationRegistry.
 void unregisterFieldDecoration(String id)
          Unregisters the field decoration with the specified id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEC_CONTENT_PROPOSAL

public static final String DEC_CONTENT_PROPOSAL
Decoration id for the decoration that should be used to cue the user that content proposals are available.

See Also:
Constant Field Values

DEC_REQUIRED

public static final String DEC_REQUIRED
Decoration id for the decoration that should be used to cue the user that a field is required.

See Also:
Constant Field Values

DEC_ERROR

public static final String DEC_ERROR
Decoration id for the decoration that should be used to cue the user that a field has an error.

See Also:
Constant Field Values

DEC_WARNING

public static final String DEC_WARNING
Decoration id for the decoration that should be used to cue the user that a field has a warning.

See Also:
Constant Field Values

DEC_INFORMATION

public static final String 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:
Constant Field Values

DEC_ERROR_QUICKFIX

public static final String 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:
Constant Field Values
Constructor Detail

FieldDecorationRegistry

public FieldDecorationRegistry()
Construct a FieldDecorationRegistry.

Method Detail

getDefault

public static FieldDecorationRegistry getDefault()
Get the default FieldDecorationRegistry.

Returns:
the singleton FieldDecorationRegistry that is used to manage shared field decorations.

setDefault

public static void setDefault(FieldDecorationRegistry defaultRegistry)
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

public void registerFieldDecoration(String id,
                                    String description,
                                    Image image)
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, or null if the decoration has no description.
image - the image to be used in the decoration

registerFieldDecoration

public void registerFieldDecoration(String id,
                                    String description,
                                    String imageId)
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, or null 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, or null if the decoration has no description. *
imageId - the id of the image in the supplied image registry that is used for this decorator
imageRegistry - the registry used to obtain the image

unregisterFieldDecoration

public void unregisterFieldDecoration(String id)
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

public FieldDecoration getFieldDecoration(String id)
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.

Eclipse Platform
Release 3.3

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.