javax.swing.text.html
Class ParagraphView

java.lang.Object
  extended by javax.swing.text.View
      extended by javax.swing.text.CompositeView
          extended by javax.swing.text.BoxView
              extended by javax.swing.text.FlowView
                  extended by javax.swing.text.ParagraphView
                      extended by javax.swing.text.html.ParagraphView
All Implemented Interfaces:
SwingConstants, TabExpander

public class ParagraphView
extends ParagraphView

Renders a paragraph in HTML. This is a subclass of ParagraphView with some adjustments for understanding stylesheets.


Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.text.FlowView
FlowView.FlowStrategy
 
Field Summary
 
Fields inherited from class javax.swing.text.ParagraphView
firstLineIndent
 
Fields inherited from class javax.swing.text.FlowView
layoutPool, layoutSpan, strategy
 
Fields inherited from class javax.swing.text.View
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
ParagraphView(Element element)
          Creates a new ParagraphView for the specified element.
 
Method Summary
protected  SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r)
          Calculates the minor axis requirements of this view.
 AttributeSet getAttributes()
          Returns the attributes used by this view.
 float getMaximumSpan(int axis)
          Returns the maximum span of this view.
 float getMinimumSpan(int axis)
          Returns the minimum span of this view.
 float getPreferredSpan(int axis)
          Returns the preferred span of this view.
protected  StyleSheet getStyleSheet()
          Returns the stylesheet used by this view.
 boolean isVisible()
          Determines if this view is visible or not.
 void paint(Graphics g, Shape a)
          Paints this view.
 void setParent(View parent)
          Sets the parent of this view.
protected  void setPropertiesFromAttributes()
          Loads the visual properties of the ParagraphView from the element's attributes and the stylesheet of the HTML document.
 
Methods inherited from class javax.swing.text.ParagraphView
adjustRow, breakView, changedUpdate, createRow, findOffsetToCharactersInString, getAlignment, getBreakWeight, getClosestPositionTo, getLayoutView, getLayoutViewCount, getPartialSize, getTabBase, getTabSet, nextTabStop, setFirstLineIndent, setJustification, setLineSpacing
 
Methods inherited from class javax.swing.text.FlowView
getFlowAxis, getFlowSpan, getFlowStart, getViewIndexAtPosition, insertUpdate, layout, loadChildren, removeUpdate
 
Methods inherited from class javax.swing.text.BoxView
baselineLayout, baselineRequirements, calculateMajorAxisRequirements, childAllocation, flipEastAndWestAtEnds, forwardUpdate, getAxis, getChildAllocation, getHeight, getOffset, getResizeWeight, getSpan, getViewAtPoint, getWidth, isAfter, isAllocationValid, isBefore, isLayoutValid, layoutChanged, layoutMajorAxis, layoutMinorAxis, modelToView, paintChild, preferenceChanged, replace, setAxis, setSize, viewToModel
 
Methods inherited from class javax.swing.text.CompositeView
getBottomInset, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextNorthSouthVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewAtPosition, getViewCount, getViewIndex, modelToView, setInsets, setParagraphInsets
 
Methods inherited from class javax.swing.text.View
append, breakView, createFragment, dump, forwardUpdateToView, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, modelToView, remove, removeAll, updateChildren, updateLayout, 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 element)
Creates a new ParagraphView for the specified element.

Parameters:
element - the element
Method Detail

setParent

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

Overrides:
setParent in class CompositeView
Parameters:
parent - the parent view to set

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.

Overrides:
getAttributes in class View

setPropertiesFromAttributes

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

Overrides:
setPropertiesFromAttributes in class ParagraphView

getStyleSheet

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

Returns:
the stylesheet used by this view

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.

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

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.

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

Overrides:
paint in class BoxView
Parameters:
g - the graphics object
a - the current allocation 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.

Overrides:
getPreferredSpan in class BoxView
Parameters:
axis - the axis
Returns:
the preferred 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.

Overrides:
getMinimumSpan in class BoxView
Parameters:
axis - the axis
Returns:
the minimum span of this view

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.

Overrides:
getMaximumSpan in class BoxView
Parameters:
axis - the axis
Returns:
the maximum span of this view