blob: cb968b047c992c03a3cb6f79102a295fc1af758e [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
******************************************************************************/
package org.eclipse.jface.fieldassist;
import org.eclipse.swt.graphics.Image;
/**
* Simple data structure class for specifying a decoration for a field.
*
* <p>
* This API is considered experimental. It is still evolving during 3.2 and is
* subject to change. It is being released to obtain feedback from early
* adopters.
*
* @since 3.2
*/
public class FieldDecoration {
/*
* The image to be shown in the decoration.
*/
private Image image;
/*
* The description to show in the decoration's hover.
*/
private String description;
/**
* Create a decoration for a field with the specified image and description
* text.
*
* @param image
* the image shown in the decoration. A <code>null</code> image
* will result in a blank decoration, which may be used to
* reserve space near the field.
* @param description
* the description shown when the user hovers over the
* decoration. A <code>null</code> description indicates that
* there will be no hover for the decoration.
*/
public FieldDecoration(Image image, String description) {
this.image = image;
this.description = description;
}
/**
* Return the image shown in the decoration, or <code>null</code> if no
* image is specified.
*
* @return the image shown in the decoration. A return value of
* <code>null</code> signifies a blank decoration.
*/
public Image getImage() {
return image;
}
/**
* Set the image shown in the decoration, or <code>null</code> if no image
* is specified. It is up to the caller to update any decorated fields that
* are showing the description in order to display the new image.
*
* @param image
* the image shown in the decoration. A value of
* <code>null</code> signifies a blank decoration.
*
* @see DecoratedField#updateDecoration(FieldDecoration)
*/
public void setImage(Image image) {
this.image = image;
}
/**
* Return the description for the decoration shown when the user hovers over
* the decoration.
*
* @return the String description of the decoration. A return value of
* <code>null</code> indicates that no description will be shown.
*
* @see DecoratedField#updateDecoration(FieldDecoration)
*/
public String getDescription() {
return description;
}
/**
* Set the description for the decoration shown when the user hovers over
* the decoration. It is up to the caller to update any decorated fields
* showing the description.
*
* @param description
* the String description of the decoration. A value of
* <code>null</code> indicates that no description will be
* shown.
*/
public void setDescription(String description) {
this.description = description;
}
}