Eclipse Platform
Release 3.1

org.eclipse.jface.viewers
Class ViewerLabel

java.lang.Object
  extended byorg.eclipse.jface.viewers.ViewerLabel

public class ViewerLabel
extends Object

The ViewerLabel is the class that is passed to a viewer to handle updates of labels. It keeps track of both original and updates text.

Since:
3.0
See Also:
IViewerLabelProvider

Constructor Summary
ViewerLabel(String initialText, Image initialImage)
          Create a new instance of the receiver with the supplied initial text and image.
 
Method Summary
 Color getBackground()
          Get the background Color.
 Font getFont()
          Get the font.
 Color getForeground()
          Get the foreground Color.
 Image getImage()
          Get the image for the receiver.
 String getText()
          Get the text for the receiver.
 boolean hasNewBackground()
          Return whether or not the background color has been set.
 boolean hasNewFont()
          Return whether or not the font has been set.
 boolean hasNewForeground()
          Return whether or not the foreground color has been set.
 boolean hasNewImage()
          Return whether or not the image has been set.
 boolean hasNewText()
          Return whether or not the text has been set.
 void setBackground(Color background)
          Set the background Color.
 void setFont(Font font)
          Set the font.
 void setForeground(Color foreground)
          Set the foreground Color.
 void setImage(Image image)
          Set the image for the receiver.
 void setText(String text)
          Set the text for the receiver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewerLabel

public ViewerLabel(String initialText,
                   Image initialImage)
Create a new instance of the receiver with the supplied initial text and image.

Parameters:
initialText -
initialImage -
Method Detail

getImage

public final Image getImage()
Get the image for the receiver. If the new image has been set return it, otherwise return the starting image.

Returns:
Returns the image.

setImage

public final void setImage(Image image)
Set the image for the receiver.

Parameters:
image - The image to set.

getText

public final String getText()
Get the text for the receiver. If the new text has been set return it, otherwise return the starting text.

Returns:
Returns the text.

setText

public final void setText(String text)
Set the text for the receiver.

Parameters:
text - The label to set.

hasNewImage

public boolean hasNewImage()
Return whether or not the image has been set.

Returns:
boolean. true if the image has been set to something new.
Since:
3.1

hasNewText

public boolean hasNewText()
Return whether or not the text has been set.

Returns:
boolean. true if the text has been set to something new.

hasNewBackground

public boolean hasNewBackground()
Return whether or not the background color has been set.

Returns:
boolean. true if the value has been set.

hasNewForeground

public boolean hasNewForeground()
Return whether or not the foreground color has been set.

Returns:
boolean. true if the value has been set.
Since:
3.1

hasNewFont

public boolean hasNewFont()
Return whether or not the font has been set.

Returns:
boolean. true if the value has been set.
Since:
3.1

getBackground

public Color getBackground()
Get the background Color.

Returns:
Color or null if no new value was set.
Since:
3.1

setBackground

public void setBackground(Color background)
Set the background Color.

Parameters:
background - Color
Since:
3.1

getFont

public Font getFont()
Get the font.

Returns:
Font or null if no new value was set.
Since:
3.1

setFont

public void setFont(Font font)
Set the font.

Parameters:
font - Font
Since:
3.1

getForeground

public Color getForeground()
Get the foreground Color.

Returns:
Color or null if no new value was set.
Since:
3.1

setForeground

public void setForeground(Color foreground)
Set the foreground Color.

Parameters:
foreground -
Since:
3.1

Eclipse Platform
Release 3.1

Guidelines for using Eclipse APIs.

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