javax.swing.text.html
Class ParagraphView
java.lang.Object
|
+--javax.swing.text.View
|
+--javax.swing.text.CompositeView
|
+--javax.swing.text.BoxView
|
+--javax.swing.text.FlowView
|
+--javax.swing.text.ParagraphView
|
+--javax.swing.text.html.ParagraphView
- All Implemented Interfaces:
- SwingConstants, TabExpander
- public class ParagraphView
- extends ParagraphView
Displays the a paragraph, and uses css attributes for its
configuration.
Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NORTH, NORTH_EAST, NORTH_WEST, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Methods inherited from class javax.swing.text.ParagraphView |
adjustRow, breakView, changedUpdate, createRow, findOffsetToCharactersInString, flipEastAndWestAtEnds, getAlignment, getBreakWeight, getClosestPositionTo, getFlowSpan, getFlowStart, getLayoutView, getLayoutViewCount, getNextNorthSouthVisualPositionFrom, getPartialSize, getTabBase, getTabSet, nextTabStop, setFirstLineIndent, setJustification, setLineSpacing |
Methods inherited from class javax.swing.text.BoxView |
baselineLayout, baselineRequirements, calculateMajorAxisRequirements, childAllocation, forwardUpdate, getAxis, getChildAllocation, getHeight, getOffset, getResizeWeight, getSpan, getViewAtPoint, getWidth, isAfter, isAllocationValid, isBefore, layoutChanged, layoutMajorAxis, layoutMinorAxis, modelToView, paintChild, preferenceChanged, replace, setAxis, setSize, viewToModel |
Methods inherited from class javax.swing.text.CompositeView |
getBottomInset, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewAtPosition, getViewCount, getViewIndex, modelToView, setInsets, setParagraphInsets |
Methods inherited from class javax.swing.text.View |
append, breakView, createFragment, forwardUpdateToView, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getViewFactory, 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 |
ParagraphView
public ParagraphView(Element elem)
- Constructs a ParagraphView for the given element.
- Parameters:
elem
- the element that this view is responsible for
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.
- Overrides:
setParent
in class CompositeView
- Parameters:
parent
- the new parent, or null if the view is
being removed from a parent it was previously added
to
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
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 FlowView
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
- Following copied from class:
javax.swing.text.View
- Returns:
- boolean value.
paint
public void paint(Graphics g,
Shape a)
- Renders using the given rendering surface and area on that
surface. This is implemented to delgate to the superclass
after stashing the base coordinate for tab calculations.
- Overrides:
paint
in class ParagraphView
- Parameters:
g
- the rendering surface to usea
- the allocated region to render into- See Also:
View.paint(java.awt.Graphics, java.awt.Shape)
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.
- Overrides:
getPreferredSpan
in class BoxView
- Parameters:
axis
- may be either View.X_AXIS or View.Y_AXIS- See Also:
BoxView.getPreferredSpan(int)
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.
- Overrides:
getMinimumSpan
in class BoxView
- Parameters:
axis
- may be either View.X_AXIS or View.Y_AXIS- See Also:
BoxView.getMinimumSpan(int)
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.
- Overrides:
getMaximumSpan
in class BoxView
- Parameters:
axis
- may be either View.X_AXIS or View.Y_AXIS- See Also:
BoxView.getMaximumSpan(int)
Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Java, Java 2D, and JDBC are trademarks or registered trademarks of Oracle and/or its affiliates, in the US and other countries.
Copyright © 1995, 2010 Oracle and/or its affiliates. All rights reserved.