org.eclipse.graphiti.tb
Class TextDecorator

java.lang.Object
  extended by org.eclipse.graphiti.tb.AbstractDecorator
      extended by org.eclipse.graphiti.tb.TextDecorator
All Implemented Interfaces:
ILocation, IDecorator, ITextDecorator

public class TextDecorator
extends AbstractDecorator
implements ITextDecorator

Text decorators can be used to add a text to the visualization of a shape without modifying the dirty state of the displaying editor, see IDecorator.

Since:
0.10

Field Summary
private  IColorConstant backgroundColor
           
private static int DEFAULT_LOCATION
           
private  String fontName
           
private  int fontSize
           
private  IColorConstant foregroundColor
           
private  String text
           
private  int x
           
private  int y
           
 
Constructor Summary
TextDecorator(String text)
          Creates a new text decorator that decorates a shape with the given text.
 
Method Summary
 IColorConstant getBackgroundColor()
          Returns the color that will be used for painting the background of the shape to decorate.
 String getFontName()
          Gets the name of the font used in the decorator.
 int getFontSize()
          Gets the size of the font used in the decorator.
 IColorConstant getForegroundColor()
          Returns the color that will be used for painting the foreground of the shape to decorate.
 String getText()
          Returns the text of the decorator.
 int getX()
          Gets the x value.
 int getY()
          Gets the y value.
 void setBackgroundColor(IColorConstant backgroundColor)
          Sets the color that will be used for painting the background of the text.
 void setFontName(String fontName)
          Sets the name of the font used in the decorator.
 void setFontSize(int fontSize)
          Sets the size of the font used in the decorator.
 void setForegroundColor(IColorConstant foregroundColor)
          Sets the color that will be used for painting the foreground of the text.
 void setText(String text)
          Sets the text or the decorator.
 void setX(int x)
          Sets the x coordinate of this location.
 void setY(int y)
          Sets the y coordinate of this location.
 
Methods inherited from class org.eclipse.graphiti.tb.AbstractDecorator
getMessage, setMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.graphiti.tb.IDecorator
getMessage, setMessage
 

Field Detail

DEFAULT_LOCATION

private static final int DEFAULT_LOCATION
See Also:
Constant Field Values

text

private String text

fontName

private String fontName

fontSize

private int fontSize

y

private int y

x

private int x

foregroundColor

private IColorConstant foregroundColor

backgroundColor

private IColorConstant backgroundColor
Constructor Detail

TextDecorator

public TextDecorator(String text)
Creates a new text decorator that decorates a shape with the given text. The default font used for displaying the text is Arial in size 10, the text will appear by default 4px from the upper left corner of the decorated shape.

Parameters:
text - a String providing the text
Method Detail

getX

public int getX()
Description copied from interface: ILocation
Gets the x value.

Specified by:
getX in interface ILocation
Returns:
the x value of this location

getY

public int getY()
Description copied from interface: ILocation
Gets the y value.

Specified by:
getY in interface ILocation
Returns:
the y value of this location

setX

public void setX(int x)
Description copied from interface: ILocation
Sets the x coordinate of this location.

Specified by:
setX in interface ILocation
Parameters:
x - the new x coordinate

setY

public void setY(int y)
Description copied from interface: ILocation
Sets the y coordinate of this location.

Specified by:
setY in interface ILocation
Parameters:
y - the new y coordinate

getText

public String getText()
Description copied from interface: ITextDecorator
Returns the text of the decorator.

Specified by:
getText in interface ITextDecorator
Returns:
A String containing the text

setText

public void setText(String text)
Description copied from interface: ITextDecorator
Sets the text or the decorator.

Specified by:
setText in interface ITextDecorator
Parameters:
text - A String containing the text

getFontName

public String getFontName()
Description copied from interface: ITextDecorator
Gets the name of the font used in the decorator.

Specified by:
getFontName in interface ITextDecorator
Returns:
A String containing the name of the font.

setFontName

public void setFontName(String fontName)
Description copied from interface: ITextDecorator
Sets the name of the font used in the decorator.

Specified by:
setFontName in interface ITextDecorator
Parameters:
fontName - A String containing the name of the font.

getFontSize

public int getFontSize()
Description copied from interface: ITextDecorator
Gets the size of the font used in the decorator.

Specified by:
getFontSize in interface ITextDecorator
Returns:
An integer defining the size of the font.

setFontSize

public void setFontSize(int fontSize)
Description copied from interface: ITextDecorator
Sets the size of the font used in the decorator.

Specified by:
setFontSize in interface ITextDecorator
Parameters:
fontSize - An integer defining the size of the font.

getForegroundColor

public IColorConstant getForegroundColor()
Description copied from interface: ITextDecorator
Returns the color that will be used for painting the foreground of the shape to decorate. By default (when returning null) the original foreground color of the shape is kept.

Specified by:
getForegroundColor in interface ITextDecorator
Returns:
a IColorConstant defining the color

setForegroundColor

public void setForegroundColor(IColorConstant foregroundColor)
Description copied from interface: ITextDecorator
Sets the color that will be used for painting the foreground of the text. By default (when returning null) the original foreground color of the text is kept.

Specified by:
setForegroundColor in interface ITextDecorator

getBackgroundColor

public IColorConstant getBackgroundColor()
Description copied from interface: ITextDecorator
Returns the color that will be used for painting the background of the shape to decorate. By default (when returning null) the original background color of the shape is kept.

Specified by:
getBackgroundColor in interface ITextDecorator
Returns:
a IColorConstant defining the color

setBackgroundColor

public void setBackgroundColor(IColorConstant backgroundColor)
Description copied from interface: ITextDecorator
Sets the color that will be used for painting the background of the text. By default (when returning null) the original background color of the text is kept.

Specified by:
setBackgroundColor in interface ITextDecorator


Copyright (c) SAP AG 2005, 2012.