KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > viewers > LabelDecorator


1 /*******************************************************************************
2  * Copyright (c) 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.jface.viewers;
13
14 import org.eclipse.swt.graphics.Image;
15
16 /**
17  * The LabelDecorator is an abstract superclass of ILabelDecorators
18  * that support IDecorationContext.
19  * @see IDecorationContext
20  * @since 3.2
21  *
22  */

23 public abstract class LabelDecorator implements ILabelDecorator {
24     
25      /**
26      * Returns an image that is based on the given image,
27      * but decorated with additional information relating to the state
28      * of the provided element taking into account the provided context.
29      *
30      * Text and image decoration updates can occur as a result of other updates
31      * within the workbench including deferred decoration by background processes.
32      * Clients should handle labelProviderChangedEvents for the given element to get
33      * the complete decoration.
34      * @see LabelProviderChangedEvent
35      * @see IBaseLabelProvider#addListener
36      *
37      * @param image the input image to decorate, or <code>null</code> if the element has no image
38      * @param element the element whose image is being decorated
39      * @param context additional context information about the element being decorated
40      * @return the decorated image, or <code>null</code> if no decoration is to be applied
41      *
42      * @see org.eclipse.jface.resource.CompositeImageDescriptor
43      */

44     public abstract Image decorateImage(Image image, Object JavaDoc element, IDecorationContext context);
45
46     /**
47      * Returns a text label that is based on the given text label,
48      * but decorated with additional information relating to the state
49      * of the provided element taking into account the provided context.
50      *
51      * Text and image decoration updates can occur as a result of other updates
52      * within the workbench including deferred decoration by background processes.
53      * Clients should handle labelProviderChangedEvents for the given element to get
54      * the complete decoration.
55      * @see LabelProviderChangedEvent
56      * @see IBaseLabelProvider#addListener
57      *
58      * @param text the input text label to decorate
59      * @param element the element whose image is being decorated
60      * @param context additional context information about the element being decorated
61      * @return the decorated text label, or <code>null</code> if no decoration is to be applied
62      */

63     public abstract String JavaDoc decorateText(String JavaDoc text, Object JavaDoc element, IDecorationContext context);
64     
65     /**
66      * Prepare the element for decoration. If it is already decorated and ready for update
67      * return true. If decoration is pending return false.
68      * @param element The element to be decorated
69      * @param originalText The starting text.
70      * @param context The decoration context
71      * @return boolean <code>true</code> if the decoration is ready for this element
72      */

73     public abstract boolean prepareDecoration(Object JavaDoc element, String JavaDoc originalText, IDecorationContext context);
74 }
75
Popular Tags