public class

ParagraphView

extends ParagraphView
java.lang.Object
   ↳ javax.swing.text.View
     ↳ javax.swing.text.CompositeView
       ↳ javax.swing.text.BoxView
         ↳ javax.swing.text.FlowView
           ↳ javax.swing.text.ParagraphView
             ↳ javax.swing.text.html.ParagraphView

Class Overview

Displays the a paragraph, and uses css attributes for its configuration.

Summary

[Expand]
Inherited Constants
From class javax.swing.text.View
From interface javax.swing.SwingConstants
[Expand]
Inherited Fields
From class javax.swing.text.ParagraphView
From class javax.swing.text.FlowView
Public Constructors
ParagraphView(Element elem)
Constructs a ParagraphView for the given element.
Public Methods
AttributeSet getAttributes()
Fetches the attributes to use when rendering.
float getMaximumSpan(int axis)
Determines the maximum span for this view along an axis.
float getMinimumSpan(int axis)
Determines the minimum span for this view along an axis.
float getPreferredSpan(int axis)
Determines the preferred span for this view.
boolean isVisible()
Indicates whether or not this view should be displayed.
void paint(Graphics g, Shape a)
Renders using the given rendering surface and area on that surface.
void setParent(View parent)
Establishes the parent view for this view.
Protected Methods
SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r)
Calculate the needs for the paragraph along the minor axis.
StyleSheet getStyleSheet()
void setPropertiesFromAttributes()
Sets up the paragraph from css attributes instead of the values found in StyleConstants (i.e.
[Expand]
Inherited Methods
From class javax.swing.text.ParagraphView
From class javax.swing.text.FlowView
From class javax.swing.text.BoxView
From class javax.swing.text.CompositeView
From class javax.swing.text.View
From class java.lang.Object
From interface javax.swing.text.TabExpander

Public Constructors

public ParagraphView (Element elem)

Constructs a ParagraphView for the given element.

Parameters
elem the element that this view is responsible for

Public Methods

public AttributeSet getAttributes ()

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

public float getMaximumSpan (int axis)

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 may be either View.X_AXIS or View.Y_AXIS
Returns
  • the maximum span the view can be rendered into

public float getMinimumSpan (int axis)

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 may be either View.X_AXIS or View.Y_AXIS
Returns
  • the minimum span the view can be rendered into

public float getPreferredSpan (int axis)

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 may be either View.X_AXIS or View.Y_AXIS
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

public boolean 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
  • true if the paragraph should be displayed

public void paint (Graphics g, Shape a)

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

Parameters
g the rendering surface to use
a the allocated region to render into

public void setParent (View parent)

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 the new parent, or null if the view is being removed from a parent it was previously added to

Protected Methods

protected SizeRequirements calculateMinorAxisRequirements (int axis, SizeRequirements r)

Calculate the needs for the paragraph along the minor axis. This implemented to use the requirements of the superclass, modified slightly to set a minimum span allowed. Typical html rendering doesn't let the view size shrink smaller than the length of the longest word.

Parameters
axis the axis being studied
r the SizeRequirements object; if null one will be created
Returns
  • the newly initialized SizeRequirements object

protected StyleSheet getStyleSheet ()

protected void setPropertiesFromAttributes ()

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