public class ParagraphView extends ParagraphView
Displays the a paragraph, and uses css attributes for its configuration.
FlowView.FlowStrategy
firstLineIndent
layoutPool, layoutSpan, strategy
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
public ParagraphView(Element elem)
Constructs a ParagraphView for the given element.
elem
- the element that this view is responsible forpublic 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.
setParent
in class FlowView
parent
- the new parent, or null if the view is being removed from a parent it was previously added topublic AttributeSet getAttributes()
Fetches the attributes to use when rendering. This is implemented to multiplex the attributes specified in the model with a StyleSheet.
getAttributes
in class View
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
setPropertiesFromAttributes
in class ParagraphView
protected StyleSheet getStyleSheet()
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r)
Calculate the needs for the paragraph along the minor axis.
If size requirements are explicitly specified for the paragraph, use that requirements. Otherwise, use the requirements of the superclass ParagraphView
.
If the axis
parameter is neither View.X_AXIS
nor View.Y_AXIS
, IllegalArgumentException
is thrown. If the r
parameter is null,
a new SizeRequirements
object is created, otherwise the supplied SizeRequirements
object is returned.
calculateMinorAxisRequirements
in class ParagraphView
axis
- the minor axisr
- the input SizeRequirements
objectSizeRequirements
objectIllegalArgumentException
- if the axis
parameter is invalidSizeRequirements
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.
public void paint(Graphics g, Shape a)
Renders using the given rendering surface and area on that surface. This is implemented to delegate to the superclass after stashing the base coordinate for tab calculations.
paint
in class ParagraphView
g
- the rendering surface to usea
- the allocated region to render intoView.paint(java.awt.Graphics, java.awt.Shape)
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.
getPreferredSpan
in class BoxView
axis
- may be either View.X_AXIS or View.Y_AXISBoxView.getPreferredSpan(int)
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.
getMinimumSpan
in class BoxView
axis
- may be either View.X_AXIS
or View.Y_AXIS
BoxView.getMinimumSpan(int)
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.
getMaximumSpan
in class BoxView
axis
- may be either View.X_AXIS
or View.Y_AXIS
BoxView.getMaximumSpan(int)
© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.