|
Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.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(JEditorPane editorPane)
Initialize a new HtmlLabelConfiguration instance. |
|
| Method Summary | |
|---|---|
void |
calculateContentSize(YLabel label,
FontRenderContext frc)
Delegating method of YLabel.calculateSize(java.awt.font.FontRenderContext) |
void |
calcUnionRect(YLabel label,
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 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,
HyperlinkListener callback)
Determines whether or not the specified mouse event will raise a hyperlink event for the specified label. |
void |
paintContent(YLabel label,
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(Graphics2D gfx,
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(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 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,
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,
Rectangle2D r)
YLabel.BoundsProviderYLabel.calcUnionRect(java.awt.geom.Rectangle2D)
calcUnionRect in interface YLabel.BoundsProviderlabel - the label contextr - the bounds to update
public void paintContent(YLabel label,
Graphics2D gfx,
double x,
double y,
double width,
double height)
YLabel.PainterYLabel.paintContent(java.awt.Graphics2D, double, double, double, double)
paintContent in interface YLabel.Painterlabel - the label context
protected void paintIcon(Graphics2D gfx,
Icon icon,
double x,
double y)
public OrientedRectangle getTextBox(YLabel label)
YLabel.PainterYLabel.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.Painterlabel - the label contextpublic OrientedRectangle getIconBox(YLabel label)
YLabel.PainterYLabel.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.Painterlabel - the label context
public void calculateContentSize(YLabel label,
FontRenderContext frc)
YLabel.LayoutYLabel.calculateSize(java.awt.font.FontRenderContext)
calculateContentSize in interface YLabel.Layoutlabel - the label contextfrc - the font render context.
public boolean contains(YLabel label,
double x,
double y)
YLabel.LayoutYLabel.contains(double, double)
contains in interface YLabel.Layoutlabel - the label context.
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||