APIdia Launch Partner
Top Description Fields Constructors Methods
javax.swing.text.html

public Class ParagraphView

extends ParagraphView
Class Inheritance
Known Direct Subclasses
javax.swing.text.html.LineView
Imports
java.awt.Component, .Graphics, .Rectangle, .Shape, javax.swing.SizeRequirements, javax.swing.text.AttributeSet, .Element, .JTextComponent, .StyleConstants, .View

Displays the paragraph and uses CSS attributes for its configuration.
Author
Timothy Prinzing

Field Summary

Modifier and TypeField and Description
private AttributeSet
private CSS.LengthValue
private CSS.LengthValue
private StyleSheet.BoxPainter
Inherited from javax.swing.text.ParagraphView:
firstLineIndent

Constructor Summary

AccessConstructor and Description
public
ParagraphView(Element
the element that this view is responsible for
elem
)

Constructs a ParagraphView for the given element.

Method Summary

Modifier and TypeMethod and Description
protected SizeRequirements

Returns:

the new or adjusted SizeRequirements object
calculateMinorAxisRequirements
(int
the minor axis
axis
,
SizeRequirements
the input SizeRequirements object
r
)

Overrides javax.swing.text.ParagraphView.calculateMinorAxisRequirements.

Calculate the needs for the paragraph along the minor axis.

public AttributeSet
getAttributes()

Overrides javax.swing.text.View.getAttributes.

Fetches the attributes to use when rendering.

public float

Returns:

the maximum span the view can be rendered into
getMaximumSpan
(int
may be either View.X_AXIS or View.Y_AXIS
axis
)

Overrides javax.swing.text.BoxView.getMaximumSpan.

Determines the maximum span for this view along an axis.

public float

Returns:

the minimum span the view can be rendered into
getMinimumSpan
(int
may be either View.X_AXIS or View.Y_AXIS
axis
)

Overrides javax.swing.text.BoxView.getMinimumSpan.

Determines the minimum span for this view along an axis.

public float

Returns:

the span the view would like to be rendered into; typically the view is told to render into the span that is returned, although there is no guarantee; the parent may choose to resize or break the view
getPreferredSpan
(int
may be either View.X_AXIS or View.Y_AXIS
axis
)

Overrides javax.swing.text.BoxView.getPreferredSpan.

Determines the preferred span for this view.

protected StyleSheet

Returns:

the StyleSheet
getStyleSheet
()

Convenient method to get the StyleSheet.

public boolean

Returns:

true if the paragraph should be displayed
isVisible
()

Overrides javax.swing.text.View.isVisible.

Indicates whether or not this view should be displayed.

public void
paint(Graphics
the rendering surface to use
g
,
Shape
the allocated region to render into
a
)

Overrides javax.swing.text.ParagraphView.paint.

Renders using the given rendering surface and area on that surface.

public void
setParent(View
the new parent, or null if the view is being removed from a parent it was previously added to
parent
)

Overrides javax.swing.text.FlowView.setParent.

Establishes the parent view for this view.

protected void
setPropertiesFromAttributes()

Overrides javax.swing.text.ParagraphView.setPropertiesFromAttributes.

Sets up the paragraph from css attributes instead of the values found in StyleConstants (i.e. which are used by the superclass).

Inherited from javax.swing.text.ParagraphView:
breakViewchangedUpdatecreateRowfindOffsetToCharactersInStringflipEastAndWestAtEndsgetAlignmentgetBreakWeightgetClosestPositionTogetFlowSpangetFlowStartgetLayoutViewgetLayoutViewCountgetNextNorthSouthVisualPositionFromgetPartialSizegetTabBasegetTabSetnextTabStopsetFirstLineIndentsetJustificationsetLineSpacing

Field Detail

attrback to summary
private AttributeSet attr
cssHeightback to summary
private CSS.LengthValue cssHeight
cssWidthback to summary
private CSS.LengthValue cssWidth
painterback to summary
private StyleSheet.BoxPainter painter

Constructor Detail

ParagraphViewback to summary
public ParagraphView(Element elem)

Constructs a ParagraphView for the given element.

Parameters
elem:Element

the element that this view is responsible for

Method Detail

calculateMinorAxisRequirementsback to summary
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r)

Overrides javax.swing.text.ParagraphView.calculateMinorAxisRequirements.

Calculate the needs for the paragraph along the minor axis.

If size requirements are explicitly specified for the paragraph, use that requirements. Otherwise, use the requirements of the superclass javax.swing.text.ParagraphView.

If the axis parameter is neither View.X_AXIS nor View.Y_AXIS, IllegalArgumentException is thrown. If the r parameter is null, a new SizeRequirements object is created, otherwise the supplied SizeRequirements object is returned.

Parameters
axis:int

the minor axis

r:SizeRequirements

the input SizeRequirements object

Returns:SizeRequirements

the new or adjusted SizeRequirements object

Exceptions
IllegalArgumentException:
if the axis parameter is invalid
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.

getMaximumSpanback to summary
public float getMaximumSpan(int axis)

Overrides javax.swing.text.BoxView.getMaximumSpan.

Determines the maximum span for this view along an axis. Returns 0 if the view is not visible, otherwise it calls the superclass method ot get the maximum span.

Parameters
axis:int

may be either View.X_AXIS or View.Y_AXIS

Returns:float

the maximum span the view can be rendered into

See Also
javax.swing.text.ParagraphView#getMaximumSpan
getMinimumSpanback to summary
public float getMinimumSpan(int axis)

Overrides javax.swing.text.BoxView.getMinimumSpan.

Determines the minimum span for this view along an axis. Returns 0 if the view is not visible, otherwise it calls the superclass method to get the minimum span.

Parameters
axis:int

may be either View.X_AXIS or View.Y_AXIS

Returns:float

the minimum span the view can be rendered into

See Also
javax.swing.text.ParagraphView#getMinimumSpan
getPreferredSpanback to summary
public float getPreferredSpan(int axis)

Overrides javax.swing.text.BoxView.getPreferredSpan.

Determines the preferred span for this view. Returns 0 if the view is not visible, otherwise it calls the superclass method to get the preferred span. axis.

Parameters
axis:int

may be either View.X_AXIS or View.Y_AXIS

Returns:float

the span the view would like to be rendered into; typically the view is told to render into the span that is returned, although there is no guarantee; the parent may choose to resize or break the view

See Also
javax.swing.text.ParagraphView#getPreferredSpan
getStyleSheetback to summary
protected StyleSheet getStyleSheet()

Convenient method to get the StyleSheet.

Returns:StyleSheet

the StyleSheet

isVisibleback to summary
public boolean isVisible()

Overrides javax.swing.text.View.isVisible.

Indicates whether or not this view should be displayed. If none of the children wish to be displayed and the only visible child is the break that ends the paragraph, the paragraph will not be considered visible. Otherwise, it will be considered visible and return true.

Returns:boolean

true if the paragraph should be displayed

paintback to summary
public void paint(Graphics g, Shape a)

Overrides javax.swing.text.ParagraphView.paint.

Renders using the given rendering surface and area on that surface. This is implemented to delegate to the superclass after stashing the base coordinate for tab calculations.

Parameters
g:Graphics

the rendering surface to use

a:Shape

the allocated region to render into

See Also
View#paint
setParentback to summary
public void setParent(View parent)

Overrides javax.swing.text.FlowView.setParent.

Establishes the parent view for this view. This is guaranteed to be called before any other methods if the parent view is functioning properly.

This is implemented to forward to the superclass as well as call the setPropertiesFromAttributes method to set the paragraph properties from the css attributes. The call is made at this time to ensure the ability to resolve upward through the parents view attributes.

Parameters
parent:View

the new parent, or null if the view is being removed from a parent it was previously added to

setPropertiesFromAttributesback to summary
protected void setPropertiesFromAttributes()

Overrides javax.swing.text.ParagraphView.setPropertiesFromAttributes.

Sets up the paragraph from css attributes instead of the values found in StyleConstants (i.e. which are used by the superclass). Since