javax.swing.text.html

Class ParagraphView

public class ParagraphView extends ParagraphView

Renders a paragraph in HTML. This is a subclass of {@link javax.swing.text.ParagraphView} with some adjustments for understanding stylesheets.
Constructor Summary
ParagraphView(Element element)
Creates a new ParagraphView for the specified element.
Method Summary
protected SizeRequirementscalculateMinorAxisRequirements(int axis, SizeRequirements r)
Calculates the minor axis requirements of this view.
AttributeSetgetAttributes()
Returns the attributes used by this view.
floatgetMaximumSpan(int axis)
Returns the maximum span of this view.
floatgetMinimumSpan(int axis)
Returns the minimum span of this view.
floatgetPreferredSpan(int axis)
Returns the preferred span of this view.
protected StyleSheetgetStyleSheet()
Returns the stylesheet used by this view.
booleanisVisible()
Determines if this view is visible or not.
voidpaint(Graphics g, Shape a)
Paints this view.
voidsetParent(View parent)
Sets the parent of this view.
protected voidsetPropertiesFromAttributes()
Loads the visual properties of the ParagraphView from the element's attributes and the stylesheet of the HTML document.

Constructor Detail

ParagraphView

public ParagraphView(Element element)
Creates a new ParagraphView for the specified element.

Parameters: element the element

Method Detail

calculateMinorAxisRequirements

protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r)
Calculates the minor axis requirements of this view. This is implemented to return the super class'es requirements and modifies the minimumSpan slightly so that it is not smaller than the length of the longest word.

Parameters: axis the axis r the SizeRequirements object to be used as return parameter; if null a new one will be created

Returns: the requirements along the minor layout axis

getAttributes

public AttributeSet getAttributes()
Returns the attributes used by this view. This is implemented to multiplex the attributes of the model with the attributes of the stylesheet.

getMaximumSpan

public float getMaximumSpan(int axis)
Returns the maximum span of this view. If this view is not visible, we return 0, otherwise the super class is called.

Parameters: axis the axis

Returns: the maximum span of this view

getMinimumSpan

public float getMinimumSpan(int axis)
Returns the minimum span of this view. If this view is not visible, we return 0, otherwise the super class is called.

Parameters: axis the axis

Returns: the minimum span of this view

getPreferredSpan

public float getPreferredSpan(int axis)
Returns the preferred span of this view. If this view is not visible, we return 0, otherwise the super class is called.

Parameters: axis the axis

Returns: the preferred span of this view

getStyleSheet

protected StyleSheet getStyleSheet()
Returns the stylesheet used by this view.

Returns: the stylesheet used by this view

isVisible

public boolean isVisible()
Determines if this view is visible or not. If none of the children is visible and the only visible child is the break that ends the paragraph, this paragraph is not considered to be visible.

Returns: the visibility of this paragraph

paint

public void paint(Graphics g, Shape a)
Paints this view. This paints the box using the stylesheet's box painter for this view and delegates to the super class paint() afterwards.

Parameters: g the graphics object a the current allocation of this view

setParent

public void setParent(View parent)
Sets the parent of this view. This is implemented to call the parent functionality and then trigger {@link #setPropertiesFromAttributes} in order to load the stylesheet attributes.

Parameters: parent the parent view to set

setPropertiesFromAttributes

protected void setPropertiesFromAttributes()
Loads the visual properties of the ParagraphView from the element's attributes and the stylesheet of the HTML document.