Top Description Fields Constructors Methods
javax.swing.text.html

public Class InlineView

extends LabelView
Class Inheritance
Known Direct Subclasses
javax.swing.text.html.BRView, javax.swing.text.html.ImageView.ImageLabelView
Imports
java.awt.*, java.text.BreakIterator, javax.swing.event.DocumentEvent, javax.swing.text.*

Displays the inline element styles based upon css attributes.
Author
Timothy Prinzing

Field Summary

Modifier and TypeField and Description
private AttributeSet
private boolean

Constructor Summary

AccessConstructor and Description
public
InlineView(Element
the element
elem
)

Constructs a new view wrapped on an element.

Method Summary

Modifier and TypeMethod and Description
public View

Returns:

the fragment of the view that represents the given span.
breakView
(int
may be either View.X_AXIS or View.Y_AXIS
axis
,
int
the location in the document model that a broken fragment would occupy >= 0. This would be the starting offset of the fragment returned
offset
,
float
the position along the axis that the broken view would occupy >= 0. This may be useful for things like tab calculations
pos
,
float
specifies the distance along the axis where a potential break is desired >= 0
len
)

Overrides javax.swing.text.GlyphView.breakView.

Tries to break this view on the given axis.
public void
changedUpdate(DocumentEvent
the change information from the associated document
e
,
Shape
the current allocation of the view
a
,
ViewFactory
the factory to use to rebuild if the view has children
f
)

Overrides javax.swing.text.LabelView.changedUpdate.

Gives notification from the document that attributes were changed in a location that this view is responsible for.
public AttributeSet
getAttributes()

Overrides javax.swing.text.View.getAttributes.

Fetches the attributes to use when rendering.
public int

Returns:

the weight, which should be a value between ForcedBreakWeight and BadBreakWeight.
getBreakWeight
(int
may be either View.X_AXIS or View.Y_AXIS
axis
,
float
the potential location of the start of the broken view >= 0. This may be useful for calculating tab positions.
pos
,
float
specifies the relative length from pos where a potential break is desired >= 0.
len
)

Overrides javax.swing.text.GlyphView.getBreakWeight.

Determines how attractive a break opportunity in this view is.
protected StyleSheet

Returns:

the StyleSheet
getStyleSheet
()

Convenient method to get the StyleSheet.

public void
insertUpdate(DocumentEvent
the change information from the associated document
e
,
Shape
the current allocation of the view
a
,
ViewFactory
the factory to use to rebuild if the view has children
f
)

Overrides javax.swing.text.GlyphView.insertUpdate.

Gives notification that something was inserted into the document in a location that this view is responsible for.
public void
removeUpdate(DocumentEvent
the change information from the associated document
e
,
Shape
the current allocation of the view
a
,
ViewFactory
the factory to use to rebuild if the view has children
f
)

Overrides javax.swing.text.GlyphView.removeUpdate.

Gives notification that something was removed from the document in a location that this view is responsible for.
protected void
setPropertiesFromAttributes()

Overrides javax.swing.text.LabelView.setPropertiesFromAttributes.

Set the cached properties from the attributes.
Inherited from javax.swing.text.LabelView:
getBackgroundgetFontgetFontMetricsgetForegroundisStrikeThroughisSubscriptisSuperscriptisUnderlinesetBackgroundsetStrikeThroughsetSubscriptsetSuperscriptsetUnderline

Field Detail

attrback to summary
private AttributeSet attr
nowrapback to summary
private boolean nowrap

Constructor Detail

InlineViewback to summary
public InlineView(Element elem)

Constructs a new view wrapped on an element.

Parameters
elem:Element

the element

Method Detail

breakViewback to summary
public View breakView(int axis, int offset, float pos, float len)

Overrides javax.swing.text.GlyphView.breakView.

Tries to break this view on the given axis. Refer to javax.swing.text.View#breakView for a complete description of this method.

Behavior of this method is unspecified in case axis is neither View.X_AXIS nor View.Y_AXIS, and in case offset, pos, or len is null.

