|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.AbstractCustomLabelPainter y.view.HtmlLabelConfiguration
public class HtmlLabelConfiguration
Label configuration for displaying HTML formatted label text.
The configuration uses Swing components to measure and render HTML formatted
text. By default, the Swing component used is a shared JLabel
instance but may be changed to (possibly shared) JEditorPane
instance
using the configuration's
single argument constructor
.
The configuration provides support for hyperlink events, too.
If label text is not recognized as being HTML formatted (i.e.
BasicHTML.isHTMLString(String)
returns false
),
the default plain text label handling will be used.
handleLabelEvent(YLabel, Mouse2DEvent, javax.swing.event.HyperlinkListener)
,
HtmlLabelConfiguration.LabelHyperlinkEvent
Nested Class Summary | |
---|---|
static class |
HtmlLabelConfiguration.LabelHyperlinkEvent
Used to notify interested parties of label hyper link events. |
Constructor Summary | |
---|---|
HtmlLabelConfiguration()
Initialize a new HtmlLabelConfiguration instance. |
|
HtmlLabelConfiguration(javax.swing.JEditorPane editorPane)
Initialize a new HtmlLabelConfiguration instance. |
Method Summary | |
---|---|
void |
calculateContentSize(YLabel label,
java.awt.font.FontRenderContext frc)
Delegating method of YLabel.calculateSize(java.awt.font.FontRenderContext) |
void |
calcUnionRect(YLabel label,
java.awt.geom.Rectangle2D r)
Delegating method of YLabel.calcUnionRect(java.awt.geom.Rectangle2D) |
boolean |
contains(YLabel label,
double x,
double y)
Delegating method of YLabel.contains(double, double) |
protected javax.swing.JComponent |
getConfiguredHtmlComponent(YLabel label)
Return the JComponent that is used to measure and render
HTML formatted text. |
OrientedRectangle |
getIconBox(YLabel label)
Delegating method of YLabel.getIconBox() . |
OrientedRectangle |
getTextBox(YLabel label)
Delegating method of YLabel.getTextBox() . |
void |
handleLabelEvent(YLabel label,
Mouse2DEvent event,
javax.swing.event.HyperlinkListener callback)
Determines whether or not the specified mouse event will raise a hyperlink event for the specified label. |
void |
paintContent(YLabel label,
java.awt.Graphics2D gfx,
double x,
double y,
double width,
double height)
Delegating method of YLabel.paintContent(java.awt.Graphics2D, double, double, double, double) |
protected void |
paintIcon(java.awt.Graphics2D gfx,
javax.swing.Icon icon,
double x,
double y)
|
Methods inherited from class y.view.AbstractCustomLabelPainter |
---|
asAutoFlippingPainter, getBackgroundColor, getBackgroundPaint, getLineColor, getLinePaint, getLineStroke, initializeBackground, initializeLine, isAutoFlippingEnabled, paint, paintBox, paintSelectionBox, setAutoFlippingEnabled |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface y.view.YLabel.Painter |
---|
getIconBox, getTextBox, paint, paintBox, paintContent |
Methods inherited from interface y.view.YLabel.Layout |
---|
calculateContentSize, contains |
Methods inherited from interface y.view.YLabel.BoundsProvider |
---|
calcUnionRect |
Constructor Detail |
---|
public HtmlLabelConfiguration()
HtmlLabelConfiguration
instance.
This instance will use JLabel
to render HTML formatted text.
public HtmlLabelConfiguration(javax.swing.JEditorPane editorPane)
HtmlLabelConfiguration
instance.
This instance will use JEditorPane
to render HTML formatted text.
editorPane
- the JEditorPane
instance to render HTML
formatted text. If null
, a shared default instance of
JEditorPane
will be used.Method Detail |
---|
protected javax.swing.JComponent getConfiguredHtmlComponent(YLabel label)
JComponent
that is used to measure and render
HTML formatted text.
label
- the YLabel
that is measured or rendered by
this configuration.
JLabel
or a JEditorPane
instance.public void handleLabelEvent(YLabel label, Mouse2DEvent event, javax.swing.event.HyperlinkListener callback)
Hyperlink events raised by this method will be of type
HtmlLabelConfiguration.LabelHyperlinkEvent
.
The source
of the specified mouse event will be the
source
of the raised hyperlink event.
label
- the YLabel
to check.event
- the triggering mouse event.callback
- the listener to process the raised hyperlink event.public void calcUnionRect(YLabel label, java.awt.geom.Rectangle2D r)
YLabel.BoundsProvider
YLabel.calcUnionRect(java.awt.geom.Rectangle2D)
calcUnionRect
in interface YLabel.BoundsProvider
label
- the label contextr
- the bounds to updatepublic void paintContent(YLabel label, java.awt.Graphics2D gfx, double x, double y, double width, double height)
YLabel.Painter
YLabel.paintContent(java.awt.Graphics2D, double, double, double, double)
paintContent
in interface YLabel.Painter
label
- the label contextprotected void paintIcon(java.awt.Graphics2D gfx, javax.swing.Icon icon, double x, double y)
public OrientedRectangle getTextBox(YLabel label)
YLabel.Painter
YLabel.getTextBox()
.
Note: This method is not used to calculate the text placement in the painter, but rather provides a means to query the painter for text position and orientation.
getTextBox
in interface YLabel.Painter
label
- the label contextpublic OrientedRectangle getIconBox(YLabel label)
YLabel.Painter
YLabel.getIconBox()
.
Note: This method is not used to calculate the icon placement in the painter, but rather provides a means to query the painter for icon position and orientation.
getIconBox
in interface YLabel.Painter
label
- the label contextpublic void calculateContentSize(YLabel label, java.awt.font.FontRenderContext frc)
YLabel.Layout
YLabel.calculateSize(java.awt.font.FontRenderContext)
calculateContentSize
in interface YLabel.Layout
label
- the label contextfrc
- the font render context.public boolean contains(YLabel label, double x, double y)
YLabel.Layout
YLabel.contains(double, double)
contains
in interface YLabel.Layout
label
- the label context.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |