E - component typeU - component UI typeD - decoration typepublic class StyledLabelPainter<E extends WebStyledLabel,U extends WebStyledLabelUI,D extends IDecoration<E,D>> extends AbstractLabelPainter<E,U,D> implements IStyledLabelPainter<E,U>, javax.swing.SwingConstants
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
ignoreColorSettings |
protected int |
preferredRowCount
Style settings.
|
protected boolean |
retrievingPreferredSize |
protected float |
scriptFontRatio |
protected java.util.List<TextRange> |
textRanges
Runtime variables.
|
protected boolean |
truncated |
protected java.lang.String |
truncatedTextSuffix |
drawShade, paintIconR, paintTextR, paintViewR, rotation, shadeColor, shadeSizeancestor, DECORATION_STATES_PROPERTY, decorationCache, decorations, focused, focusStateTracker, hierarchyTracker, hover, hoverStateTracker, neighboursTracker, statescomponent, listeners, ltr, propertyChangeListener, ui| Constructor and Description |
|---|
StyledLabelPainter() |
| Modifier and Type | Method and Description |
|---|---|
java.awt.Dimension |
getContentSize()
Returns label content size.
|
protected int |
getLabelWidth(E label,
java.awt.Insets insets)
Returns current label width considering orientation.
|
protected int |
getLayoutWidth(E label,
int maxWidth)
Returns layout width.
|
protected int |
getMaximumWidth(E label,
int maxWidth,
int natural,
int limited)
Returns maximum width.
|
protected java.awt.Dimension |
getPreferredSizeImpl()
Returns label preferred size.
|
protected java.awt.Dimension |
getPreferredTextSize()
Returns preferred text size.
|
protected int |
getStartX(E label,
int textX,
java.awt.Insets insets)
Returns start X coordinate.
|
protected java.lang.String |
layoutCL(E label,
java.awt.FontMetrics fontMetrics,
java.lang.String text,
javax.swing.Icon icon,
java.awt.Rectangle viewR,
java.awt.Rectangle iconR,
java.awt.Rectangle textR)
Performs label layout and returns clipped or full label text.
|
protected void |
paintDisabledText(E label,
java.awt.Graphics2D g2d,
java.lang.String text,
int textX,
int textY)
Performs disabled text painting.
|
protected void |
paintEnabledText(E label,
java.awt.Graphics2D g2d,
java.lang.String text,
int textX,
int textY)
Performs enabled text painting.
|
protected void |
paintRow(E label,
java.awt.Graphics2D g,
int leftAlignmentX,
int thisLineEndX,
int rightMostX,
int textY,
int startOffset,
int endOffset,
boolean lastRow)
Paints single text row.
|
protected void |
paintStyledText(E label,
java.awt.Graphics2D g,
int textX,
int textY)
Paints styled text.
|
protected void |
paintStyledTextFragment(java.awt.Graphics2D g,
java.lang.String s,
int x,
int y,
boolean displayMnemonic,
int mneIndex,
java.awt.FontMetrics fm2,
StyleRange style,
int strWidth)
Actually paints styled text fragment.
|
protected int |
paintStyledTextImpl(E label,
java.awt.Graphics2D g,
int textX,
int textY,
int w)
Paints styled text.
|
void |
updateTextRanges()
Forces text ranges to be updated according to current style ranges and text.
|
getActualRotation, getCompleteBorder, getPreferredSize, isHtmlText, isOpaqueUndecorated, layout, paintBackground, paintContent, paintHtmlText, paintIcon, paintPlainText, paintShadowText, paintText, transposeDimensionadjustBounds, asList, collectDecorationStates, getBorders, getDecoration, getDecorations, getDecorationSize, getDecorationStates, getSectionPainters, install, installFocusListener, installHierarchyListener, installHoverListener, isDecorated, isDecorationPaintAllowed, isEnabled, isFocused, isHover, isOpaque, isOpaqueDecorated, isPlainBackgroundPaintAllowed, paint, propertyChange, provideShape, uninstall, uninstallFocusListener, uninstallHierarchyListener, uninstallHoverListener, updateDecorationState, usesState, usesStateaddPainterListener, b, borderChange, i, i, i, installPropertyChangeListener, isSectionPainter, isSettingsUpdateAllowed, orientationChange, p, removePainterListener, repaint, repaint, repaint, revalidate, saveOrientation, uninstallPropertyChangeListener, updateAll, updateBorder, updateOpacity, updateOrientationclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddPainterListener, getBorders, getPreferredSize, install, isOpaque, paint, removePainterListener, uninstallprotected int preferredRowCount
protected boolean ignoreColorSettings
protected float scriptFontRatio
protected java.lang.String truncatedTextSuffix
protected final java.util.List<TextRange> textRanges
protected boolean retrievingPreferredSize
protected boolean truncated
public void updateTextRanges()
IStyledLabelPainterupdateTextRanges in interface IStyledLabelPainter<E extends WebStyledLabel,U extends WebStyledLabelUI>protected void paintEnabledText(E label, java.awt.Graphics2D g2d, java.lang.String text, int textX, int textY)
AbstractLabelPainterpaintEnabledText in class AbstractLabelPainter<E extends WebStyledLabel,U extends WebStyledLabelUI,D extends IDecoration<E,D>>label - painted componentg2d - graphics contexttext - label texttextX - text X coordinatetextY - text Y coordinateprotected void paintDisabledText(E label, java.awt.Graphics2D g2d, java.lang.String text, int textX, int textY)
AbstractLabelPainterpaintDisabledText in class AbstractLabelPainter<E extends WebStyledLabel,U extends WebStyledLabelUI,D extends IDecoration<E,D>>label - painted componentg2d - graphics contexttext - label texttextX - text X coordinatetextY - text Y coordinateprotected void paintStyledText(E label, java.awt.Graphics2D g, int textX, int textY)
label - painted labelg - graphics contexttextX - text X coordinatetextY - text Y coordinateprotected int getLabelWidth(E label, java.awt.Insets insets)
label - painted labelinsets - label insetsprotected int paintStyledTextImpl(E label, java.awt.Graphics2D g, int textX, int textY, int w)
label - painted labelg - graphics contexttextX - text X coordinatetextY - text Y coordinatew - painted text max widthprotected void paintStyledTextFragment(java.awt.Graphics2D g,
java.lang.String s,
int x,
int y,
boolean displayMnemonic,
int mneIndex,
java.awt.FontMetrics fm2,
StyleRange style,
int strWidth)
g - graphics contexts - text fragmentx - text X coordinatey - text Y coordinatedisplayMnemonic - whether display mnemonic or notmneIndex - index of mnemonicfm2 - text fragment font metricsstyle - style of text fragmentstrWidth - text fragment widthprotected int getStartX(E label, int textX, java.awt.Insets insets)
label - painted labeltextX - text X coordinateinsets - label insetsprotected void paintRow(E label, java.awt.Graphics2D g, int leftAlignmentX, int thisLineEndX, int rightMostX, int textY, int startOffset, int endOffset, boolean lastRow)
label - painted labelg - graphics contextleftAlignmentX - left alignment X coordinatethisLineEndX - line end X coordinaterightMostX - right most X coordinatetextY - text Y coordinatestartOffset - start offsetendOffset - end offsetlastRow - whether this is the last row or notprotected java.lang.String layoutCL(E label, java.awt.FontMetrics fontMetrics, java.lang.String text, javax.swing.Icon icon, java.awt.Rectangle viewR, java.awt.Rectangle iconR, java.awt.Rectangle textR)
AbstractLabelPainterlayoutCL in class AbstractLabelPainter<E extends WebStyledLabel,U extends WebStyledLabelUI,D extends IDecoration<E,D>>label - painted componentfontMetrics - label font metricstext - label texticon - label iconviewR - rectangle limited by label insetsiconR - icon rectangle dummytextR - text rectangle dummypublic java.awt.Dimension getContentSize()
AbstractLabelPaintergetContentSize in class AbstractLabelPainter<E extends WebStyledLabel,U extends WebStyledLabelUI,D extends IDecoration<E,D>>protected java.awt.Dimension getPreferredSizeImpl()
protected java.awt.Dimension getPreferredTextSize()
protected int getLayoutWidth(E label, int maxWidth)
label - painted labelmaxWidth - maximum widthprotected int getMaximumWidth(E label, int maxWidth, int natural, int limited)
label - painted labelmaxWidth - maximum widthnatural - natural row countlimited - limited row count