Java Platform 1.2

javax.swing.text.html
Class ParagraphView

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

public class ParagraphView
extends ParagraphView

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


Fields inherited from class javax.swing.text.ParagraphView
firstLineIndent
 
Fields inherited from class javax.swing.text.View
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
 
Constructor Summary
ParagraphView(Element elem)
          Constructs a ParagraphView for the given element.
 
Method Summary
protected  SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r)
          Calculate the needs for the paragraph along the minor axis.
 void changedUpdate(DocumentEvent e, Shape a, ViewFactory f)
          Gives notification from the document that attributes were changed in a location that this view is responsible for.
 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.
protected  StyleSheet getStyleSheet()
           
 boolean isVisible()
          Indicates whether or not this view should be displayed.
 void setParent(View parent)
          Establishes the parent view for this view.
protected  void setPropertiesFromAttributes()
          Sets up the paragraph from css attributes instead of the values found in StyleConstants (i.e.
 
Methods inherited from class javax.swing.text.ParagraphView
adjustRow, breakView, findOffsetToCharactersInString, flipEastAndWestAtEnds, getAlignment, getBreakWeight, getClosestPositionTo, getLayoutView, getLayoutViewCount, getNextNorthSouthVisualPositionFrom, getPartialSize, getTabBase, getTabSet, getViewAtPosition, getViewIndexAtPosition, insertUpdate, layout, loadChildren, nextTabStop, paint, removeUpdate, setFirstLineIndent, setJustification, setLineSpacing
 
Methods inherited from class javax.swing.text.BoxView
baselineLayout, baselineRequirements, calculateMajorAxisRequirements, childAllocation, getHeight, getOffset, getResizeWeight, getSpan, getViewAtPoint, getWidth, isAfter, isAllocationValid, isBefore, layoutMajorAxis, layoutMinorAxis, modelToView, paintChild, preferenceChanged, replace, setSize, viewToModel
 
Methods inherited from class javax.swing.text.CompositeView
append, getBottomInset, getChildAllocation, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewCount, insert, modelToView, removeAll, setInsets, setParagraphInsets
 
Methods inherited from class javax.swing.text.View
breakView, createFragment, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getParent, getStartOffset, getViewFactory, modelToView, viewToModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParagraphView

public ParagraphView(Element elem)
Constructs a ParagraphView for the given element.
Parameters:
elem - the element that this view is responsible for
Method Detail

setParent

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
Overrides:
setParent in class CompositeView

getAttributes

public AttributeSet getAttributes()
Fetches the attributes to use when rendering. This is implemented to multiplex the attributes specified in the model with a StyleSheet.
Overrides:
getAttributes in class View

changedUpdate

public void changedUpdate(DocumentEvent e,
                          Shape a,
                          ViewFactory f)
Gives notification from the document that attributes were changed in a location that this view is responsible for. This causes the set of view attributes to be recomputed.
Parameters:
e - 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 ParagraphView
See Also:
View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)

setPropertiesFromAttributes

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
Overrides:
setPropertiesFromAttributes in class ParagraphView

getStyleSheet

protected StyleSheet getStyleSheet()

calculateMinorAxisRequirements

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.
Overrides:
calculateMinorAxisRequirements in class ParagraphView

isVisible

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.
Overrides:
isVisible in class View

getPreferredSpan

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
Overrides:
getPreferredSpan in class BoxView
See Also:
text.ParagraphView#getPreferredSpan

getMinimumSpan

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
Overrides:
getMinimumSpan in class BoxView
See Also:
text.ParagraphView#getMinimumSpan

getMaximumSpan

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
Overrides:
getMaximumSpan in class BoxView
See Also:
text.ParagraphView#getMaximumSpan

Java Platform 1.2

Submit a bug or feature Version 1.2 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.