Parameters
axis:int

may be either View.X_AXIS or View.Y_AXIS

offset:int

the location in the document model that a broken fragment would occupy >= 0. This would be the starting offset of the fragment returned

pos:float

the position along the axis that the broken view would occupy >= 0. This may be useful for things like tab calculations

len:float

specifies the distance along the axis where a potential break is desired >= 0

Returns:View

the fragment of the view that represents the given span.

Since
1.5
See Also
javax.swing.text.View#breakView
changedUpdateback to summary
public void changedUpdate(DocumentEvent e, Shape a, ViewFactory f)

Overrides javax.swing.text.LabelView.changedUpdate.

Gives notification from the document that attributes were changed in a location that this view is responsible for.

Parameters
e:DocumentEvent

the change information from the associated document

a:Shape

the current allocation of the view

f:ViewFactory

the factory to use to rebuild if the view has children

See Also
View#changedUpdate
getAttributesback to summary
public AttributeSet getAttributes()

Overrides javax.swing.text.View.getAttributes.

Fetches the attributes to use when rendering. This is implemented to multiplex the attributes specified in the model with a StyleSheet.

Returns:AttributeSet

Doc from javax.swing.text.View.getAttributes.

the attributes to use when rendering

getBreakWeightback to summary
public int getBreakWeight(int axis, float pos, float len)

Overrides javax.swing.text.GlyphView.getBreakWeight.

Determines how attractive a break opportunity in this view is. This can be used for determining which view is the most attractive to call breakView on in the process of formatting. A view that represents text that has whitespace in it might be more attractive than a view that has no whitespace, for example. The higher the weight, the more attractive the break. A value equal to or lower than BadBreakWeight should not be considered for a break. A value greater than or equal to ForcedBreakWeight should be broken.

This is implemented to provide the default behavior of returning BadBreakWeight unless the length is greater than the length of the view in which case the entire view represents the fragment. Unless a view has been written to support breaking behavior, it is not attractive to try and break the view. An example of a view that does support breaking is LabelView. An example of a view that uses break weight is ParagraphView.

Parameters
axis:int

may be either View.X_AXIS or View.Y_AXIS

pos:float

the potential location of the start of the broken view >= 0. This may be useful for calculating tab positions.

len:float

specifies the relative length from pos where a potential break is desired >= 0.

Returns:int

the weight, which should be a value between ForcedBreakWeight and BadBreakWeight.

See Also
LabelView, ParagraphView, javax.swing.text.View#BadBreakWeight, javax.swing.text.View#GoodBreakWeight, javax.swing.text.View#ExcellentBreakWeight, javax.swing.text.View#ForcedBreakWeight
getStyleSheetback to summary
protected StyleSheet getStyleSheet()

Convenient method to get the StyleSheet.

Returns:StyleSheet

the StyleSheet

insertUpdateback to summary
public void insertUpdate(DocumentEvent e, Shape a, ViewFactory f)

Overrides javax.swing.text.GlyphView.insertUpdate.

Gives notification that something was inserted into the document in a location that this view is responsible for. If either parameter is null, behavior of this method is implementation dependent.

Parameters
e:DocumentEvent

the change information from the associated document

a:Shape

the current allocation of the view

f:ViewFactory

the factory to use to rebuild if the view has children

Since
1.5
See Also
View#insertUpdate
removeUpdateback to summary
public void removeUpdate(DocumentEvent e, Shape a, ViewFactory f)

Overrides javax.swing.text.GlyphView.removeUpdate.

Gives notification that something was removed from the document in a location that this view is responsible for. If either parameter is null, behavior of this method is implementation dependent.

Parameters
e:DocumentEvent

the change information from the associated document

a:Shape

the current allocation of the view

f:ViewFactory

the factory to use to rebuild if the view has children

Since
1.5
See Also
View#removeUpdate
setPropertiesFromAttributesback to summary
protected void setPropertiesFromAttributes()

Overrides javax.swing.text.LabelView.setPropertiesFromAttributes.

Set the cached properties from the attributes.