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
-
JParagraphView(Element, ViewFactory)
-
-
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.
-
changedUpdate(DocumentEvent, Shape, ViewFactory)
-
-
childAllocation(int, Shape, ViewFactory)
-
-
getPreferredShape(Shape, ViewFactory)
- Calculates the shape of the paragraph.
-
getViewAtPoint(Point, Rectangle, ViewFactory)
- Not used
-
getViewAtPosition(Position, Rectangle, ViewFactory)
- Fetch the child view that represents the given position in
the model.
-
insertUpdate(DocumentEvent, Shape, ViewFactory)
-
-
isAfter(Point, Rectangle)
-
-
isBefore(Point, Rectangle)
-
-
modelToView(Position, Shape, ViewFactory)
-
-
paint(Graphics, Shape, ViewFactory)
- If the allocated width has changed, layout is done again.
-
removeUpdate(DocumentEvent, Shape, ViewFactory)
-
-
viewToModel(Point, Shape, ViewFactory)
-
JParagraphView
public JParagraphView(Element elem,
ViewFactory f)
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
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
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
viewToModel
public Position viewToModel(Point pt,
Shape a,
ViewFactory f)
- Overrides:
- viewToModel in class JCompositeView
- See Also:
- viewToModel
insertUpdate
public void insertUpdate(DocumentEvent changes,
Shape a,
ViewFactory f)
- Overrides:
- insertUpdate in class JCompositeView
- See Also:
- insertUpdate
removeUpdate
public void removeUpdate(DocumentEvent changes,
Shape a,
ViewFactory f)
- Overrides:
- removeUpdate in class JCompositeView
- See Also:
- removeUpdate
changedUpdate
public void changedUpdate(DocumentEvent changes,
Shape a,
ViewFactory f)
- Overrides:
- changedUpdate in class JCompositeView
- See Also:
- changedUpdate
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
childAllocation
protected Rectangle childAllocation(int index,
Shape allocation,
ViewFactory f)
- Overrides:
- childAllocation in class JCompositeView
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
isBefore
protected boolean isBefore(Point pt,
Rectangle alloc)
- Overrides:
- isBefore in class JCompositeView
isAfter
protected boolean isAfter(Point pt,
Rectangle alloc)
- Overrides:
- isAfter in class JCompositeView
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