All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.text.JParagraphView

java.lang.Object
   |
   +----com.sun.java.swing.text.JView
           |
           +----com.sun.java.swing.text.JCompositeView
                   |
                   +----com.sun.java.swing.text.JParagraphView

public class JParagraphView
extends JCompositeView
Implements View interface for a simple line-wrapping paragraph that supports multiple fonts, colors, components, icons, etc. It is basically a vertical box with a margin around it. The contents of the box are a bunch of rows which are special horizontal boxes.

See Also:
View

Constructor Index

 o JParagraphView(Element, ViewFactory)

Method Index

 o calculateSize(Rectangle, ViewFactory)
Calculates the size needed by the paragraph which is much like the vertical box except that it takes into account the spacing between each line if there are more than one line.
 o changedUpdate(DocumentEvent, Shape, ViewFactory)
 o childAllocation(int, Shape, ViewFactory)
 o getPreferredShape(Shape, ViewFactory)
Calculates the shape of the paragraph.
 o getViewAtPoint(Point, Rectangle, ViewFactory)
Not used
 o getViewAtPosition(Position, Rectangle, ViewFactory)
Fetch the child view that represents the given position in the model.
 o insertUpdate(DocumentEvent, Shape, ViewFactory)
 o isAfter(Point, Rectangle)
 o isBefore(Point, Rectangle)
 o modelToView(Position, Shape, ViewFactory)
 o paint(Graphics, Shape, ViewFactory)
If the allocated width has changed, layout is done again.
 o removeUpdate(DocumentEvent, Shape, ViewFactory)
 o viewToModel(Point, Shape, ViewFactory)

Constructors

 o JParagraphView
 public JParagraphView(Element elem,
                       ViewFactory f)

Methods

 o paint
 public void paint(Graphics g,
                   Shape allocation,
                   ViewFactory f)
If the allocated width has changed, layout is done again. The allocation given is reduced by the margins of the paragraph and forwarded to the base functionality.

Overrides:
paint in class JCompositeView
See Also:
paint
 o getPreferredShape
 public Shape getPreferredShape(Shape candidate,
                                ViewFactory f)
Calculates the shape of the paragraph. The width is basically whatever was given, but the height is calculated based upon the width. If the width has changed, a new height is calculated, otherwise the answer to the size request is cheap as it is simply whatever the last layout produced.

Overrides:
getPreferredShape in class JCompositeView
See Also:
getPreferredShape
 o modelToView
 public Shape modelToView(Position pos,
                          Shape a,
                          ViewFactory f) throws BadLocation
Throws: BadLocation
If the given position does not represent a valid location in the associated document.
Overrides:
modelToView in class JCompositeView
See Also:
modelToView
 o viewToModel
 public Position viewToModel(Point pt,
                             Shape a,
                             ViewFactory f)
Overrides:
viewToModel in class JCompositeView
See Also:
viewToModel
 o insertUpdate
 public void insertUpdate(DocumentEvent changes,
                          Shape a,
                          ViewFactory f)
Overrides:
insertUpdate in class JCompositeView
See Also:
insertUpdate
 o removeUpdate
 public void removeUpdate(DocumentEvent changes,
                          Shape a,
                          ViewFactory f)
Overrides:
removeUpdate in class JCompositeView
See Also:
removeUpdate
 o changedUpdate
 public void changedUpdate(DocumentEvent changes,
                           Shape a,
                           ViewFactory f)
Overrides:
changedUpdate in class JCompositeView
See Also:
changedUpdate
 o calculateSize
 protected Dimension calculateSize(Rectangle alloc,
                                   ViewFactory f)
Calculates the size needed by the paragraph which is much like the vertical box except that it takes into account the spacing between each line if there are more than one line.

Overrides:
calculateSize in class JCompositeView
 o childAllocation
 protected Rectangle childAllocation(int index,
                                     Shape allocation,
                                     ViewFactory f)
Overrides:
childAllocation in class JCompositeView
 o getViewAtPosition
 protected View getViewAtPosition(Position pos,
                                  Rectangle a,
                                  ViewFactory f)
Fetch the child view that represents the given position in the model. This is implemented to walk through the children looking for a range that contains the given position.

Parameters:
pos - The search position
a - The allocation to the box on entry, and the allocation of the view containing the position on exit.
Returns:
s The view representing the given position, or null if there isn't one.
Overrides:
getViewAtPosition in class JCompositeView
 o isBefore
 protected boolean isBefore(Point pt,
                            Rectangle alloc)
Overrides:
isBefore in class JCompositeView
 o isAfter
 protected boolean isAfter(Point pt,
                           Rectangle alloc)
Overrides:
isAfter in class JCompositeView
 o getViewAtPoint
 protected View getViewAtPoint(Point p,
                               Rectangle alloc,
                               ViewFactory f)
Not used

Overrides:
getViewAtPoint in class JCompositeView

All Packages  Class Hierarchy  This Package  Previous  Next  Index