javax.swing.text.html
public class InlineView extends LabelView
HTML.Tag.CONTENT
). This is
basically a LabelView
that is adjusted to understand styles defined
by stylesheets.GlyphView.GlyphPainter
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
Constructor and Description |
---|
InlineView(Element element)
Creates a new
InlineView that renders the specified element. |
Modifier and Type | Method and Description |
---|---|
View |
breakView(int axis,
int offset,
float pos,
float len)
Tries to break the view near the specified view span
len . |
void |
changedUpdate(DocumentEvent e,
Shape a,
ViewFactory f)
Receives notification that attributes have changed in the document in
a location that this view is responsible for.
|
AttributeSet |
getAttributes()
Returns the attributes that are used for rendering.
|
int |
getBreakWeight(int axis,
float pos,
float len)
Determines how well the specified view location is suitable for inserting
a line break.
|
float |
getMinimumSpan(int axis)
Returns the minimum span for the specified axis.
|
protected StyleSheet |
getStyleSheet()
Returns the stylesheet used by this view.
|
void |
insertUpdate(DocumentEvent e,
Shape a,
ViewFactory f)
Receives notification that something was inserted into the document in
a location that this view is responsible for.
|
void |
removeUpdate(DocumentEvent e,
Shape a,
ViewFactory f)
Receives notification that something was removed from the document in
a location that this view is responsible for.
|
protected void |
setPropertiesFromAttributes()
Loads the character style properties from the stylesheet.
|
getBackground, getFont, getFontMetrics, getForeground, isStrikeThrough, isSubscript, isSuperscript, isUnderline, setBackground, setStrikeThrough, setSubscript, setSuperscript, setUnderline
checkPainter, clone, createFragment, getAlignment, getEndOffset, getGlyphPainter, getNextVisualPositionFrom, getPartialSpan, getPreferredSpan, getStartOffset, getTabbedSpan, getTabExpander, getText, modelToView, paint, setGlyphPainter, viewToModel
append, dump, forwardUpdate, forwardUpdateToView, getChildAllocation, getContainer, getDocument, getElement, getGraphics, getMaximumSpan, getParent, getResizeWeight, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, isVisible, modelToView, modelToView, preferenceChanged, remove, removeAll, replace, setParent, setSize, updateChildren, updateLayout, viewToModel
public InlineView(Element element)
InlineView
that renders the specified element.element
- the element for this viewpublic void insertUpdate(DocumentEvent e, Shape a, ViewFactory f)
insertUpdate
in class GlyphView
e
- the document eventa
- the current allocation of this viewf
- the view factory for creating new viewspublic void removeUpdate(DocumentEvent e, Shape a, ViewFactory f)
removeUpdate
in class GlyphView
e
- the document eventa
- the current allocation of this viewf
- the view factory for creating new viewspublic void changedUpdate(DocumentEvent e, Shape a, ViewFactory f)
setPropertiesFromAttributes()
.changedUpdate
in class LabelView
e
- the document eventa
- the current allocation of this viewf
- the view factory for creating new viewspublic AttributeSet getAttributes()
getAttributes
in class View
public int getBreakWeight(int axis, float pos, float len)
GlyphView
axis
is View.Y_AXIS
, then
this method forwards to the superclass, if axis
is
View.X_AXIS
then this method returns
View.ExcellentBreakWeight
if there is a suitable break location
(usually whitespace) within the specified view span, or
View.GoodBreakWeight
if not.getBreakWeight
in class GlyphView
axis
- the axis along which the break weight is requestedpos
- the starting view locationlen
- the length of the span at which the view should be brokenpublic View breakView(int axis, int offset, float pos, float len)
GlyphView
len
.
The glyph view can only be broken in the X direction. For Y direction it
returns itself.breakView
in class GlyphView
axis
- the axis for breaking, may be View.X_AXIS
or
View.Y_AXIS
offset
- the model location where the fragment should startpos
- the view position along the axis where the fragment startslen
- the desired length of the fragment viewthis
if breaking was not
possibleprotected void setPropertiesFromAttributes()
setPropertiesFromAttributes
in class LabelView
protected StyleSheet getStyleSheet()
HTMLDocument
that is rendered by this view.public float getMinimumSpan(int axis)
getMinimumSpan
in class View
axis
- the axis