|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.view.YLabel
public abstract class YLabel
This class encapsulates a multi-line text label. There are specialized classes handling labels for nodes and edges.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
| Nested Class Summary | |
|---|---|
static interface |
YLabel.BoundsProvider
The interface that is used by a specific label configuration that calculates the union bounds of a label and a given rectangle. |
static class |
YLabel.Factory
This class is used for managing the different configurations for YLabel
instances. |
static interface |
YLabel.Layout
The interface that is used by a specific label configuration that calculates the layout size and determines whether a given point is contained in a label's geometry. |
static interface |
YLabel.Painter
The interface that is used by a specific label configuration that performs the painting. |
static interface |
YLabel.UserDataHandler
This interface is used during YGF serialization to delegate the copying and serialization/deserialization of any user-defined data to. |
| Field Summary | |
|---|---|
static byte |
ALIGN_CENTER
Vertical text alignment constant. |
static byte |
ALIGN_LEFT
Vertical text alignment constant. |
static byte |
ALIGN_RIGHT
Vertical text alignment constant. |
static byte |
AUTOSIZE_CONTENT
Autosize policy specifier. |
static byte |
AUTOSIZE_NONE
Autosize policy specifier. |
static byte |
BOTTOM_TEXT_POSITION
Vertical text position specifier that places text below the icon. |
static byte |
CENTER_TEXT_POSITION
Vertical and horizontal text position specifier that aligns the center of text and icon either vertically or horizontally. |
protected double |
contentHeight
(including icons, text, etc, rotation not included!) |
protected double |
contentWidth
(including icons, text, etc, rotation not included!) |
static Insets |
defaultInsets
Default insets that define the distance between the bounding box of the label and its content. |
protected double |
height
The height of this label (including icons, text, etc, rotation considered) |
static byte |
LEFT_ALIGNED_TEXT_POSITION
Horizontal text position specifier that aligns the left border of the icon and the text. |
static byte |
LEFT_TEXT_POSITION
Horizontal text position specifier that places text to the left of the icon. |
protected byte |
model
The model constant for the label model. |
protected boolean |
offsetDirty
Whether the offset of the label is up to date or not. |
protected double |
offsetX
The x-coordinate of the label offset. |
protected double |
offsetY
The y-coordinate of the label offset. |
protected byte |
placement
The placement constant for the label model. |
static byte |
RIGHT_ALIGNED_TEXT_POSITION
Horizontal text position specifier that aligns the right border of the icon and the text. |
static byte |
RIGHT_TEXT_POSITION
Horizontal text position specifier that places text to the right of the icon. |
protected boolean |
sizeDirty
Whether the size of the label is up to date or not. |
static byte |
TOP_TEXT_POSITION
Vertical text position specifier that places text above the icon. |
protected double |
width
the width of this label. |
| Constructor Summary | |
|---|---|
protected |
YLabel()
Instantiates a new YLabel. |
| Method Summary | |
|---|---|
void |
adoptValues(YLabel label)
Adopts the values from the given label. |
abstract void |
calculateOffset()
Calculates the offset of this label. |
void |
calculateSize()
Calculates the size of this label |
void |
calculateSize(FontRenderContext frc)
Calculates the size of this label with the help of the given FontRenderContext. |
void |
calcUnionRect(Rectangle2D r)
Enlarges the given rectangle such that it will contain the bounding box of this label. |
boolean |
contains(double x,
double y)
Determines whether the given point in world coordinates is contained within the label's graphics. |
byte |
getAlignment()
Returns the currently set alignment style for multiple lines of label text. |
byte |
getAutoSizePolicy()
Returns the currently set autosize policy for this label. |
Color |
getBackgroundColor()
Returns the background color to be used for painting this label. |
abstract YRectangle |
getBox()
Returns the bounding box of this label. |
String |
getConfiguration()
Returns the string identifier of the current configuration this label is in. |
double |
getContentHeight()
Gets the height of the content area. |
double |
getContentWidth()
Gets the width of the content area. |
Font |
getFont()
Returns the font used for this label. |
String |
getFontName()
Returns the font name of this label. |
int |
getFontSize()
Returns the font size of this label. |
int |
getFontStyle()
Sets the font style for this label. |
double |
getHeight()
Returns the height of the bounding box of this label. |
byte |
getHorizontalTextPosition()
Returns the horizontal position of text relative ot the icon. |
Icon |
getIcon()
Returns the icon that is displayed by this label and If no icon is associated with this label null is returned. |
YPoint |
getIconLocation()
Returns the absolute coordinate of the label icon. |
byte |
getIconTextGap()
Returns the gap between text and icon |
Insets |
getInsets()
Returns the insets for this label. |
Color |
getLineColor()
Returns the color used to draw a border around the bounding box of this label. |
abstract YPoint |
getLocation()
Returns the absolute coordinates of the labels location. |
byte |
getModel()
Returns the model specifier for this label. |
double |
getOffsetX()
Returns the x-coord of the positional offset for this label. |
double |
getOffsetY()
Returns the y-coord of the positional offset for this label. |
byte |
getPosition()
Returns the position specifier for this label. |
double |
getRotationAngle()
Returns the rotation angle for this label. |
String |
getText()
Returns the text of this label |
Color |
getTextColor()
Returns the text color of this label. |
YPoint |
getTextLocation()
Returns the absolute coordinate of the label text. |
Object |
getUserData()
Retrieves the user data object that can be used by the configurations. |
byte |
getVerticalTextPosition()
Returns the vertical position of text relative ot the icon. |
double |
getWidth()
Returns the width of the bounding box of this label. |
boolean |
intersects(double x,
double y,
double width,
double height)
Returns true iff the bounding box of this label
intersects with the given box. |
boolean |
isOffsetDirty()
Returns true if the label offset is
not valid yet. |
boolean |
isSizeDirty()
Returns true if the label size is
not valid yet. |
boolean |
isUnderlinedTextEnabled()
Returns whether or not the text of the label should be underlined. |
boolean |
isVisible()
Whether of not this label is visible. |
void |
paint(Graphics2D gfx)
Paints the YLabel on the given graphics object. |
protected void |
paintBox(Graphics2D gfx,
double x,
double y,
double width,
double height)
Paints the background of the label into the graphics context. |
protected void |
paintContent(Graphics2D gfx,
double x,
double y,
double width,
double height)
Paints the contents of the label into the graphics context. |
protected void |
paintImpl(Graphics2D gfx,
double x,
double y,
double width,
double height)
Called by paint(java.awt.Graphics2D)
Calls paintBox(java.awt.Graphics2D, double, double, double, double)
and paintContent(java.awt.Graphics2D, double, double, double, double)
in order. |
void |
read(ObjectInputStream in)
Reads in the serialized form of this label. |
abstract void |
repaint()
Triggers a repaint of the bounds in the views for this label. |
void |
setAlignment(byte a)
Sets the vertical alignment style for label text that spreads over multiple lines. |
void |
setAutoSizePolicy(byte autoSize)
Sets the autosize policy for this label. |
void |
setBackgroundColor(Color bgColor)
Sets the background color to be used. |
abstract void |
setConfiguration(String name)
Configures this instance to use the configuration specified by the given name. |
void |
setContentHeight(double contentHeight)
Sets the height of the content area. |
void |
setContentSize(double width,
double height)
Sets the size of the content area of this label and updates the width and height properties according
to the current rotation angle. |
void |
setContentWidth(double contentWidth)
Sets the width of the content area. |
void |
setFont(Font f)
Sets the font in which the text of this label gets displayed. |
void |
setFontName(String name)
Sets the font name of this label. |
void |
setFontSize(int s)
Sets the font size for this label. |
void |
setFontStyle(int s)
Sets the font style for this label. |
void |
setHorizontalTextPosition(byte pos)
Sets the horizontal position of text relative to the icon. |
static void |
setHTMLRenderingEnabled(boolean enabled)
Whether or not to enable HTML rendering for labels whose text starts with the html tag <html>. |
void |
setIcon(Icon icon)
Sets the icon that is displayed by this label. |
void |
setIconTextGap(byte gap)
Sets the size of the gap between text and icon |
void |
setInsets(Insets insets)
Sets the insets for this label. |
void |
setLineColor(Color lineColor)
Sets the color used to draw a border around the bounding box of this label. |
void |
setModel(byte m)
Sets a model specifier fo this label. |
abstract void |
setModelParameter(Object value)
Sets the current parameters for the label model implementation. |
void |
setOffset(double x,
double y)
Sets the positional offset for this label. |
void |
setOffsetDirty()
Marks the label offsets as dirty. |
void |
setOffsetX(double x)
Sets the x-coord of the positional offset for this label. |
void |
setOffsetY(double y)
Sets the y-coord of the positional offset for this label. |
void |
setPosition(byte b)
Sets a position specifier for this label. |
void |
setRotationAngle(double angle)
Sets the rotation angle for this label. |
void |
setSizeDirty()
Marks the size of the label as dirty |
void |
setText(String text)
Sets the text being displayed by this label. |
void |
setTextColor(Color c)
Sets the text color of this label. |
void |
setUnderlinedTextEnabled(boolean u)
Sets whether or not to underline the text of the label |
void |
setUserData(Object userData)
Sets the user data object that can be used by the configurations. |
void |
setVerticalTextPosition(byte pos)
Sets the vertical position of text relative to the icon. |
void |
setVisible(boolean vis)
Sets the visibility state of this label. |
String |
toString()
Returns a string representation of this label. |
void |
write(ObjectOutputStream out)
Writes out this label in a serialized form. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final byte ALIGN_LEFT
public static final byte ALIGN_CENTER
public static final byte ALIGN_RIGHT
public static final byte TOP_TEXT_POSITION