org.eclipse.jface.fieldassist.FieldDecoration Maven / Gradle / Ivy
The newest version!
/*******************************************************************************
* Copyright (c) 2005, 2015 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jface.fieldassist;
import org.eclipse.swt.graphics.Image;
/**
* FieldDecoration is a simple data structure class for specifying a decoration
* for a field. A decoration may be rendered in different ways depending on the
* type of field it is used with.
*
* @see FieldDecorationRegistry
*
* @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 null
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 null
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 null
if no
* image is specified.
*
* @return the image shown in the decoration. A return value of
* null
signifies a blank decoration.
*/
public Image getImage() {
return image;
}
/**
* Set the image shown in the decoration, or null
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
* null
signifies a blank decoration.
*/
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
* null
indicates that no description will be shown.
*/
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
* null
indicates that no description will be
* shown.
*/
public void setDescription(String description) {
this.description = description;
}
}