Package org.eclipse.graphiti.tb
Class TextDecorator
java.lang.Object
org.eclipse.graphiti.tb.AbstractDecorator
org.eclipse.graphiti.tb.TextDecorator
- All Implemented Interfaces:
ILocation
,IDecorator
,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
-
Constructor Summary
ConstructorDescriptionTextDecorator
(String text) Creates a new text decorator that decorates a shape with the given text. -
Method Summary
Modifier and TypeMethodDescriptionReturns the color that will be used for painting the background of the shape to decorate.Gets the name of the font used in the decorator.int
Gets the size of the font used in the decorator.Returns the color that will be used for painting the foreground of the shape to decorate.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
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
-
Constructor Details
-
TextDecorator
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
- aString
providing the text
-
-
Method Details
-
getX
public int getX()Description copied from interface:ILocation
Gets the x value. -
getY
public int getY()Description copied from interface:ILocation
Gets the y value. -
setX
public void setX(int x) Description copied from interface:ILocation
Sets the x coordinate of this location. -
setY
public void setY(int y) Description copied from interface:ILocation
Sets the y coordinate of this location. -
getText
Description copied from interface:ITextDecorator
Returns the text of the decorator.- Specified by:
getText
in interfaceITextDecorator
- Returns:
- A
String
containing the text
-
setText
Description copied from interface:ITextDecorator
Sets the text or the decorator.- Specified by:
setText
in interfaceITextDecorator
- Parameters:
text
- AString
containing the text
-
getFontName
Description copied from interface:ITextDecorator
Gets the name of the font used in the decorator.- Specified by:
getFontName
in interfaceITextDecorator
- Returns:
- A
String
containing the name of the font.
-
setFontName
Description copied from interface:ITextDecorator
Sets the name of the font used in the decorator.- Specified by:
setFontName
in interfaceITextDecorator
- Parameters:
fontName
- AString
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 interfaceITextDecorator
- 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 interfaceITextDecorator
- Parameters:
fontSize
- An integer defining the size of the font.
-
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 returningnull
) the original foreground color of the shape is kept.- Specified by:
getForegroundColor
in interfaceITextDecorator
- Returns:
- a
IColorConstant
defining the color
-
setForegroundColor
Description copied from interface:ITextDecorator
Sets the color that will be used for painting the foreground of the text. By default (when returningnull
) the original foreground color of the text is kept.- Specified by:
setForegroundColor
in interfaceITextDecorator
-
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 returningnull
) the original background color of the shape is kept.- Specified by:
getBackgroundColor
in interfaceITextDecorator
- Returns:
- a
IColorConstant
defining the color
-
setBackgroundColor
Description copied from interface:ITextDecorator
Sets the color that will be used for painting the background of the text. By default (when returningnull
) the original background color of the text is kept.- Specified by:
setBackgroundColor
in interfaceITextDecorator
-