javax.swing.text.html

Class ParagraphView

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, setPropertiesFromAttributes

Methods inherited from class javax.swing.text.FlowView

calculateMinorAxisRequirements, changedUpdate, createRow, getFlowAxis, getFlowSpan, getFlowStart, getViewIndexAtPosition, insertUpdate, layout, loadChildren, removeUpdate

Methods inherited from class javax.swing.text.BoxView

baselineLayout, baselineRequirements, calculateMajorAxisRequirements, calculateMinorAxisRequirements, childAllocation, flipEastAndWestAtEnds, forwardUpdate, getAlignment, getAxis, getChildAllocation, getHeight, getMaximumSpan, getMinimumSpan, getOffset, getPreferredSpan, getResizeWeight, getSpan, getViewAtPoint, getWidth, isAfter, isAllocationValid, isBefore, isLayoutValid, layout, layoutChanged, layoutMajorAxis, layoutMinorAxis, modelToView, paint, paintChild, preferenceChanged, replace, setAxis, setSize, viewToModel

Methods inherited from class javax.swing.text.CompositeView

childAllocation, flipEastAndWestAtEnds, getBottomInset, getChildAllocation, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextNorthSouthVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewAtPoint, getViewAtPosition, getViewCount, getViewIndex, getViewIndexAtPosition, isAfter, isBefore, loadChildren, modelToView, modelToView, replace, setInsets, setParagraphInsets, setParent, viewToModel

Methods inherited from class javax.swing.text.View

append, breakView, changedUpdate, createFragment, dump, forwardUpdate, forwardUpdateToView, getAlignment, getAttributes, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getMaximumSpan, getMinimumSpan, getNextVisualPositionFrom, getParent, getPreferredSpan, getResizeWeight, getStartOffset, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, insertUpdate, isVisible, modelToView, modelToView, modelToView, paint, preferenceChanged, remove, removeAll, removeUpdate, replace, setParent, setSize, updateChildren, updateLayout, viewToModel, viewToModel

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

ParagraphView

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

Method Details

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 interface 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

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 interface 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 interface BoxView
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.
Overrides:
getMinimumSpan in interface BoxView
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.
Overrides:
getPreferredSpan in interface BoxView
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.
Overrides:
isVisible in interface 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 interface BoxView
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 setPropertiesFromAttributes() in order to load the stylesheet attributes.
Overrides:
setParent in interface CompositeView
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.
Overrides:
setPropertiesFromAttributes in interface ParagraphView

ParagraphView.java -- Renders a paragraph in HTML Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.