1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.g2d.gallery;
14 import org.eclipse.jface.viewers.IBaseLabelProvider;
15 import org.eclipse.swt.SWT;
16 import org.eclipse.swt.graphics.Color;
17 import org.simantics.g2d.image.Image;
19 public interface ILabelProvider extends IBaseLabelProvider {
21 * Returns the image for the label of the given element. The image
22 * is owned by the label provider and must not be disposed directly.
23 * Instead, dispose the label provider when no longer needed.
25 * @param element the element for which to provide the label image
26 * @return the image used to label the element, or <code>null</code>
27 * if there is no image for the given object
29 public Image getImage(Object element);
32 * Returns the text for the label of the given element.
34 * @param element the element for which to provide the label text
35 * @return the text string used to label the element, or <code>null</code>
36 * if there is no text label for the given object
38 public String getText(Object element);
41 * Get the image displayed in the tool tip for object.
44 * <b>If {@link #getToolTipText(Object)} and
45 * {@link #getToolTipImage(Object)} both return <code>null</code> the
46 * control is set back to standard behavior</b>
50 * the element for which the tool tip is shown
51 * @return {@link Image} or <code>null</code> if there is not image.
54 public java.awt.Image getToolTipImage(Object object);
57 * Get the text displayed in the tool tip for object.
60 * <b>If {@link #getToolTipText(Object)} and
61 * {@link #getToolTipImage(Object)} both return <code>null</code> the
62 * control is set back to standard behavior</b>
66 * the element for which the tool tip is shown
67 * @return the {@link String} or <code>null</code> if there is not text to
70 public String getToolTipText(Object element);
73 * Return the background color used for the tool tip
76 * the {@link Object} for which the tool tip is shown
78 * @return the {@link Color} used or <code>null</code> if you want to use
79 * the default color {@link SWT#COLOR_INFO_BACKGROUND}
80 * @see SWT#COLOR_INFO_BACKGROUND
82 public Color getToolTipBackgroundColor(Object object);
85 * The foreground color used to display the the text in the tool tip
88 * the {@link Object} for which the tool tip is shown
89 * @return the {@link Color} used or <code>null</code> if you want to use
90 * the default color {@link SWT#COLOR_INFO_FOREGROUND}
91 * @see SWT#COLOR_INFO_FOREGROUND
93 public Color getToolTipForegroundColor(Object object);