All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class java.awt.swing.text.ParagraphView

java.lang.Object
    |
    +----java.awt.swing.text.View
            |
            +----java.awt.swing.text.CompositeView
                    |
                    +----java.awt.swing.text.BoxView
                            |
                            +----java.awt.swing.text.ParagraphView

public class ParagraphView
extends BoxView
Implements View interface for a simple line-wrapping paragraph that supports multiple fonts, colors, components, icons, etc. It is basically a vertical box with a margin around it. The contents of the box are a bunch of rows which are special horizontal boxes.

See Also:
View

Constructor Index

 o ParagraphView(Element, ViewFactory)
Constructs a ParagraphView for the given element.

Method Index

 o changedUpdate(DocumentEvent, Shape, ViewFactory)
Gives notification from the document that attributes were changed in a location that this view is responsible for.
 o getAlignment(int)
Determines the desired alignment for this view along an axis.
 o getPreferredSpan(int)
Determines the preferred span for this view along an axis.
 o getResizeWeight(int)
Gets the resize weight.
 o getViewAtPosition(int, Rectangle)
Fetches the child view that represents the given position in the model.
 o insertUpdate(DocumentEvent, Shape, ViewFactory)
Gives notification that something was inserted into the document in a location that this view is responsible for.
 o layout(int, int)
Lays out the children.
 o removeUpdate(DocumentEvent, Shape, ViewFactory)
Gives notification that something was removed from the document in a location that this view is responsible for.

Constructors

 o ParagraphView
public ParagraphView(Element elem,
                     ViewFactory f)
Constructs a ParagraphView for the given element.

Parameters:
elem - the element that this view is responsible for
f - the factory to use to create views of the elements that are children of the element this view is responsible for

Methods

 o getPreferredSpan
public float getPreferredSpan(int axis)
Determines the preferred span for this view along an axis. For the paragraph it's whatever it was formated to along the x axis and whatever the box calculation is for the y axis.

Parameters:
axis - may be either X_AXIS or Y_AXIS
Throws: IllegalArgumentException
for an invalid axis
Overrides:
getPreferredSpan in class BoxView
 o getAlignment
public float getAlignment(int axis)
Determines the desired alignment for this view along an axis. This is implemented to give the alignment to the center of the first row along the y axis, and the default along the x axis.

Parameters:
axis - may be either X_AXIS or Y_AXIS
Overrides:
getAlignment in class BoxView
 o getResizeWeight
public int getResizeWeight(int axis)
Gets the resize weight.

Parameters:
axis - may be wither X_AXIS or Y_AXIS
Returns:
the weight
Throws: IllegalArgumentException
for an invalid axis
Overrides:
getResizeWeight in class BoxView
 o insertUpdate
public void insertUpdate(DocumentEvent changes,
                         Shape a,
                         ViewFactory f)
Gives notification that something was inserted into the document in a location that this view is responsible for.

Parameters:
changes - the change information from the associated document
a - the current allocation of the view
f - the factory to use to rebuild if the view has children
Overrides:
insertUpdate in class BoxView
See Also:
insertUpdate
 o removeUpdate
public void removeUpdate(DocumentEvent changes,
                         Shape a,
                         ViewFactory f)
Gives notification that something was removed from the document in a location that this view is responsible for.

Parameters:
changes - the change information from the associated document
a - the current allocation of the view
f - the factory to use to rebuild if the view has children
Overrides:
removeUpdate in class BoxView
See Also:
removeUpdate
 o changedUpdate
public void changedUpdate(DocumentEvent changes,
                          Shape a,
                          ViewFactory f)
Gives notification from the document that attributes were changed in a location that this view is responsible for.

Parameters:
changes - the change information from the associated document
a - the current allocation of the view
f - the factory to use to rebuild if the view has children
Overrides:
changedUpdate in class BoxView
See Also:
changedUpdate
 o getViewAtPosition
protected View getViewAtPosition(int pos,
                                 Rectangle a)
Fetches the child view that represents the given position in the model. This is implemented to walk through the children looking for a range that contains the given position. In this view the children do not have a one to one mapping with the child elements.

Parameters:
pos - the search position
a - the allocation to the box on entry, and the allocation of the view containing the position on exit
Overrides:
getViewAtPosition in class CompositeView
 o layout
protected void layout(int width,
                      int height)
Lays out the children. If the layout span has changed, the rows are rebuilt. The superclass functionality is called after checking and possibly rebuilding the rows. If the height has changed, the preferenceChanged method is called on the parent since the vertical preference is rigid.

Parameters:
width - the width to lay out against. This is the width inside of the inset area.
height - the height to lay out against (not used by paragraph, but used by the superclass). This is the height inside of the inset area.
Overrides:
layout in class BoxView

All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature